IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
2.9KB

  1. images:
  2. gitea-latest: .
  3. certbot-latest: ../certbot
  4. volumes:
  5. gitea-data: {}
  6. certbot-webroot: {}
  7. certbot-config-gitea: {}
  8. jails:
  9. gitea:
  10. meta:
  11. domains:
  12. - xyz.com
  13. - www.xyz.com
  14. image: gitea-latest
  15. mounts:
  16. gitea-data: /var/db/gitea
  17. ip4.addr: 127.0.8.1
  18. exec.start: |
  19. export IP4_ADDR=127.0.8.1 && \
  20. export DOMAIN_NAME=xyz.com && \
  21. export GITEA_CONF=/usr/local/etc/gitea/conf/app.ini && \
  22. chown git:git /var/db/gitea && \
  23. sed -i -e "s/127.0.0.1/${IP4_ADDR}/g" $GITEA_CONF && \
  24. sed -i -e "s/localhost/${DOMAIN_NAME}/g" $GITEA_CONF && \
  25. crudini --set --inplace $GITEA_CONF server ROOT_URL https://${DOMAIN_NAME} && \
  26. crudini --set --inplace $GITEA_CONF server DISABLE_SSH true && \
  27. crudini --set --inplace $GITEA_CONF service DEFAULT_ALLOW_CREATE_ORGANIZATION false && \
  28. crudini --set --inplace $GITEA_CONF service DEFAULT_KEEP_EMAIL_PRIVATE true && \
  29. crudini --set --inplace $GITEA_CONF repository MAX_CREATION_LIMIT 0 && \
  30. crudini --set --inplace $GITEA_CONF server LANDING_PAGE explore && \
  31. crudini --set --inplace $GITEA_CONF service DISABLE_REGISTRATION false && \
  32. crudini --set --inplace $GITEA_CONF repository DEFAULT_REPO_UNITS repo.code && \
  33. export SECRET_CONF=/var/db/gitea/focker-secrets.ini && \
  34. if [ ! -f $SECRET_CONF ]; then
  35. touch $SECRET_CONF && \
  36. chown root:git $SECRET_CONF && \
  37. chmod 640 $SECRET_CONF && \
  38. crudini --set --inplace $SECRET_CONF oauth2 JWT_SECRET `gitea generate secret JWT_SECRET` && \
  39. crudini --set --inplace $SECRET_CONF security INTERNAL_TOKEN `gitea generate secret INTERNAL_TOKEN` && \
  40. crudini --set --inplace $SECRET_CONF security SECRET_KEY `gitea generate secret SECRET_KEY`; \
  41. fi && \
  42. if [ ! -f /var/db/gitea/gitea.db ]; then \
  43. su git -c 'gitea migrate -c $GITEA_CONF' && \
  44. su git -c 'gitea admin -c $GITEA_CONF create-user --username admin1 --password "AdminAdmin1+" --email "invaliduser@nonexistentdomain.com" --admin'; \
  45. fi && \
  46. crudini --set --inplace $GITEA_CONF oauth2 JWT_SECRET `crudini --get $SECRET_CONF oauth2 JWT_SECRET` && \
  47. crudini --set --inplace $GITEA_CONF security INTERNAL_TOKEN `crudini --get $SECRET_CONF security INTERNAL_TOKEN` && \
  48. crudini --set --inplace $GITEA_CONF security SECRET_KEY `crudini --get $SECRET_CONF security SECRET_KEY` && \
  49. /bin/sh /etc/rc
  50. certbot-gitea:
  51. image: certbot-latest
  52. mounts:
  53. certbot-webroot: /certbot/webroot
  54. certbot-config-gitea: /usr/local/etc/letsencrypt
  55. ip4.addr: 127.0.9.1
  56. exec.start: |
  57. if [ ! -f /usr/local/etc/letsencrypt/cli.ini ]; then
  58. echo 'webroot-path=/certbot/webroot' >>/usr/local/etc/letsencrypt/cli.ini && \
  59. echo 'authenticator=webroot' >>/usr/local/etc/letsencrypt/cli.ini;
  60. fi && \
  61. /bin/sh /etc/rc