Add a Linux tips section and move Docker stacks to /srv/docker
This commit is contained in:
@@ -14,8 +14,8 @@ The other reason is that it stays out of your way. Appliance systems like Unraid
|
||||
|
||||
## Installation
|
||||
|
||||
::note{icon="" to="https://www.iamtimsmith.com/blog/getting-started-with-the-linux-cli" target="_blank"}
|
||||
📋 __Prerequisite:__ everything past this point happens in a terminal, so you should be comfortable with the basics: moving around with `cd`, listing with `ls`, editing a file with `nano`, and reading what a command tells you when it fails. If any of that is new, **start with the Linux CLI** and come back.
|
||||
::note{icon="" to="/general/linux/cli-basics"}
|
||||
📋 __Prerequisite:__ everything past this point happens in a terminal, so you should be comfortable with the basics: moving around with `cd`, listing with `ls`, editing a file with `nano`, and reading what a command tells you when it fails. If any of that is new, **start with the command line basics** and come back.
|
||||
::
|
||||
|
||||
### BIOS setup
|
||||
@@ -342,13 +342,12 @@ Some essential apps you’ll likely need at some point, so might as well install
|
||||
```bash [Terminal]
|
||||
sudo apt update
|
||||
sudo apt upgrade
|
||||
sudo apt install nano btop ranger git duf neofetch samba cifs-utils tree unzip
|
||||
sudo apt install nano btop ranger git duf samba cifs-utils tree unzip
|
||||
```
|
||||
|
||||
Additionally:
|
||||
|
||||
- [gping](https://www.linode.com/docs/guides/how-to-use-gping-on-linux/) - Graphical ping tool
|
||||
- [lazydocker](https://github.com/jesseduffield/lazydocker) - CLI Docker container manager
|
||||
::note{to="/general/linux/handy-tools"}
|
||||
What each of these does, plus a few more worth adding like `ncdu` and `lazydocker`, is detailed in **handy CLI tools**.
|
||||
::
|
||||
|
||||
## Useful Features
|
||||
### Firewall
|
||||
|
||||
@@ -49,9 +49,9 @@ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin
|
||||
|
||||
::note
|
||||
|
||||
From here on, we assume the stacks are installed in the `/docker` folder, created using the command:
|
||||
From here on, we assume the stacks are installed in the `/srv/docker` folder, created using the command:
|
||||
```bash [Terminal]
|
||||
sudo mkdir /docker
|
||||
sudo mkdir /srv/docker
|
||||
```
|
||||
::
|
||||
|
||||
@@ -67,9 +67,10 @@ sudo mkdir /docker
|
||||
label: File structure we will create
|
||||
tree:
|
||||
/:
|
||||
- docker:
|
||||
- dockge:
|
||||
- compose.yml
|
||||
- srv:
|
||||
- docker:
|
||||
- dockge:
|
||||
- compose.yml
|
||||
---
|
||||
::
|
||||
|
||||
@@ -77,14 +78,14 @@ tree:
|
||||
#### Create the stack folder
|
||||
|
||||
```bash [Terminal]
|
||||
cd /docker
|
||||
cd /srv/docker
|
||||
sudo mkdir dockge
|
||||
```
|
||||
|
||||
#### Create the compose file
|
||||
|
||||
```bash [Terminal]
|
||||
cd /docker/dockge
|
||||
cd /srv/docker/dockge
|
||||
sudo nano compose.yml
|
||||
```
|
||||
Paste the following:
|
||||
@@ -101,10 +102,10 @@ services:
|
||||
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- /docker/dockge/data:/app/data
|
||||
- /docker:/docker
|
||||
- /srv/docker/dockge/data:/app/data
|
||||
- /srv/docker:/srv/docker
|
||||
environment:
|
||||
- DOCKGE_STACKS_DIR=/docker
|
||||
- DOCKGE_STACKS_DIR=/srv/docker
|
||||
```
|
||||
|
||||
Press :kbd{value="Ctrl+O"}, then :kbd{value="Enter"} to save, and :kbd{value="Ctrl+X"} to exit.
|
||||
@@ -112,7 +113,7 @@ Press :kbd{value="Ctrl+O"}, then :kbd{value="Enter"} to save, and :kbd{value="Ct
|
||||
#### Launch the container
|
||||
|
||||
```bash [Terminal]
|
||||
cd /docker/dockge
|
||||
cd /srv/docker/dockge
|
||||
sudo docker compose up -d
|
||||
```
|
||||
|
||||
|
||||
@@ -57,12 +57,13 @@ __Warning__: If your IP is not static, use a Dynamic DNS service ([DynDNS](https
|
||||
---
|
||||
tree:
|
||||
/:
|
||||
- docker:
|
||||
- wg-easy:
|
||||
- config:
|
||||
- etc_wireguard/
|
||||
- compose.yaml
|
||||
- .env
|
||||
- srv:
|
||||
- docker:
|
||||
- wg-easy:
|
||||
- config:
|
||||
- etc_wireguard/
|
||||
- compose.yaml
|
||||
- .env
|
||||
---
|
||||
::
|
||||
|
||||
@@ -191,11 +192,12 @@ We assume the client server runs Linux with Docker installed.
|
||||
---
|
||||
tree:
|
||||
/:
|
||||
- docker:
|
||||
- wireguard:
|
||||
- config:
|
||||
- wg_confs/
|
||||
- compose.yaml
|
||||
- srv:
|
||||
- docker:
|
||||
- wireguard:
|
||||
- config:
|
||||
- wg_confs/
|
||||
- compose.yaml
|
||||
---
|
||||
::
|
||||
|
||||
@@ -203,7 +205,7 @@ tree:
|
||||
### Create the folder
|
||||
|
||||
```bash [Terminal]
|
||||
sudo mkdir -p /docker/wireguard/config/wg_confs
|
||||
sudo mkdir -p /srv/docker/wireguard/config/wg_confs
|
||||
```
|
||||
|
||||
::tip{icon="" to="/serveex/files/file-browser-quantum"}
|
||||
@@ -213,7 +215,7 @@ sudo mkdir -p /docker/wireguard/config/wg_confs
|
||||
### Create the wg0.conf file
|
||||
|
||||
```bash [Terminal]
|
||||
sudo nano /docker/wireguard/config/wg_confs/wg0.conf
|
||||
sudo nano /srv/docker/wireguard/config/wg_confs/wg0.conf
|
||||
```
|
||||
|
||||
Paste the downloaded configuration, then save with :kbd{value="Ctrl+O"}, :kbd{value="Enter"}, and exit with :kbd{value="Ctrl+X"}.
|
||||
@@ -221,13 +223,13 @@ Paste the downloaded configuration, then save with :kbd{value="Ctrl+O"}, :kbd{va
|
||||
::tip{icon=""}
|
||||
✨ **Alternative method:** Transfer the file via SFTP and move it:
|
||||
```bash [Terminal]
|
||||
sudo cp ~/wg0.conf /docker/wireguard/config/wg_confs
|
||||
sudo cp ~/wg0.conf /srv/docker/wireguard/config/wg_confs
|
||||
```
|
||||
::
|
||||
|
||||
### Create the compose file
|
||||
|
||||
Create the `compose.yaml` file in `/docker/wireguard`:
|
||||
Create the `compose.yaml` file in `/srv/docker/wireguard`:
|
||||
|
||||
```yaml [compose.yaml]
|
||||
---
|
||||
@@ -242,7 +244,7 @@ services:
|
||||
environment:
|
||||
- TZ=Europe/Paris
|
||||
volumes:
|
||||
- /docker/wireguard/config:/config
|
||||
- /srv/docker/wireguard/config:/config
|
||||
- /lib/modules:/lib/modules
|
||||
restart: unless-stopped
|
||||
```
|
||||
@@ -250,7 +252,7 @@ services:
|
||||
### Start the container
|
||||
|
||||
```bash [Terminal]
|
||||
cd /docker/wireguard
|
||||
cd /srv/docker/wireguard
|
||||
sudo docker compose up -d
|
||||
```
|
||||
|
||||
|
||||
@@ -31,18 +31,19 @@ This tutorial assumes you have a domain name pointing to your server, and that y
|
||||
label: File structure to modify
|
||||
tree:
|
||||
/:
|
||||
- docker:
|
||||
- swag:
|
||||
- config:
|
||||
- dns-conf:
|
||||
- ovh.ini
|
||||
- nginx:
|
||||
- dbip.conf
|
||||
- nginx.conf
|
||||
- proxy-confs:
|
||||
- dockge.subdomain.conf
|
||||
- compose.yml
|
||||
- .env
|
||||
- srv:
|
||||
- docker:
|
||||
- swag:
|
||||
- config:
|
||||
- dns-conf:
|
||||
- ovh.ini
|
||||
- nginx:
|
||||
- dbip.conf
|
||||
- nginx.conf
|
||||
- proxy-confs:
|
||||
- dockge.subdomain.conf
|
||||
- compose.yml
|
||||
- .env
|
||||
---
|
||||
::
|
||||
|
||||
@@ -71,7 +72,7 @@ services:
|
||||
- EMAIL=${EMAIL}
|
||||
- DOCKER_MODS=linuxserver/mods:swag-dbip|linuxserver/mods:swag-dashboard|linuxserver/mods:swag-auto-reload
|
||||
volumes:
|
||||
- /docker/swag/config:/config
|
||||
- /srv/docker/swag/config:/config
|
||||
ports:
|
||||
- 80:80
|
||||
- 443:443
|
||||
@@ -131,7 +132,7 @@ You can use **File Browser Quantum** to browse and edit files instead of using t
|
||||
::
|
||||
|
||||
```bash [Terminal]
|
||||
sudo nano /docker/swag/config/dns-conf/ovh.ini
|
||||
sudo nano /srv/docker/swag/config/dns-conf/ovh.ini
|
||||
```
|
||||
|
||||
You should see:
|
||||
@@ -163,7 +164,7 @@ Save with :kbd{value="Ctrl+O"}, then :kbd{value="Enter"}, and exit with :kbd{val
|
||||
Now configure swag to access DBIP, the geolocation-based access control module. Open the `nginx.conf` file:
|
||||
|
||||
```bash [Terminal]
|
||||
sudo nano /docker/swag/config/nginx/nginx.conf
|
||||
sudo nano /srv/docker/swag/config/nginx/nginx.conf
|
||||
```
|
||||
|
||||
Add the following line below the `http` section:
|
||||
@@ -184,7 +185,7 @@ On the left, you'll see a list of currently "proxied" services (none yet). On th
|
||||

|
||||
|
||||
## DBIP
|
||||
DBIP allows you to block connections based on countries. It relies on the configuration file named `dbip.conf` located in `/docker/swag/config/nginx`. [More info here](https://virtualize.link/secure/).
|
||||
DBIP allows you to block connections based on countries. It relies on the configuration file named `dbip.conf` located in `/srv/docker/swag/config/nginx`. [More info here](https://virtualize.link/secure/).
|
||||
|
||||
In this example, we’ll configure it to block a list of countries known to be the source of most malicious traffic. We’ll also configure a variable to allow internal server traffic, your box’s local network, and a potential VPN in the 10.x.x.x range to access your services, but not the open internet.
|
||||
|
||||
@@ -194,7 +195,7 @@ This configuration can be enabled or disabled per service (see the Dockge exampl
|
||||
### Open dbip.conf
|
||||
|
||||
```bash [Terminal]
|
||||
sudo nano /docker/swag/config/nginx/dbip.conf
|
||||
sudo nano /srv/docker/swag/config/nginx/dbip.conf
|
||||
```
|
||||
|
||||
### Make your changes
|
||||
@@ -298,7 +299,7 @@ Dockge does not support multi-factor authentication. Exposing it online could co
|
||||
Open the `dockge.subdomain.conf` file:
|
||||
|
||||
```bash [Terminal]
|
||||
sudo nano /docker/swag/config/nginx/proxy-confs/dockge.subdomain.conf
|
||||
sudo nano /srv/docker/swag/config/nginx/proxy-confs/dockge.subdomain.conf
|
||||
```
|
||||
|
||||
Configure it like this:
|
||||
@@ -389,7 +390,7 @@ Wait a moment, then visit `https://dockge.mydomain.com` in your browser. You sho
|
||||
SWAG includes templates for most known services, named `servicename.subdomain.conf.sample`. Just create the subdomain in your registrar's DNS zone (like OVH), point it to your main domain via a CNAME, then copy and rename the sample file:
|
||||
|
||||
```bash [Terminal]
|
||||
cd /docker/swag/config/proxy-confs
|
||||
cd /srv/docker/swag/config/proxy-confs
|
||||
sudo cp servicename.subdomain.conf.sample servicename.subdomain.conf
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user