base gitea
This commit is contained in:
46
cookbooks/hosting/recipes/gitea.rb
Normal file
46
cookbooks/hosting/recipes/gitea.rb
Normal file
@ -0,0 +1,46 @@
|
||||
remote_file '/opt/theta42/bin/gitea' do
|
||||
source 'https://github.com/go-gitea/gitea/releases/download/v1.8.1/gitea-1.8.1-linux-amd64'
|
||||
mode '0755'
|
||||
action :create
|
||||
end
|
||||
|
||||
template '/opt/theta42/gitea/conf/app.ini' do
|
||||
source 'app.ini.erb'
|
||||
owner 'gitea'
|
||||
group 'gitea'
|
||||
mode '0755'
|
||||
end
|
||||
|
||||
systemd_unit 'gitea.service' do
|
||||
content <<-EOU.gsub(/^\s+/, '')
|
||||
[Unit]
|
||||
Description=Gitea (Git with a cup of tea)
|
||||
After=syslog.target
|
||||
After=network.target
|
||||
After=postgresql.service
|
||||
|
||||
|
||||
[Service]
|
||||
# Modify these two values and uncomment them if you have
|
||||
# repos with lots of files and get an HTTP error 500 because
|
||||
# of that
|
||||
###
|
||||
#LimitMEMLOCK=infinity
|
||||
#LimitNOFILE=65535
|
||||
RestartSec=10s
|
||||
Type=simple
|
||||
User=gitea
|
||||
Group=gitea
|
||||
WorkingDirectory=/opt/theta42/gitea
|
||||
ExecStart=/opt/theta42/bin/gitea web --config /opt/theta42/gitea/conf/app.ini
|
||||
Restart=always
|
||||
Environment=USER=gitea HOME=/home/gitea GITEA_WORK_DIR=/opt/theta42/gitea GITEA_CUSTOM=/opt/theta42/gitea/custom
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
|
||||
EOU
|
||||
|
||||
action [:create, :enable, :start]
|
||||
end
|
@ -12,9 +12,37 @@ directory '/opt/theta42/bin' do
|
||||
action :create
|
||||
end
|
||||
|
||||
directory '/home/gitea' do
|
||||
owner 'gitea'
|
||||
group 'gitea'
|
||||
mode '0755'
|
||||
action :create
|
||||
end
|
||||
|
||||
directory '/opt/theta42/gitea' do
|
||||
owner 'gitea'
|
||||
group 'gitea'
|
||||
mode '0755'
|
||||
action :create
|
||||
end
|
||||
|
||||
directory '/opt/theta42/gitea/conf' do
|
||||
owner 'gitea'
|
||||
group 'gitea'
|
||||
mode '0755'
|
||||
action :create
|
||||
end
|
||||
|
||||
directory '/opt/theta42/gitea/data' do
|
||||
owner 'gitea'
|
||||
group 'gitea'
|
||||
mode '0755'
|
||||
action :create
|
||||
end
|
||||
|
||||
directory '/opt/theta42/gitea/custom' do
|
||||
owner 'gitea'
|
||||
group 'gitea'
|
||||
mode '0755'
|
||||
action :create
|
||||
end
|
||||
|
@ -1,7 +1,15 @@
|
||||
target_locale = 'en_US.UTF-8'
|
||||
|
||||
postgresql_server_install 'My PostgreSQL Server install' do
|
||||
initdb_locale 'en_US.utf8'
|
||||
action :install
|
||||
end
|
||||
|
||||
postgresql_server_install 'Setup my PostgreSQL 9.6 server' do
|
||||
initdb_locale 'en_US.utf8'
|
||||
action :create
|
||||
end
|
||||
|
||||
postgresql_access 'local_postgres_superuser' do
|
||||
comment 'Local postgres superuser access'
|
||||
access_type 'local'
|
||||
@ -13,5 +21,35 @@ end
|
||||
|
||||
postgresql_user 'gitea' do
|
||||
password 'UserP4ssword'
|
||||
createdb true
|
||||
# createrole true
|
||||
end
|
||||
|
||||
# Hack for creating a database, this cook book is broken with debian...
|
||||
|
||||
execute 'add database' do
|
||||
command 'createdb gitea'
|
||||
user 'postgres'
|
||||
not_if 'psql -lqt | cut -d \| -f 1 | grep -qw gitea', :user => 'postgres'
|
||||
end
|
||||
|
||||
execute 'Grant gitea user' do
|
||||
command 'echo "grant all privileges on database gitea to gitea ;" | psql'
|
||||
user 'postgres'
|
||||
end
|
||||
|
||||
template '/home/gitea/dump.sql' do
|
||||
source 'gitea_postgres.sql.erb'
|
||||
owner 'gitea'
|
||||
group 'gitea'
|
||||
mode '0755'
|
||||
end
|
||||
|
||||
execute 'base DB' do
|
||||
command 'psql gitea < /home/gitea/dump.sql'
|
||||
user 'postgres'
|
||||
end
|
||||
|
||||
# postgresql_database 'gitea' do
|
||||
# locale 'en_US.utf8'
|
||||
# owner 'gitea'
|
||||
# end
|
||||
|
@ -1,8 +1,8 @@
|
||||
user 'gitea system user' do
|
||||
comment 'gitea system user'
|
||||
username 'gitea'
|
||||
system true
|
||||
shell '/bin/false'
|
||||
home '/home/gitea'
|
||||
shell '/bin/bash'
|
||||
end
|
||||
|
||||
group 'gitea' do
|
||||
|
67
cookbooks/hosting/templates/app.ini.erb
Normal file
67
cookbooks/hosting/templates/app.ini.erb
Normal file
@ -0,0 +1,67 @@
|
||||
APP_NAME = Gitea: Git with a cup of tea
|
||||
RUN_USER = gitea
|
||||
RUN_MODE = prod
|
||||
|
||||
[oauth2]
|
||||
JWT_SECRET = QywECk5l8_8GDE7wMZpAJHOAO74eIpg1ny_-zm3AKSY
|
||||
|
||||
[security]
|
||||
INTERNAL_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE1NTc4ODAwNjJ9.k3PPY_Dh0s04j8aQOx7R8N56bqLEGmBKOF3SnsHTtBw
|
||||
INSTALL_LOCK = true
|
||||
SECRET_KEY = x95ZGsKkk3PEQxsyGiIERM1DRX4vMosnTVqOwULjbpK70X4pSQ7keBMU1QPr5ExH
|
||||
|
||||
[database]
|
||||
DB_TYPE = postgres
|
||||
HOST = 127.0.0.1:5432
|
||||
NAME = gitea
|
||||
USER = gitea
|
||||
PASSWD = UserP4ssword
|
||||
SSL_MODE = disable
|
||||
PATH = /opt/theta42/data/gitea.db
|
||||
|
||||
[repository]
|
||||
ROOT = /root/gitea-repositories
|
||||
|
||||
[server]
|
||||
SSH_DOMAIN = localhost
|
||||
DOMAIN = localhost
|
||||
HTTP_PORT = 3000
|
||||
ROOT_URL = http://localhost:3000/
|
||||
DISABLE_SSH = false
|
||||
SSH_PORT = 22
|
||||
LFS_START_SERVER = true
|
||||
LFS_CONTENT_PATH = /opt/theta42/gitea/data/lfs
|
||||
LFS_JWT_SECRET = tvg4SFUSNduclix3Lye9_UD1IYaX46lUDUpenQovSbY
|
||||
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 = /opt/theta42/gitea/log
|
||||
|
5281
cookbooks/hosting/templates/gitea_postgres.sql.erb
Normal file
5281
cookbooks/hosting/templates/gitea_postgres.sql.erb
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user