base gitea

This commit is contained in:
William Mantly 2019-05-14 22:03:34 -04:00
parent 87f1cc3c24
commit 945c5a5b48
Signed by: wmantly
GPG Key ID: E1EEC7650BA97160
8 changed files with 5473 additions and 42 deletions

47
Vagrantfile vendored
View File

@ -12,53 +12,25 @@ Vagrant.configure("2") do |config|
# Every Vagrant development environment requires a box. You can search for
# boxes at https://vagrantcloud.com/search.
config.vm.box = "ubuntu/trusty64"
config.vm.box = "generic/ubuntu1604"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# NOTE: This will enable public access to the opened port
config.vm.network "forwarded_port", guest: 3000, host: 8080
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine and only allow access
# via 127.0.0.1 to disable public access
# config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
config.vm.network "forwarded_port", guest: 3000, host: 8030 # gitea server
config.vm.network "forwarded_port", guest: 80, host: 8080 # HTTP proxy to gitea
config.vm.network "forwarded_port", guest: 443, host: 8443 # HTTPS proxy to gitea
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
#
# # Customize the amount of memory on the VM:
# vb.memory = "1024"
# end
#
# View the documentation for the provider you are using for more
# information on available options.
config.vm.provider "virtualbox" do |vb|
# Customize the amount of memory on the VM:
vb.memory = "1024"
end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
@ -73,8 +45,5 @@ Vagrant.configure("2") do |config|
chef.cookbooks_path = "cookbooks/"
chef.roles_path = "roles"
chef.add_role("gitea")
# chef.add_recipe "hosting::user"
# chef.add_recipe "hosting::mkdir"
# chef.add_recipe "hosting::postgress"
end
end

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

View 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

File diff suppressed because it is too large Load Diff

View File

@ -5,4 +5,6 @@ run_list(
"recipe[hosting::user]",
"recipe[hosting::mkdir]",
"recipe[hosting::postgress]",
"recipe[hosting::gitea]",
)