Convert step-by-step sections to the steps component
This commit is contained in:
@@ -20,7 +20,8 @@ Docker, to install deployable services in seconds and manage them with just a fe
|
||||

|
||||
|
||||
## Install Docker
|
||||
Add the Docker repositories and GPG key:
|
||||
::steps{level="3"}
|
||||
### Add the Docker repository and GPG key
|
||||
|
||||
```bash [Terminal]
|
||||
# Add Docker's official GPG key:
|
||||
@@ -35,22 +36,23 @@ echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docke
|
||||
sudo apt-get update
|
||||
```
|
||||
|
||||
Install the packages:
|
||||
### Install the packages
|
||||
|
||||
```bash [Terminal]
|
||||
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
||||
```
|
||||
|
||||
That's it!
|
||||
### Done !
|
||||
::
|
||||
|
||||
**More options:** [Install Docker for Debian 13](https://docs.docker.com/engine/install/debian/)
|
||||
|
||||
::note
|
||||
|
||||
From here on, we assume the stacks are installed in the `/docker` folder, created using the command:
|
||||
```bash [Terminal]
|
||||
sudo mkdir /docker
|
||||
```
|
||||
```bash [Terminal]
|
||||
sudo mkdir /docker
|
||||
```
|
||||
::
|
||||
|
||||
## Install [Dockge](https://github.com/louislam/dockge) to manage and deploy containers
|
||||
@@ -69,14 +71,15 @@ root
|
||||
└── compose.yml
|
||||
```
|
||||
|
||||
Create the stack folder:
|
||||
::steps{level="4"}
|
||||
#### Create the stack folder
|
||||
|
||||
```bash [Terminal]
|
||||
cd /docker
|
||||
sudo mkdir dockge
|
||||
```
|
||||
|
||||
Then create the `compose.yml` file in this folder using `nano`:
|
||||
#### Create the compose file
|
||||
|
||||
```bash [Terminal]
|
||||
cd /docker/dockge
|
||||
@@ -107,7 +110,7 @@ services:
|
||||
|
||||
Press :kbd{value="Ctrl+O"}, then :kbd{value="Enter"} to save, and :kbd{value="Ctrl+X"} to exit.
|
||||
|
||||
To launch the container:
|
||||
#### Launch the container
|
||||
|
||||
```bash [Terminal]
|
||||
cd /docker/dockge
|
||||
@@ -118,6 +121,9 @@ Then go to `http://yourserverip:3555` in your browser to access the login page.
|
||||
|
||||
More info on [Dockge and how to use it](https://github.com/louislam/dockge)
|
||||
|
||||
#### Done !
|
||||
::
|
||||
|
||||
And there you go! Docker and a tool to easily manage your containers are ready!
|
||||
|
||||
## [Watchtower](https://watchtower.nickfedor.com/), to auto-update containers
|
||||
@@ -125,6 +131,9 @@ Watchtower is a container that checks for updates and pulls new images automatic
|
||||
|
||||
### Configuration
|
||||
|
||||
::steps{level="4"}
|
||||
#### Create the stack
|
||||
|
||||
- Open Dockge in your browser
|
||||
- Click `compose`
|
||||
- Name the stack `watchtower`
|
||||
@@ -156,7 +165,9 @@ services:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
```
|
||||
|
||||
Then fill in the `.env` section in Dockge with the following:
|
||||
#### Set your environment variables
|
||||
|
||||
Fill in the `.env` section in Dockge with the following:
|
||||
|
||||
```properties [.env]
|
||||
SCHEDULE=
|
||||
@@ -168,12 +179,18 @@ WH_URL=
|
||||
| `SCHEDULE` | Cron format | `0 0 6 * * *` (every day at 6 AM) |
|
||||
| `WH_URL` | Your Discord webhook URL - append `/slack` at the end | `https://yourdiscordserver/webhook/slack` |
|
||||
|
||||
#### Enable Watchtower on other containers
|
||||
|
||||
To have Watchtower monitor your other containers, add this to their `compose.yml`:
|
||||
|
||||
```yaml [compose.yaml]
|
||||
labels:
|
||||
|
||||
- com.centurylinklabs.watchtower.enable=true
|
||||
```
|
||||
|
||||
Then restart the modified stacks. And that's it! You now have a solid base to start deploying the services you want!
|
||||
Then restart the modified stacks.
|
||||
|
||||
#### Done !
|
||||
::
|
||||
|
||||
And that's it! You now have a solid base to start deploying the services you want!
|
||||
|
||||
@@ -5,17 +5,6 @@ description: Set up SWAG as a reverse proxy with automatic SSL, expose your serv
|
||||
|
||||
|
||||
:ellipsis{left=0px width=40rem top=10rem blur=140px zIndex=60}
|
||||
# SWAG
|
||||
|
||||
::note
|
||||
🎯 __Objectives:__
|
||||
|
||||
- Install Swag
|
||||
- Enable SSL
|
||||
- Access the dashboard
|
||||
- Configure regional blocking
|
||||
- Expose Dockge
|
||||
::
|
||||
|
||||
[Swag](https://docs.linuxserver.io/general/swag/) is the core of this homelab. It’s a powerful reverse proxy that allows you to expose services on the internet using domain names, handling SSL certificate issuance (for encrypted connections), request routing, and access security (via HTTP auth or SSO like Authelia or Authentik). All the necessary documentation is [available here](https://docs.linuxserver.io/general/swag).
|
||||
|
||||
@@ -55,6 +44,9 @@ root
|
||||
└── .env
|
||||
```
|
||||
|
||||
::steps{level="3"}
|
||||
### Deploy the stack
|
||||
|
||||
Open Dockge in your browser, click on `compose`, name the stack `swag`, and copy the following config:
|
||||
|
||||
```yaml [compose.yaml]
|
||||
@@ -111,6 +103,8 @@ services:
|
||||
```
|
||||
::
|
||||
|
||||
### Set your environment variables
|
||||
|
||||
Then in the `.env` file:
|
||||
|
||||
```properties [.env]
|
||||
@@ -129,7 +123,9 @@ Fill out the variables as follows:
|
||||
| `EMAIL` | Your email for generating the certificate | `your@email.com` |
|
||||
| `PLUGIN` | Plugin for certificate generation, depends on your [DNS provider](https://docs.linuxserver.io/general/swag/) | `ovh`<br>`cloudflare` |
|
||||
|
||||
Assuming your DNS zone is managed by OVH, deploy the stack once. The logs will show a failure in creating the SSL certificate due to a missing `ovh.ini` configuration. Stop the stack.
|
||||
### Configure the OVH DNS plugin
|
||||
|
||||
Assuming your DNS zone is managed by OVH (if not, please check for your [provider](https://github.com/linuxserver/docker-swag/tree/master/root/defaults/dns-conf)), deploy the stack once. The logs will show a failure in creating the SSL certificate due to a missing `ovh.ini` configuration. Stop the stack.
|
||||
|
||||
In CLI, go to the dns-conf folder and edit the `ovh.ini` file:
|
||||
|
||||
@@ -166,6 +162,8 @@ Note the 3 keys temporarily and enter them in `ovh.ini`. (In nano, just start ty
|
||||
|
||||
Save with :kbd{value="Ctrl+O"}, then :kbd{value="Enter"}, and exit with :kbd{value="Ctrl+X"}.
|
||||
|
||||
### Enable DBIP in nginx.conf
|
||||
|
||||
Now configure swag to access DBIP, the geolocation-based access control module. Open the `nginx.conf` file:
|
||||
|
||||
```bash [Terminal]
|
||||
@@ -180,6 +178,9 @@ include /config/nginx/dbip.conf;
|
||||
|
||||
Restart the stack in Dockge. This time, the SSL certificate should be successfully generated! Check the logs to confirm the server is ready.
|
||||
|
||||
### Done !
|
||||
::
|
||||
|
||||
## Dashboard
|
||||
Access the dashboard locally by going to `http://yourserverip:81`
|
||||
On the left, you'll see a list of currently "proxied" services (none yet). On the right, the list of banned IPs. Below, various indicators. For more details, [click here](https://www.linuxserver.io/blog/introducing-swag-dashboard).
|
||||
@@ -193,13 +194,16 @@ In this example, we’ll configure it to block a list of countries known to be t
|
||||
|
||||
This configuration can be enabled or disabled per service (see the Dockge example below).
|
||||
|
||||
Open `dbip.conf`:
|
||||
::steps{level="3"}
|
||||
### Open dbip.conf
|
||||
|
||||
```bash [Terminal]
|
||||
sudo nano /docker/swag/config/nginx/dbip.conf
|
||||
```
|
||||
|
||||
Make your changes ([see documentation](https://github.com/linuxserver/docker-mods/tree/swag-dbip)), or use the following example:
|
||||
### Make your changes
|
||||
|
||||
Refer to the [documentation](https://github.com/linuxserver/docker-mods/tree/swag-dbip), or use the following example:
|
||||
|
||||
```nginx [dbip.conf]
|
||||
geoip2 /config/geoip2db/dbip-country-lite.mmdb {
|
||||
@@ -245,7 +249,12 @@ geo $lan-ip {
|
||||
}
|
||||
```
|
||||
|
||||
Save and close the file. Restart the stack.
|
||||
### Save and restart
|
||||
|
||||
Save and close the file, then restart the stack.
|
||||
|
||||
### Done !
|
||||
::
|
||||
|
||||
In the domain config files (see next section), you can enable or disable the whitelist or blacklist ([see documentation here](https://www.forum-nas.fr/threads/tuto-installer-swag-en-docker-reverse-proxy.15057/)). In our case, the whitelist allows only French requests. The blacklist blocks only the listed countries. We'll use the blacklist, like so:
|
||||
|
||||
@@ -274,8 +283,8 @@ server {
|
||||
}
|
||||
```
|
||||
|
||||
## Exposing Dockge
|
||||
::note
|
||||
## (Optional) Exposing Dockge
|
||||
::note{icon=""}
|
||||
📋 __Prerequisite:__ <br/><br/>
|
||||
We assume that you have created a subdomain like `dockge.mydomain.com` in your [DNS zone](/general/networking/dns), with a `CNAME` pointing to `mydomain.com`. Unless you're using [Cloudflare Zero Trust](/serveex/security/cloudflare), we also assume you've forwarded port `443` from your router to the server's `443` in [your NAT rules](/general/networking/nat).
|
||||
::
|
||||
@@ -284,9 +293,12 @@ Now it's time to expose Dockge on the internet so you can access and manage your
|
||||
|
||||
::warning
|
||||
|
||||
Dockge does not support multi-factor authentication. Exposing it online could compromise all connected machines. Only do this if you're using an MFA solution like [Authentik](/serveex/advanced/authentik/). Otherwise, don’t expose it with SWAG. Use a VPN like [Wireguard](/serveex/security/wireguard) instead.
|
||||
Dockge does not support multi-factor authentication. Exposing it online could compromise all connected machines. Only do this if you're using an MFA solution like [TinyAuth](/serveex/security/tinyauth) or [Authentik](/serveex/advanced/authentik/). Otherwise, don’t expose it with SWAG. Use a VPN like [Wireguard](/serveex/security/wireguard) instead.
|
||||
::
|
||||
|
||||
::steps{level="3"}
|
||||
### Create the subdomain.conf file
|
||||
|
||||
Open the `dockge.subdomain.conf` file:
|
||||
|
||||
```bash [Terminal]
|
||||
@@ -342,6 +354,8 @@ Save and exit. The configuration will update within a few seconds.
|
||||
By default, SWAG doesn’t recognize the name "dockge". You’ll need to add Dockge’s network to SWAG’s `compose.yml`.
|
||||
::
|
||||
|
||||
### Add Dockge's network to SWAG
|
||||
|
||||
Go to the SWAG stack, click `edit`, and modify the config file like this (note the `networks` section):
|
||||
|
||||
```yaml [compose.yaml]
|
||||
@@ -367,8 +381,13 @@ We assume the Dockge network is named `dockge_default`. You can verify the setup
|
||||
|
||||
Redeploy the SWAG stack.
|
||||
|
||||
### Visit your new subdomain
|
||||
|
||||
Wait a moment, then visit `https://dockge.mydomain.com` in your browser. You should be redirected to Dockge. You can also check the service status from the dashboard (`http://yourserverip:81` on your local network).
|
||||
|
||||
### Done !
|
||||
::
|
||||
|
||||
## Exposing Another Service with SWAG
|
||||
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:
|
||||
|
||||
@@ -379,7 +398,7 @@ sudo cp servicename.subdomain.conf.sample servicename.subdomain.conf
|
||||
|
||||
::caution
|
||||
|
||||
- __If the subdomain is not redirected properly__
|
||||
__If the subdomain is not redirected properly__
|
||||
- Open the file and verify the container name in `set $upstream_app containername;`{lang=nginx}
|
||||
- Make sure you added the container's network in SWAG’s `compose.yml`
|
||||
::
|
||||
|
||||
Reference in New Issue
Block a user