2022-10-26 17:43:08 +00:00
|
|
|
|
2023-02-22 14:45:29 +00:00
|
|
|
[![Build Status](https://cicd.apps.glenux.net/api/badges/glenux-opencontainers/service-forgejo/status.svg)](https://cicd.apps.glenux.net/glenux-opencontainers/service-forgejo)
|
|
|
|
|
2022-12-30 14:25:32 +00:00
|
|
|
# Forgejo
|
2022-10-26 17:43:08 +00:00
|
|
|
|
|
|
|
## Setup on Dokku
|
|
|
|
|
2023-02-22 14:25:05 +00:00
|
|
|
<!--
|
2022-10-26 17:43:08 +00:00
|
|
|
Define secrets
|
|
|
|
|
|
|
|
$(openssl rand -hex 16)
|
2023-02-22 14:25:05 +00:00
|
|
|
-->
|
2022-10-26 17:43:08 +00:00
|
|
|
|
|
|
|
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
|
2022-12-30 14:25:32 +00:00
|
|
|
dokku storage:mount /home/data/code.forgejo/data:/data
|
2022-10-26 17:43:08 +00:00
|
|
|
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
|
|
|
|
|
2022-12-30 14:27:08 +00:00
|
|
|
git remote add dokku dokku@example.com:code
|
2022-10-26 17:43:08 +00:00
|
|
|
git push
|
|
|
|
|
|
|
|
## Create Wrapper
|
|
|
|
|
2022-12-30 14:24:35 +00:00
|
|
|
Add git user on host
|
|
|
|
|
|
|
|
adduser --disabled-password git
|
|
|
|
adduser git docker
|
2022-10-26 17:43:08 +00:00
|
|
|
|
|
|
|
Create ssh key for git user
|
|
|
|
|
2023-02-22 14:29:38 +00:00
|
|
|
ssh-keygen -t rsa -f /home/git/.ssh/id_rsa -C "Forgejo Host Key"
|
2022-10-26 17:43:08 +00:00
|
|
|
chmod 600 /home/git/.ssh/id_rsa
|
|
|
|
|
2022-12-30 14:25:32 +00:00
|
|
|
Create `/usr/local/bin/forgejo` with the following content
|
2022-10-26 17:43:08 +00:00
|
|
|
|
2023-02-22 14:29:38 +00:00
|
|
|
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 )"
|
2022-10-26 17:43:08 +00:00
|
|
|
|
2023-02-22 14:29:38 +00:00
|
|
|
ssh -T -p 22 -o StrictHostKeyChecking=no git@$FORGEJO_IP "SSH_ORIGINAL_COMMAND=\"$SSH_ORIGINAL_COMMAND\" $0 $@"
|
2022-10-26 17:43:08 +00:00
|
|
|
|
2022-12-30 14:24:35 +00:00
|
|
|
Success.
|
|
|
|
|