No description
Find a file
2024-05-04 19:28:41 +00:00
scripts feat: Add host scripts 2023-02-22 15:41:15 +01:00
.drone.yml ci: Add backslashes 2023-02-21 13:35:46 +01:00
docker-compose.yml docker: Change names gitea->forgejo 2023-02-04 12:25:50 +01:00
Dockerfile Update Dockerfile 2024-05-04 19:28:41 +00:00
entrypoint-wrapper Fix typo 2022-08-15 12:35:09 +02:00
parse-database-url Fix env variables 2022-08-15 12:19:43 +02:00
README.md doc: Add badge 2023-02-22 15:45:29 +01:00

Build Status

Forgejo

Setup on Dokku

Create APP

dokku apps:create code

Setup Network & Domains

dokku network:create cicd_net
dokku network:set code attach-post-create cicd_net
dokku config:set --no-restart code DOKKU_LETSENCRYPT_EMAIL=username@example.com

Setup Storage

dokku storage:mount /etc/localtime:/etc/localtime:ro
dokku storage:mount /etc/timezone:/etc/timezone:ro
dokku storage:mount /home/data/code.forgejo/data:/data
dokku storage:mount /home/git/.ssh/:/data/git/.ssh

Setup Configuration

dokku config:set code
DATABASE_URL:             mysql://xxxxx
REDIS_URL:                redis://xxxxx
USER_GID:                 1002
USER_UID:                 1002

Deploy

git remote add dokku dokku@example.com:code
git push

Create Wrapper

Add git user on host

adduser --disabled-password git
adduser git docker

Create ssh key for git user

ssh-keygen -t rsa -f /home/git/.ssh/id_rsa -C "Forgejo Host Key"
chmod 600 /home/git/.ssh/id_rsa

Create /usr/local/bin/forgejo with the following content

FORGEJO_CID=code.web.1
# FORGEJO_IP="$(docker inspect "$FORGEJO_CID" -f '{{ (index (index .NetworkSettings.Ports "80/tcp") 0).HostPort }}')"
FORGEJO_IP="$(docker inspect "$FORGEJO_CID"  -f '{{ .NetworkSettings.IPAddress }}' 2>/dev/null )"

ssh -T -p 22 -o StrictHostKeyChecking=no git@$FORGEJO_IP "SSH_ORIGINAL_COMMAND=\"$SSH_ORIGINAL_COMMAND\" $0 $@"

Success.