Automatically set up guweb, bancho.py, mysql and caddy using Docker.
Works locally and in production.
- Install docker and docker-compose
- Clone this repo recursively (to get the submodules)
IMPORTANT! If you don't use --recursive or download a zip from the web, you will be missing the submodules and it won't work.
git clone --recursive https://github.com/Komako-pw/bancho-guweb-stack
- Copy
config.example
toconfig
- Configure
- Place relevant certificates in
config/tls
- If you're using this on LAN, look at the custom CA section
- If you're using this on the open web, you may not need this at all
- Adjust
config/bancho.py.env
andconfig/guweb.py
configs to your needs- Make sure to set your domain
- Select the correct tls mode in
config/proxy.Caddyfile
- Set your domain in
config/proxy.env
- Setting a custom mysql password in
config/mysql.env
is not necessary
- Place relevant certificates in
- If on Linux (skip on Windows):
mkdir -p data/bancho-guweb data/mysql data/redis data/proxy sudo chown -R 1000:1000 ./data
- Start the stack
docker-compose up -d
You need a custom certificate authority (CA) to use HTTPS locally. Since Caddy is running in a container, it can't access your system's trusted CAs.
IMPORATNT! If you're running this on the open web, you can use
tls_auto
and skip this section.
- Download easyrsa
- Make a folder somewhere
- Generate a CA
It will ask for a Common Name (CN). Choose anything you want.
easyrsa init-pki
easyrsa build-ca nopass
- Give it to caddy
pki/ca.crt
toconfig/tls/custom_ca/ca.crt
pki/private/ca.key
toconfig/tls/custom_ca/ca.key
- Make your system trust it
IMPORTANT! Make sure you put it into
Trusted Root Certification Authorities
and not use automatic placement. - Use the
tls_custom_ca
mode inproxy.Caddyfile
To avoid typing docker-compose
every time, you can add an alias to your shell config.
~/.bashrc
(bash) or ~/.zshrc
(zsh)
alias dc="docker-compose"
# restart your terminal
fish:
alias dc="docker-compose"
funcsave dc
powershell (not permanent because idk how to do that):
Set-Alias -Name dc -Value docker-compose
You must add the following to your hosts file for local development:
- Linux
/etc/hosts
- Windows
C:\Windows\System32\drivers\etc\hosts
127.0.0.1 meow.nya a.meow.nya assets.meow.nya api.meow.nya osu.meow.nya b.meow.nya c.meow.nya c1.meow.nya c2.meow.nya c3.meow.nya c4.meow.nya c5.meow.nya c6.meow.nya ce.meow.nya
- Start/stop
dc up -d
dc down
- Show status
dc ps
- Restart
dc restart # all services
dc restart guweb
dc restart bancho
dc restart mysql
dc restart proxy
- Rebuild guweb or bancho (need to do this after updating the code)
dc build guweb
dc build bancho
dc up -d
- Update mysql, redis and caddy to the latest versions
dc pull
dc up -d
- See logs
dc logs -f # all services
dc logs -f guweb
dc logs -f bancho
dc logs -f mysql
dc logs -f proxy
- Open a shell (go inside the container)
dc exec mysql mysql -u root -p # use MYSQL_ROOT_PASSWORD password from ./config/mysql.env
dc exec bancho bash
dc exec guweb ash
- Clean old images to free up disk space
docker image prune -a
- Pull upstream (will cause merge conflicts)
cd guweb
git pull upstream main
cd bancho.py
git pull upstream master
- Reset data
dc down
rm -rf ./data