base gitea

This commit is contained in:
2019-05-14 22:03:34 -04:00
parent 87f1cc3c24
commit 945c5a5b48
8 changed files with 5473 additions and 42 deletions

View 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

View File

@ -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

View File

@ -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

View File

@ -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