New service: gitea.

master
Philippe PITTOLI 2019-10-24 15:54:15 +02:00
parent 60dc0917d4
commit 59b78e3af5
3 changed files with 102 additions and 1 deletions

29
services/gitea.spec Normal file
View File

@ -0,0 +1,29 @@
name: gitea
command: ./gitea
# deamon's working directory
directory: /srv/${ENVIRONMENT}/gitea
consumes: postgresql
%check
name: working directory
# 'command' is run only if this directory doesn't exist
directory: /srv/${ENVIRONMENT}/gitea/custom/conf/
command: mkdir -p /srv/${ENVIRONMENT}/gitea/custom/conf/
%check
name: symlink
# 'command' is run only if this directory doesn't exist
file: /srv/${ENVIRONMENT}/gitea/gitea
command: ln -s $(which gitea) /srv/${ENVIRONMENT}/gitea/
%check
name: configuration file
# 'command' is run only if this file doesn't exist
file: /srv/${ENVIRONMENT}/gitea/custom/conf/app.ini
command: gen-config gitea.cfg /srv/${ENVIRONMENT}/gitea/custom/conf/app.ini postgresql=${POSTGRESQL_PROVIDER}
%check
name: gitea database creation
# 'command' is run only if this directory doesn't exist
file: /srv/${ENVIRONMENT}/gitea/db_is_setup
command: pg_create_user.sh --pghost=localhost --pgport=$(get-port $POSTGRESQL_PROVIDER) --pgdatadir=/srv/$POSTGRESQL_ENVIRONMENT/postgresql --pguser=postgres --dbuser=${ENVIRONMENT}_gitea --dbpassfile=/srv/$ENVIRONMENT/gitea/password_main --dbname=${ENVIRONMENT}_gitea_db create_user_and_db && touch /srv/$ENVIRONMENT/gitea/db_is_setup

View File

@ -4,7 +4,7 @@ command: postgres -D /srv/${ENVIRONMENT}/postgresql -k /tmp/postgresql-${ENVIRON
#stop-command: kill -HUP ${PID} #stop-command: kill -HUP ${PID}
environment-variables: environment-variables:
- PGROOT=/srv/${ENVIRONMENT}/postgresql - PGROOT=/srv/${ENVIRONMENT}/postgresql
provides: postgres provides: postgresql
%check %check
name: database directory creation name: database directory creation

72
templates/gitea.cfg.j2 Normal file
View File

@ -0,0 +1,72 @@
# This is my template comment
APP_NAME = Gitea: Git with a cup of tea
RUN_USER = root
RUN_MODE = prod
# This is my template comment
[oauth2]
JWT_SECRET = cRRpOv8jL5UNUzSXMzvdeN_-IWhpQOtpPOKsMZBFwJI
[security]
INTERNAL_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE1NzE4MjkwMjl9.bGFA2wn3daZx_954cf7ME3o8CrTyLEibmoyV_aD-pTQ
INSTALL_LOCK = true
SECRET_KEY = vPFgSqRMIe7Dzk4frRM4UA3CETedL8agK7x6IQFQt9YfRPiQGhQbYAGfyan71iUa
[database]
DB_TYPE = postgres
HOST = 127.0.0.1:{{ port(providers.postgresql) }}
NAME = {{ id | replace("/", "_") }}_db
USER = {{ id | replace("/", "_") }}
PASSWD = {{ random_password( id ) }}
SSL_MODE = disable
CHARSET = utf8
PATH = /srv/{{ environment }}/gitea/data/gitea.db
[repository]
ROOT = /srv/{{ environment }}/gitea/repositories
[server]
SSH_DOMAIN = localhost
DOMAIN = localhost
HTTP_PORT = {{ port(id) }}
ROOT_URL = http://localhost:{{ port(id) }}/
DISABLE_SSH = false
SSH_PORT = 22
LFS_START_SERVER = true
LFS_CONTENT_PATH = /srv/{{ environment }}/gitea/data/lfs
LFS_JWT_SECRET = nUIANTsStEelCeOo7SFTcJllpJ6I8DXNr7duUgGMXfI
OFFLINE_MODE = false
[mailer]
ENABLED = false
[service]
REGISTER_EMAIL_CONFIRM = false
ENABLE_NOTIFY_MAIL = false
DISABLE_REGISTRATION = false
ALLOW_ONLY_EXTERNAL_REGISTRATION = false
ENABLE_CAPTCHA = false
REQUIRE_SIGNIN_VIEW = false
DEFAULT_KEEP_EMAIL_PRIVATE = false
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
DEFAULT_ENABLE_TIMETRACKING = true
NO_REPLY_ADDRESS = noreply.example.org
[picture]
DISABLE_GRAVATAR = false
ENABLE_FEDERATED_AVATAR = true
[openid]
ENABLE_OPENID_SIGNIN = true
ENABLE_OPENID_SIGNUP = true
[session]
PROVIDER = file
[log]
MODE = file
LEVEL = info
ROOT_PATH = /srv/{{ environment }}/gitea/log