Skip to content

Commit

Permalink
add swag config example
Browse files Browse the repository at this point in the history
  • Loading branch information
tomtjes committed Jan 14, 2022
1 parent 79c8d26 commit 51620a3
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/install/docker.md
Expand Up @@ -138,6 +138,8 @@ In both cases, also make sure to mount `/media/` in your swag container to point

Please refer to the [appropriate documentation](https://github.com/linuxserver/docker-swag#usage) for the container setup.

For step-by-step instructions to set this up from scratch, see [this example](swag.md).

### Others

If you use none of the above mentioned reverse proxies or want to use an existing one on your host machine (like a local nginx or Caddy), simply use the [PLAIN](https://docs.tandoor.dev/install/docker/#plain) setup above and change the outbound port to one of your liking.
Expand Down
118 changes: 118 additions & 0 deletions docs/install/swag.md
@@ -0,0 +1,118 @@
!!! danger
Please refer to the [official documentation](https://github.com/linuxserver/docker-swag#usage) for the container setup. This example shows just one setup that may or may not differ from yours in significant ways. This tutorial does not cover security measures, backups, and many other things that you might want to consider.

## Prerequisites

- You have a newly spun-up Ubuntu server with docker (pre-)installed.
- At least one `mydomain.com` and one `mysubdomain.mydomain.com` are pointing to the server's IP. (This tutorial does not cover subfolder installation.)
- You have an ssh terminal session open.

## Installation

### Download and edit Tandoor configuration

```
cd /opt
mkdir recipes
cd recipes
wget https://raw.githubusercontent.com/vabene1111/recipes/develop/.env.template -O .env
base64 /dev/urandom | head -c50
```
Copy the response from that last command and paste the key into the `.env` file:
```
nano .env
```
You'll also need to enter a Postgres password into the `.env` file. Then, save the file and exit the editor.

### Install and configure Docker Compose

In keeping with [these instructions](https://docs.linuxserver.io/general/docker-compose):
```
cd /opt
curl -L --fail https://raw.githubusercontent.com/linuxserver/docker-docker-compose/master/run.sh -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
```

Next, create and edit the docker compose file.

```
nano docker-compose.yml
```

Paste the following and adjust your domains, subdomains and time zone.

```
---
version: "2.1"
services:
swag:
image: ghcr.io/linuxserver/swag
container_name: swag
cap_add:
- NET_ADMIN
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Berlin # <---- EDIT THIS <---- <----
- URL=mydomain.com # <---- EDIT THIS <---- <----
- SUBDOMAINS=mysubdomain,myothersubdomain # <---- EDIT THIS <---- <----
- EXTRA_DOMAINS=myotherdomain.com # <---- EDIT THIS <---- <----
- VALIDATION=http
volumes:
- ./swag:/config
- ./recipes/media:/media
ports:
- 443:443
- 80:80
restart: unless-stopped
db_recipes:
restart: always
container_name: db_recipes
image: postgres:11-alpine
volumes:
- ./recipes/db:/var/lib/postgresql/data
env_file:
- ./recipes/.env
recipes:
image: vabene1111/recipes
container_name: recipes
restart: unless-stopped
env_file:
- ./recipes/.env
environment:
- UID=1000
- GID=1000
- TZ=Europe/Berlin # <---- EDIT THIS <---- <----
volumes:
- ./recipes/static:/opt/recipes/staticfiles
- ./recipes/media:/opt/recipes/mediafiles
depends_on:
- db_recipes
```

Save and exit.

### Create containers and configure swag reverse proxy

```
docker-compose up -d
```

```
cd /opt/swag/nginx/proxy-confs
cp recipes.subdomain.conf.sample recipes.subdomain.conf
nano recipes.subdomain.conf
```

Change the line `server_name recipes.*;` to `server_name mysubdomain.*;`, save and exit.

### Finalize

```
cd /opt
docker restart swag recipes
```

Go to `https://mysubdomain.mydomain.com`. (If you get a "502 Bad Gateway" error, be patient. It might take a short while until it's functional.)

0 comments on commit 51620a3

Please sign in to comment.