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.

35 lines
986 B

  1. #!/bin/sh
  2. set -e
  3. APP_NAME="gogs"
  4. CLI="${APP_NAME}"
  5. APP_USER=$(${CLI} config:get APP_USER)
  6. APP_GROUP=$(${CLI} config:get APP_GROUP)
  7. APP_CONFIG="/etc/${APP_NAME}/conf/app.ini"
  8. case "$1" in
  9. abort-upgrade|abort-remove|abort-deconfigure)
  10. exit 0
  11. ;;
  12. configure|*)
  13. mkdir -p $(dirname ${APP_CONFIG})
  14. chown ${APP_USER}.${APP_GROUP} $(dirname ${APP_CONFIG})
  15. [ -f ${APP_CONFIG} ] || ${CLI} run cp conf/app.ini ${APP_CONFIG}
  16. ${CLI} config:set USER=${APP_USER}
  17. PORT=$(${CLI} config:get PORT || echo "6000")
  18. sed -i "s|HTTP_PORT = 3000|HTTP_PORT = ${PORT}|" ${APP_CONFIG}
  19. sed -i "s|RUN_USER = git|RUN_USER = ${APP_USER}|" ${APP_CONFIG}
  20. sed -i "s|RUN_MODE = dev|RUN_MODE = prod|" ${APP_CONFIG}
  21. # setup symlink towards custom conf
  22. mkdir -p /opt/${APP_NAME}/custom/conf
  23. chown -R ${APP_USER}.${APP_GROUP} /opt/${APP_NAME}/custom
  24. ln -f -s ${APP_CONFIG} /opt/${APP_NAME}/custom/conf/app.ini
  25. # scale
  26. ${CLI} scale web=1 || true
  27. ;;
  28. esac