mirror of
https://github.com/iritmaximus/self-host.git
synced 2026-10-12 19:23:31 +03:00
Update README.md
This commit is contained in:
@@ -1,5 +1,99 @@
|
|||||||
# Problem
|
# Self-hosting setup
|
||||||
* failed to solve: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount1013749728/Dockerfile: no such file or directory
|
## Deployed apps
|
||||||
Trying to solve this :D
|
### 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)
|
||||||
|
|
||||||
Solved! Pumppistatus was missing a Dockerfile :DDD
|
### 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 :)
|
||||||
|
|||||||
Reference in New Issue
Block a user