Skip to content

Commit 1e3e12e

Browse files
authored
Merge pull request #69 from julianpoy/v4.0.0
feat: v4.0.0
2 parents 1713b80 + 1a444c7 commit 1e3e12e

13 files changed

+149
-41
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
docker-compose.override.yml
2+
.DS_Store

README.md

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,28 @@ Warning: There are portions of the software that may not work. I don't warranty
1818

1919
## Setup
2020

21+
For Synology boxes, see [this setup guide instead](./SETUP-SYNOLOGY.md).
22+
2123
1. You'll need Docker to run [RecipeSage](https://recipesage.com) locally. Although you _can_ attempt to run it without Docker, you're on your own.
2224
2. Start all containers with `docker compose up -d`
23-
3. On first run, and when updating, you'll need to run database migrations with `./migrate.sh`
24-
4. The app should be available at port 80. You can change that by changing [this](https://github.com/julianpoy/RecipeSage-selfhost/blob/a1133c51af24ca78f9bc9537e147411b5e7e311a/docker-compose.yml#L8) to something else, such as `3000:80` for port 3000.
25+
3. The app should be available at port 7270. You can change that by changing [this](https://github.com/julianpoy/RecipeSage-selfhost/blob/a1133c51af24ca78f9bc9537e147411b5e7e311a/docker-compose.yml#L8) to something else, such as `3000:80` for port 3000.
2526

26-
### Updating
27+
You'll very likely want to put RecipeSage behind a reverse proxy for SSL termination (and so that you can run more than just RecipeSage!). That's not covered by this README, but I encourage you look at [Caddy](https://caddyserver.com/docs/install) or [Nginx Proxy Manager](https://nginxproxymanager.com/guide) if you are unfamiliar with reverse proxies. A reverse proxy isn't strictly necessary to use RecipeSage self-hosted, however.
2728

28-
First, take a look at the changelog below for any special upgrade notes. Then follow the steps below.
29+
### Updating
2930

30-
As with any migration/upgrade, I recommend taking a backup of your volumes before migrating to avoid any potential data loss.
31+
By default, the database will be automatically migrated when updating to a new container version. As with any migration/upgrade, I **strongly recommend taking a backup** of your volumes before migrating to avoid any potential data loss. My first recommendation when encountering issues after an update will be to rollback, which will be impossible if you don't have a backup.
3132

32-
Update your local copy of this repo with the latest from this repository. If cloned with Git, this is as simple as `git pull`.
33+
1. [_Take a look at the changelog below for any special upgrade notes_](#changelog). Then follow the steps below.
3334

34-
Update your local images: `docker compose pull`.
35+
2. Update your local copy of this repo with the latest from this repository. If cloned with Git, this is as simple as `git pull`.
3536

36-
Then, down & up the containers: `docker compose down --remove-orphans && docker compose up -d`
37+
3. Update your local images: `docker compose pull`.
3738

38-
Finally, run any pending migrations with `./migrate.sh`
39+
4. Down & up the containers: `docker compose down --remove-orphans && docker compose up -d`
3940

4041
<br />
4142

42-
4343
## Customization
4444

4545
The following sections provide some information on customizing your instance. Following the "setup" section is enough to get you running with a RecipeSage instance like that of the official site.
@@ -68,11 +68,11 @@ It's fairly common that older CPUs (often shipped in prebuilt NASes) do not supp
6868

6969
> Illegal Instruction (core dumped)
7070
71-
Since the ingredient-instruction-classifier container is not _required_ by RecipeSage, it can be removed/disabled from the docker-compose file if you don't have AVX instruction set support. Without the ingredient-instruction-classifier container, the automatic recipe import feature will still work on the majority of sites, but will be unable to pull content from sites that are particularly poorly formatted, or that have no metadata at all.
71+
Since the ingredient-instruction-classifier container is not _required_ by RecipeSage, **it can be removed/disabled** from the docker-compose file if you don't have AVX instruction set support. Without the ingredient-instruction-classifier container, the automatic recipe import feature will still work on the majority of sites, but will be unable to pull content from sites that are particularly poorly formatted, or that have no metadata at all.
7272

7373
#### I'm seeing an "unexpected error occurred" error when trying to register
7474

75-
This is most frequently because the migration script has not been run successfully. Note that if you change the name of the containers in the docker-compose file, the migration script will not be able to run the required migration script within the container, and you must do so by exec-ing into the container yourself, similar to what the script does.
75+
This is most frequently because the migration script has not been run successfully. Please include logs from the API container when posting any issue related to this.
7676

7777
#### Container Structure
7878

@@ -90,12 +90,22 @@ The `pushpin` container is a broker for all websocket connections. Without it, a
9090

9191
The `postgres` container is the database. The application cannot run without it.
9292

93-
The `browserless` container is a virtual web browser that is used to scrape recipe data when you paste a URL into the "autofill" feature of the app. Without it, the recipe scraper _should still work_, but will fall back to JSDOM which will be significantly less accurate and may contain formatting errors.
93+
The `browserless` container is a virtual web browser that is used to scrape recipe data when you paste a URL into the "autofill" feature of the app. Without it the recipe scraper _should still work_, but will fall back to JSDOM which will be significantly less accurate and may contain formatting errors.
9494

95-
The `ingredient-instruction-classifier` container facilitates machine learning classification of ingredients and instructions, which is used to improve accuracy during the "autofill" feature. Without it, the recipe _should still work_, but will be a bit less accurate or may not be able to pull ingredients or instructions from poorly formatted webpages.
95+
The `ingredient-instruction-classifier` container facilitates machine learning classification of ingredients and instructions, which is used to improve accuracy during the "autofill" feature. Without it the recipe scraper _will still work_, but will lose the ability to pull ingredients or instructions from webpates with no JSON-LD headers and no formatting.
9696

9797
## Changelog
9898

99+
### v4.0.0
100+
101+
Migrations are now automated, and use a different migration tool.
102+
103+
If you have an older version of this repository, you _must_ upgrade to this version of the repository and do the following before upgrading to newer versions so that migrations all line up:
104+
105+
1. Update your local copy of the repository to v4.0.0
106+
2. Run `docker compose exec api tsx packages/backend/src/migrate`
107+
3. If the command prior ran successfully, run `docker compose exec api npx prisma migrate resolve --applied 0_init`
108+
99109
### v3.1.0
100110

101111
`docker-compose` has been officially deprecated, so the app has migrated to using `docker compose`.

SETUP-SYNOLOGY.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Synology Setup Guide
2+
3+
These steps are specific to setting up RecipeSage on a Synology box. Please follow the normal setup instructions for non-Synology based installs.
4+
5+
## Prerequisites
6+
7+
- Version 7.2 of DSM running on your Synology NAS.
8+
- The package `Container Manager` installed via the `Package Center` application on your Synology NAS.
9+
10+
## Step 1
11+
12+
Copy the RecipeSage docker-compose.yml file [from here](https://raw.githubusercontent.com/julianpoy/RecipeSage-selfhost/main/docker-compose.yml).
13+
14+
## Step 2
15+
16+
Open your Synology WebUI, and navigate to the `Container Manager` application via the applications menu.
17+
18+
<img src="./src/img/synology-container-manager.png" />
19+
20+
## Step 3
21+
22+
Switch to the project tab in the left sidebar of the `Container Manager`.
23+
24+
Create a project either using the "create" button, and enter the corresponding details (as shown below) into the create project dialogue.
25+
26+
<img src="./src/img/synology-container-manager.png" />
27+
28+
**Note** that you'll paste in the docker-compose.yml file that you copied above into this dialogue.
29+
30+
Click next.
31+
32+
## Step 4
33+
34+
On the next page, you'll be presented with a dialogue asking if you want to provide web services to the created containers. You'll want to enable HTTP on port 7270 to the proxy container as shown below.
35+
36+
<img src="./src/img/synology-new-project-web-portal-settings.png" />
37+
38+
Click next.
39+
40+
## Step 5
41+
42+
On the next page, you'll be shown a summary of what you've configured. It should match the image below.
43+
44+
<img src="./src/img/synology-new-project-summary.png" />
45+
46+
If all looks correct, you can click done.
47+
48+
## Step 6
49+
50+
At this point you may see a few modals pop up. One should be showing you the download & extracting progress for all of the RecipeSage containers. You'll also see a prompt like below regarding the web service configuration.
51+
52+
<img src="./src/img/synology-new-project-web-service-setup.png" />
53+
54+
Leave all of the settings default, but fill in the hostname field with the domain name you'd like to use for RecipeSage if you have one, such as (recipesage.yourdomain.com). If not, and you're just planning to use RecipeSage within your local network, just enter `recipesage` into this field and click the create button.
55+
56+
## Step 7
57+
58+
Once the download & extracting progress window has completed, you should see text in that window similar to the following.
59+
60+
<img src="./src/img/synology-new-project-done.png" />
61+
62+
You can press the done button.
63+
64+
## Step 8
65+
66+
Navigate to http://YOUR_SYNOLOGY_IP_ADDRESS:7270 in your web browser, and you should see the RecipeSage interface!
67+
68+
## Further Steps
69+
70+
These steps are very well documented across the internet, and I recommend Googling for help here if you are unfamiliar with these concepts. Please do not open issues related to the following steps.
71+
72+
If you entered a domain name for RecipeSage in step 6, you'll want to:
73+
74+
- Follow [Synology's guide for getting an HTTPS certificate](https://kb.synology.com/en-my/DSM/tutorial/How_to_enable_HTTPS_and_create_a_certificate_signing_request_on_your_Synology_NAS) if you don't have a certificate for this domain name already configured. You can manage certificates and their assignments within `Control Panel -> Security -> Certificate`.
75+
- Port forward port 80 & 443 via your router to your Synology box. (Google the model of your router for instructions for how to do this)
76+
- Follow [Synology's guide for setting up DDNS for your domain](https://kb.synology.com/en-us/DSM/help/DSM/AdminCenter/connection_ddns?version=7)
77+
78+
If you've followed all of the steps above, you should be able to access RecipeSage via the domain you configured.
79+
80+
## Updating
81+
82+
First, check any notes regarding the new version you'll be updating to [here](https://github.com/julianpoy/recipesage-selfhost#changelog) since there may be additional steps required.
83+
84+
To update your copy of RecipeSage on your Synology NAS, first stop RecipeSage via the `Container Manager -> Project` interface.
85+
86+
After all of the associated RecipeSage containers stop, navigate to the `YAML Configurations` tab within the RecipeSage project you set up.
87+
88+
Copy the latest docker-compose.yaml from here [from here](https://raw.githubusercontent.com/julianpoy/RecipeSage-selfhost/main/docker-compose.yml), and replace the content of the `YAML Configurations` window with the content of the new docker-compose.yml file.
89+
90+
Click Save and select `Build and start the project (rebuild the image)`.
91+
92+
RecipeSage should be updated. Again, please perform any additional steps described [here](https://github.com/julianpoy/recipesage-selfhost#changelog) if required.
93+

docker-compose.yml

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
1-
version: '3.7'
1+
# This config file is for RecipeSage-selfhost version 4.0.0, and RecipeSage version 2.13.1.
2+
3+
version: '3.7' # (this is the docker compose version, not RecipeSage version)
24
services:
35
proxy: # The proxy must not be removed. If needed, point your own proxy to this container, rather than removing this
46
container_name: recipesage_proxy
5-
image: nginx
6-
volumes:
7-
- ./proxy.conf:/etc/nginx/conf.d/default.conf
7+
image: julianpoy/recipesage-selfhost-proxy:v4.0.0
88
ports:
9-
- 80:80
9+
- 7270:80
1010
depends_on:
1111
- static
1212
- api
1313
- pushpin
1414
restart: unless-stopped
1515
static: # Hosts frontend assets
1616
container_name: recipesage_static
17-
image: julianpoy/recipesage-selfhost:static-v2.12.10
17+
image: julianpoy/recipesage-selfhost:static-v2.13.1
1818
restart: unless-stopped
1919
api: # Hosts backend API
2020
container_name: recipesage_api
21-
image: julianpoy/recipesage-selfhost:api-v2.12.10
21+
image: julianpoy/recipesage-selfhost:api-v2.13.1
2222
depends_on:
2323
- postgres
2424
- typesense
2525
- pushpin
2626
- browserless
27-
command: npx ts-node --swc --project packages/backend/tsconfig.json packages/backend/src/bin/www
27+
# Swap commands if you want to disable automatic migrations on startup
28+
command: sh -c "npx prisma migrate deploy && npx ts-node --swc --project packages/backend/tsconfig.json packages/backend/src/bin/www"
29+
# command: npx ts-node --swc --project packages/backend/tsconfig.json packages/backend/src/bin/www
2830
environment:
2931
- STORAGE_TYPE=filesystem
3032
- FILESYSTEM_STORAGE_PATH=/rs-media
@@ -54,11 +56,11 @@ services:
5456
volumes:
5557
- apimedia:/rs-media
5658
restart: unless-stopped
57-
typesense:
59+
typesense: # Provides the fuzzy search engine
5860
container_name: recipesage_typesense
5961
image: typesense/typesense:0.24.1
6062
volumes:
61-
- typesensedata:/data
63+
typesensedata:/data
6264
command: "--data-dir /data --api-key=recipesage_selfhost --enable-cors"
6365
restart: unless-stopped
6466
pushpin: # Provides websocket support
@@ -81,22 +83,26 @@ services:
8183
- POSTGRES_USER=recipesage_selfhost
8284
- POSTGRES_PASSWORD=recipesage_selfhost
8385
volumes:
84-
- postgresdata:/var/lib/postgresql/data
86+
postgresdata:/var/lib/postgresql/data
8587
restart: unless-stopped
8688
browserless: # A headless browser for scraping websites with the auto import tool
8789
container_name: recipesage_browserless
88-
image: browserless/chrome:1.57-puppeteer-19.2.2
90+
image: browserless/chrome:1.61.0-puppeteer-21.4.1
8991
environment:
9092
- MAX_CONCURRENT_SESSIONS=3
9193
- MAX_QUEUE_LENGTH=10
9294
restart: unless-stopped
93-
ingredient-instruction-classifier: # A mini server that runs a machine learning model able to classify text for improved automatic import
94-
container_name: recipesage_classifier
95-
image: julianpoy/ingredient-instruction-classifier:1.4.9
96-
environment:
97-
- SENTENCE_EMBEDDING_BATCH_SIZE=200
98-
- PREDICTION_CONCURRENCY=4
99-
restart: unless-stopped
95+
96+
# Uncomment the lines below to enable the ingredient instruction classifier. It's somewhat resource intensive and requires AVX instruction support on your CPU, but does improve site compatibility for the automatic import tool.
97+
98+
# ingredient-instruction-classifier: # A mini server that runs a machine learning model able to classify text for improved automatic import site support. Not required for application to run, and will crash if your CPU does not support AVX instructions
99+
# container_name: recipesage_classifier
100+
# image: julianpoy/ingredient-instruction-classifier:1.4.11
101+
# environment:
102+
# - SENTENCE_EMBEDDING_BATCH_SIZE=200
103+
# - PREDICTION_CONCURRENCY=2
104+
# restart: unless-stopped
105+
100106
volumes:
101107
apimedia:
102108
driver: local

migrate.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.
431 KB
Loading
699 KB
Loading
411 KB
Loading
409 KB
Loading
518 KB
Loading

0 commit comments

Comments
 (0)