service/services/gitea.spec

29 lines
1.2 KiB
Plaintext

command: ./gitea -C . -w . -c ./custom/conf/app.ini
# deamon's working directory
directory: ${SERVICE_ROOT} # FIXME: Could this be removed?
consumes: postgresql
%pre-start
name: working directory
# 'command' is run only if this directory doesn't exist
unless-directory: ${SERVICE_ROOT}/custom/conf/
command: mkdir -p ${SERVICE_ROOT}/custom/conf/
%pre-start
name: symlink
# 'command' is run only if this directory doesn't exist
unless-file: ${SERVICE_ROOT}/gitea
command: ln -s $(which gitea) ${SERVICE_ROOT}/gitea
%pre-start
name: configuration file
# 'command' is run only if this file doesn't exist
unless-file: ${SERVICE_ROOT}/custom/conf/app.ini
command: gen-config gitea.cfg ${SERVICE_ROOT}/custom/conf/app.ini postgresql=${POSTGRESQL_PROVIDER}
%pre-start
name: gitea database creation
# 'command' is run only if this directory doesn't exist
unless-file: ${SERVICE_ROOT}/db_is_setup
command: pg_create_user.sh --pghost=localhost --pgport=$(get-port $POSTGRESQL_PROVIDER) --pgdatadir=$POSTGRESQL_ROOT --pguser=postgres --dbuser=${ENVIRONMENT}_gitea --dbpassfile=${SERVICE_ROOT}/password_main --dbname=${ENVIRONMENT}_gitea_db create_user_and_db && touch ${SERVICE_ROOT}/db_is_setup