Files
2025-01-10 21:55:25 +02:00

100 lines
2.4 KiB
Markdown

# Self-hosting setup
## Deployed apps
### Public hosting
* `pumppi.dev` rust test app
* `pumppi.dev` ssh
* `tsoha.pumppi.dev` timetrials
* `bort.pumppi.dev` closest bus-stop times
* `reaktor.pumppi.dev` backend for reaktor 2023 summer job application
* `cal.pumppi.dev` calendar
* minecraft server (currently not running)
### Ports on server
* `tsoha.pumppi.dev` 5000
* `reaktor.pumppi.dev` 5050
* radicale 5232
* Postgres-database: 5432
* `bort.pumppi.dev` 5500
* `brewery.pumppi.dev` 5555
* `pumppi.dev`: 8000
* `mine.pumppi.dev` 25565
### Local hosting
* Mysql
* Postgres
* Nginx
* ddclient
# Howto
## Connecting to router
```bash
ssh -L 8080:<ROUTER_IP>:<ROUTER_PORT> pumppi.dev
```
And voila, the router is accessible at http://localhost:8080.
## Add new subdomain
### Namecheap
First add new subdomain to `namecheap` with `A + Dynamic DNS Record`.
The IP can be anything, it will be overwritten by 'ddclient`.
### DDClient
Next ssh into the server and add the new subdomain to the
`ddclient`'s config located in the `/etc/ddclient/ddclient.conf`.
After editing the config, restart the service with
```bash
sudo systemctl restart ddclient.service
```
Check if the IP has updated in `namecheap` for the new domain.
If the IP has not changed, don't continue. FIX IT.
### Nginx
Edit or add a config file in `/etc/nginx/sites-available/<your-domain-name>`.
```cfg
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name <your_server_name>;
# ssl_certificate /etc/letsencrypt/live/<YOUR_DOMAIN_NAME>/fullchain.pem; # managed by Certbot
# ssl_certificate_key /etc/letsencrypt/live/<YOUR_DOMAIN_NAME>/privkey.pem; # managed by Certbot
# include /etc/letsencrypt/options-ssl-nginx.conf;
location / {
proxy_pass http://127.0.0.1:<PORT_OF_THE_APP>;
}
}
```
#### Note
Leave the ssl cert things commented for now. Before running `certbot` having
the lines uncommented will result in an error. The files do not exist yet!
After editing we can test if the new config is valid with
```bash
nginx -t
```
You might need sudo for this.
### Certbot
Next we move to getting the certifications. With `nginx` its dead
simple. Just run
```bash
sudo certbot certonly --nginx
```
and it should work. If there are errors, fix them.
And that should be it.
### After all
Make sure your process is running and it should be served to the
outside world.
Happy self hosting :)