update setup instructions

This commit is contained in:
Matthew Tran 2024-09-16 22:19:00 +00:00
parent 2107249f47
commit 7f7367c74d
4 changed files with 71 additions and 62 deletions

View File

@ -1,6 +1,6 @@
# matthewtran.com # matthewtran.com
Stuff that's deployed on [matthewtran.com](http://matthewtran.com). Tested on Ubuntu Server 22.04.3 LTS. Currently running the following services. Stuff that's deployed on [matthewtran.com](https://matthewtran.com). Currently running the following services.
- website - website
- gitea ([git.matthewtran.com](https://git.matthewtran.com)) - gitea ([git.matthewtran.com](https://git.matthewtran.com))
@ -8,58 +8,56 @@ Stuff that's deployed on [matthewtran.com](http://matthewtran.com). Tested on Ub
- p2pool (`xmrig -o matthewtran.com:3333`) - p2pool (`xmrig -o matthewtran.com:3333`)
- minecraft - minecraft
- minecraft bedrock - minecraft bedrock
- terraria - ~~terraria~~
- wireguard - wireguard
## setup ## setup
Forward the following ports to the server. 1. Install [Ubuntu Server 24.04.1 LTS](https://ubuntu.com/download/server).
- Add OpenSSH Server and Docker during the process.
| service | port | - Expand the root partition if needed.
|-------------------|--------------------| - `lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv`
| website | 80, 443 | - `resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv`
| gitea | 2222 | - Give yourself Docker access if needed.
| monerod | 18080 | - `groupadd docker`
| p2pool | 3333, 37888, 37889 | - `usermod -aG docker $USER`
| minecraft | 25565 | - Enable UFW and allow the following.
| minecraft bedrock | 19132, 19133 | - `ufw enable`
| terraria | 7777 | - `ufw allow OpenSSH`
| wireguard | 51820 | - `ufw allow 51820/udp`
2. Forward the following ports. Set a static IP if needed.
Make sure IPv6 is enabled in Docker by modifying `/etc/docker/daemon.json`. For example: - website - `80`, `443`
- gitea - `2222`
``` - monerod - `18080`
{ - p2pool - `3333`, `37888`, `37889`
"ipv6": true, - minecraft - `25565`
"fixed-cidr-v6": "2001:db8:1::/64", - minecraft bedrock - `19132`, `19133`
"experimental": true, - terraria - `7777`
"ip6tables": true - wireguard - `51820`
} 3. Install dependencies and clone.
``` - `apt install avahi-daemon git python3 python-is-python3 qrencode wireguard zip`
- `git clone https://github.com/dragonlock2/matthewtran.com`
Run the following commands. For the IP update script, add a SendGrid API key to `website/sendgrid.key`. - `cd matthewtran.com`
4. Set up WireGuard.
``` - `systemctl enable wg-quick@wg0.service`
docker compose build - `python wireguard/setup.py`
docker compose up -d # auto restarts on reboot! - `systemctl start wg-quick@wg0.service`
``` 5. Enable IPv6 for Docker.
- Add the following to `/var/snap/docker/current/config/daemon.json`.
Note for first start you'll need to configure Gitea. - `"ipv6": true`
- `"fixed-cidr-v6": "fd3a:138e:8fd0:0000::/64"`
- `systemctl restart snap.docker.dockerd.service`
6. Set up the repo.
- Run `./volumes.sh`, allowing the containers to access the binded volumes since you have the same UID/GID by default.
- Create `website/sendgrid.key` with a [SendGrid API key](https://app.sendgrid.com/settings/api_keys).
- Create `terraria/password.txt` if needed.
- Restore backups if needed.
7. Build and start the services.
- `docker compose build`
- `docker compose up -d`
8. If first start, some services need configuring.
- Gitea
## backup ## backup
Run `./backup.sh` and save the resultant `data.zip` somewhere. I should probably automate this. Run `./backup.sh` and save the resultant `data.zip` somewhere. I should probably automate this.
## TODO
- better setup
- install ubuntu
- forward ports
- enable ssh
- install wireguard
- run script to setup wireguard
- install docker + compose
- run `volumes.sh` => container user has same uid/gid, can access
- run docker compose
- ufw?
- need to setup gitea

View File

@ -76,13 +76,13 @@ services:
- default6 - default6
volumes: volumes:
- ./minecraft_bedrock/worlds:/home/ubuntu/worlds - ./minecraft_bedrock/worlds:/home/ubuntu/worlds
terraria: # terraria:
restart: always # restart: always
build: terraria/. # build: terraria/.
entrypoint: ["/bin/sh", "/home/ubuntu/entry.sh"] # entrypoint: ["/bin/sh", "/home/ubuntu/entry.sh"]
ports: # ports:
- "7777:7777" # - "7777:7777"
networks: # networks:
- default6 # - default6
volumes: # volumes:
- ./terraria/worlds:/home/ubuntu/worlds # - ./terraria/worlds:/home/ubuntu/worlds

View File

@ -1,5 +1,16 @@
#!/bin/sh #!/bin/sh
# TODO graceful exit cleanup() {
echo "stop" > cmd
}
LD_LIBRARY_PATH=. ./bedrock_server trap 'cleanup' TERM
rm cmd
mkfifo cmd
LD_LIBRARY_PATH=. ./bedrock_server < cmd &
echo "help" > cmd # shell waits for FIFO to be opened for writing before starting program!
wait $! # wait for SIGTERM
wait $! # wait for server to stop
# TODO stop not working

View File

@ -1,8 +1,8 @@
#!/bin/sh #!/bin/sh
mkdir website/letsencrypt mkdir website/letsencrypt
mkdir website/gitea/config mkdir -p website/gitea/config
mkdir website/gitea/data mkdir -p website/gitea/data
mkdir monerod/.bitmonero mkdir monerod/.bitmonero
mkdir p2pool/cache mkdir p2pool/cache
mkdir minecraft/world mkdir minecraft/world