Skip to content

Commit 4e582fb

Browse files
Podginatorkyo-youngwilliamtheakerrusstaylorDadams2
authored
Improving Self-Hosting and Removing 3rd Party dependencies. (#4513)
* fix: Library Header layout shift * Bump Github Actions versions. * Self-Hosting Changes * Fix Minio Environment Variable * Just make pdfs successful, due to lack of PDFHandler * Fix issue where flag was set wrong * Added an NGINX Example file * Add some documentation for self-hosting via Docker Compose * Make some adjustments to Puppeteer due to failing sites. * adjust timings * Add start of Mail Service * Fix Docker Files * More email service stuff * Add Guide to use Zapier for Email-Importing. * Ensure that if no env is provided it uses the old email settings * Add some instructions for self-hosted email * Add SNS Endpoints for Mail Watcher * Add steps and functionality for using SES and SNS for email * Uncomment a few jobs. * Added option for Firefox for parser. Was having issues with Chromium on Docker. * Add missing space. Co-authored-by: Russ Taylor <[email protected]> * Fix some wording on the Guide * update browser extension to handle self-hosted instances * add slight documentation to options page * Fix MV * Do raw handlers for Medium * Fix images in Medium * Update self-hosting/GUIDE.md Co-authored-by: Mike Baker <[email protected]> * Update Guide with other variables * Add The Verge to JS-less handlers * Update regex and image-proxy * Update self-hosting/nginx/nginx.conf Co-authored-by: Mike Baker <[email protected]> * Update regex and image-proxy * Update self-hosting/docker-compose/docker-compose.yml Co-authored-by: Mike Baker <[email protected]> * Fix Minio for Export * Merge to main * Update GUIDE with newer NGINX * Update nginx config to include api/save route * Enable Native PDF View for PDFS * Enable Native PDF View for PDFS * feat:lover packages test * feat:working build * feat:alpine build * docs:api dockerfile docs * Write a PDF.js wrapper to replace pspdfkit * Revert changes for replication, set settings to have default mode * build folder got removed due to gitignore on pdf * Add Box shadow to pdf pages * Add Toggle for Progress in PDFS, enabled native viewer toggle * Update node version to LTS * Update node version to LTS * Fix Linting issues * Fix Linting issues * Make env variable nullable * Add touchend listener for mobile * Make changes to PDF for mobile * fix(android): change serverUrl to selfhosted first * feat:2 stage alpine content fetch * feat:separated start script * fix:changed to node 22 * Add back youtube functionality and add guide * trigger build * Fix cache issue on YouTube * Allow empty AWS_S3_ENDPOINT * Allow empty AWS_S3_ENDPOINT * Add GCHR for all images * Add GCHR For self hosting. * Add GCHR For self hosting. * Test prebuilt. * Test prebuilt * Test prebuilt... * Fix web image * Remove Web Image (For now) * Move docker-compose to images * Move docker-compose files to correct locations * Remove the need for ARGS * Update packages, and Typescript versions * Fix * Fix issues with build on Web * Correct push * Fix Linting issues * Fix Trace import * Add missing types * Fix Tasks * Add information into guide about self-build * Fix issues with PDF Viewer --------- Co-authored-by: keumky2 <[email protected]> Co-authored-by: William Theaker <[email protected]> Co-authored-by: Russ Taylor <[email protected]> Co-authored-by: David Adams <[email protected]> Co-authored-by: Mike Baker <[email protected]> Co-authored-by: m1xxos <[email protected]> Co-authored-by: Adil <[email protected]>
1 parent 4cd5f2f commit 4e582fb

File tree

339 files changed

+14876
-11981
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

339 files changed

+14876
-11981
lines changed

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
},
1212
"plugins": ["@typescript-eslint"],
1313
"rules": {
14-
"semi": [2, "never"]
14+
"semi": [2, "never"],
15+
"@typescript-eslint/no-unnecessary-type-assertion": [0, "never"]
1516
}
1617
}

.github/workflows/build-docker-images.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Checkout
16-
uses: actions/checkout@v2
16+
uses: actions/checkout@v4
1717
with:
1818
fetch-depth: 0
1919
- name: 'Login to GitHub container registry'
20-
uses: docker/login-action@v1
20+
uses: docker/login-action@v3
2121
with:
2222
registry: ghcr.io
2323
username: ${{github.actor}}
@@ -30,3 +30,4 @@ jobs:
3030
run: |
3131
docker build --file packages/content-fetch/Dockerfile . --tag "ghcr.io/omnivore-app/content-fetch:${GITHUB_SHA}" --tag ghcr.io/omnivore-app/content-fetch:latest
3232
docker push ghcr.io/omnivore-app/content-fetch:${GITHUB_SHA}
33+
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Build Self-Hosting Docker Images
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- self-host-updates
7+
paths-ignore:
8+
- 'apple/**'
9+
- 'android/**'
10+
11+
jobs:
12+
build-self-hostdocker-images:
13+
name: Build self-host docker images
14+
permissions:
15+
contents: read
16+
packages: write
17+
attestations: write
18+
id-token: write
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v2
23+
with:
24+
fetch-depth: 0
25+
- name: 'Login to GitHub container registry'
26+
uses: docker/login-action@v1
27+
with:
28+
registry: ghcr.io
29+
username: ${{github.actor}}
30+
password: ${{secrets.GITHUB_TOKEN}}
31+
- name: Build the backend docker image
32+
run: |
33+
docker build . --file packages/api/Dockerfile --tag "ghcr.io/omnivore-app/sh-backend:${GITHUB_SHA}" --tag ghcr.io/omnivore-app/sh-backend:latest
34+
docker push ghcr.io/omnivore-app/sh-backend:${GITHUB_SHA}
35+
docker push ghcr.io/omnivore-app/sh-backend:latest
36+
- name: Build the content-fetch docker image
37+
run: |
38+
docker build --file packages/content-fetch/Dockerfile . --tag "ghcr.io/omnivore-app/sh-content-fetch:${GITHUB_SHA}" --tag ghcr.io/omnivore-app/sh-content-fetch:latest
39+
docker push ghcr.io/omnivore-app/sh-content-fetch:${GITHUB_SHA}
40+
docker push ghcr.io/omnivore-app/sh-content-fetch:latest
41+
- name: Build the queue-processor docker image.
42+
run: |
43+
docker build . --file packages/api/queue-processor/Dockerfile --tag "ghcr.io/omnivore-app/sh-queue-processor:${GITHUB_SHA}" --tag ghcr.io/omnivore-app/sh-queue-processor:latest
44+
docker push ghcr.io/omnivore-app/sh-queue-processor:${GITHUB_SHA}
45+
docker push ghcr.io/omnivore-app/sh-queue-processor:latest
46+
- name: Build the migrate docker image
47+
run: |
48+
docker build --file packages/db/Dockerfile . --tag "ghcr.io/omnivore-app/sh-migrate:${GITHUB_SHA}" --tag ghcr.io/omnivore-app/sh-migrate:latest
49+
docker push ghcr.io/omnivore-app/sh-migrate:${GITHUB_SHA}
50+
docker push ghcr.io/omnivore-app/sh-migrate:latest
51+
- name: Build the image-proxy docker image
52+
run: |
53+
cp imageproxy/start_imageproxy.sh .
54+
chmod +x start_imageproxy.sh
55+
docker build --file imageproxy/Dockerfile . --tag "ghcr.io/omnivore-app/sh-image-proxy:${GITHUB_SHA}" --tag ghcr.io/omnivore-app/sh-image-proxy:latest
56+
docker push ghcr.io/omnivore-app/sh-image-proxy:${GITHUB_SHA}
57+
docker push ghcr.io/omnivore-app/sh-image-proxy:latest
58+
- name: Build the mail-watch-server docker image
59+
run: |
60+
docker build --file packages/local-mail-watcher/Dockerfile . --tag "ghcr.io/omnivore-app/sh-local-mail-watcher:${GITHUB_SHA}" --tag ghcr.io/omnivore-app/sh-local-mail-watcher:latest
61+
docker push ghcr.io/omnivore-app/sh-local-mail-watcher:${GITHUB_SHA}
62+
docker push ghcr.io/omnivore-app/sh-local-mail-watcher:latest
63+
64+

.github/workflows/lint-migrations.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
lint_migrations:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v1
12+
- uses: actions/checkout@v4
1313
- name: Fetch main branch
1414
run: git fetch origin main:main
1515
- name: Find modified migrations

.github/workflows/run-distiller.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Checkout
17-
uses: actions/checkout@v3
17+
uses: actions/checkout@v4
1818
with:
1919
repository: ${{ github.event.pull_request.head.repo.full_name }}
2020
ref: ${{ github.event.pull_request.head.ref }}
2121
- name: Setup Go
22-
uses: actions/setup-go@v3
22+
uses: actions/setup-go@v5
2323
with:
2424
go-version: 1.19
2525
- name: Generate distiller output for readability
@@ -34,7 +34,7 @@ jobs:
3434
go-domdistiller file -i $f/source.html -o $f/distiller.html
3535
done
3636
- name: Setup Python
37-
uses: actions/setup-python@v4
37+
uses: actions/setup-python@v5
3838
with:
3939
python-version: 3.9
4040
- name: Generate static html

.github/workflows/run-tests.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
ports:
4646
- 6379
4747
steps:
48-
- uses: actions/checkout@v2
48+
- uses: actions/checkout@v4
4949
with:
5050
fetch-depth: 0
5151
- name: Initialize the database
@@ -55,9 +55,9 @@ jobs:
5555
env:
5656
PGPASSWORD: postgres
5757
- name: Use Node.js ${{ matrix.node-version }}
58-
uses: actions/setup-node@v2
58+
uses: actions/setup-node@v4
5959
with:
60-
node-version: 18.16
60+
node-version: 22.12.0
6161
- name: Get yarn cache directory path
6262
id: yarn-cache-dir-path
6363
run: echo "::set-output name=dir::$(source ~/.nvm/nvm.sh && yarn cache dir)"
@@ -102,7 +102,7 @@ jobs:
102102
runs-on: ubuntu-latest
103103
steps:
104104
- name: Checkout
105-
uses: actions/checkout@v2
105+
uses: actions/checkout@v4
106106
with:
107107
fetch-depth: 0
108108
- name: Build the API docker image

.github/workflows/static.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ jobs:
2626
runs-on: ubuntu-latest
2727
steps:
2828
- name: Checkout
29-
uses: actions/checkout@v3
29+
uses: actions/checkout@v4
3030
- name: Setup Pages
31-
uses: actions/configure-pages@v3
31+
uses: actions/configure-pages@v5
3232
- name: Upload artifact
33-
uses: actions/upload-pages-artifact@v1
33+
uses: actions/upload-pages-artifact@v3
3434
with:
3535
path: 'packages/readabilityjs/test'
3636
- name: Deploy to GitHub Pages
3737
id: deployment
38-
uses: actions/deploy-pages@v1
38+
uses: actions/deploy-pages@v4

.node-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
18.16
1+
22.12.0

README.md

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -151,24 +151,7 @@ is done fetching your content you will see it in your library.
151151

152152
## How to deploy to your own server
153153

154-
Omnivore was originally designed to be deployed on GCP and takes advantage
155-
of some of GCP's PaaS features. We are working to make Omnivore more portable
156-
so you can easily run the service on your own infrastructure. You can track
157-
progress here: <https://github.com/omnivore-app/omnivore/issues/25>
158-
159-
To deploy Omnivore on your own hardware you will need to deploy three
160-
dockerized services and configure access to a postgres service. To handle
161-
PDF documents you will need to configure access to a Google Cloud Storage
162-
bucket.
163-
164-
- `packages/api` - the backend API service
165-
- `packages/web` - the web frontend (can easily be deployed to vercel)
166-
- `packages/puppeteer-parse` - the content fetching service (can easily
167-
be deployed as an AWS lambda or GCP Cloud Function)
168-
169-
Additionally, you will need to run our database migrations to initialize
170-
your database. These are dockerized and can be run with the
171-
`packages/db` service.
154+
A guide for running a self hosted server can be found [here](./self-hosting/GUIDE.md)
172155

173156
## License
174157

android/Omnivore/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Omnivore - Android
22

3+
## Setup with gradle
4+
5+
In case you do not have Android Studio and you do not want to install it, you may want to use gradlew scripts to build the application.
6+
7+
`./gradlew assembleDebug` should create `./app/build/outputs/apk/debug/app-debug.apk`
8+
9+
310
## Setup
411

512
From the root directory run the following command:

android/Omnivore/app/src/main/java/app/omnivore/omnivore/feature/editinfo/EditInfoViewModel.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import app.omnivore.omnivore.R
1010
import app.omnivore.omnivore.core.data.DataService
1111
import app.omnivore.omnivore.core.datastore.DatastoreRepository
1212
import app.omnivore.omnivore.core.datastore.omnivoreAuthToken
13+
import app.omnivore.omnivore.core.datastore.omnivoreSelfHostedApiServer
1314
import app.omnivore.omnivore.graphql.generated.UpdatePageMutation
1415
import app.omnivore.omnivore.graphql.generated.type.UpdatePageInput
1516
import app.omnivore.omnivore.utils.Constants
@@ -48,6 +49,12 @@ class EditInfoViewModel @Inject constructor(
4849
datastoreRepo.getString(omnivoreAuthToken)
4950
}
5051

52+
fun baseUrl() = runBlocking {
53+
datastoreRepo.getString(omnivoreSelfHostedApiServer) ?: Constants.apiURL
54+
}
55+
56+
private fun serverUrl() = "${baseUrl()}/api/graphql"
57+
5158
fun editInfo(itemId: String, title: String, author: String?, description: String?) {
5259
viewModelScope.launch {
5360
isLoading = true
@@ -62,7 +69,7 @@ class EditInfoViewModel @Inject constructor(
6269
}
6370

6471
val apolloClient = ApolloClient.Builder()
65-
.serverUrl("${Constants.apiURL}/api/graphql")
72+
.serverUrl(serverUrl())
6673
.addHttpHeader("Authorization", value = authToken)
6774
.build()
6875

android/Omnivore/app/src/main/java/app/omnivore/omnivore/feature/onboarding/OnboardingViewModel.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,12 @@ class OnboardingViewModel @Inject constructor(
176176
resetPendingEmailUserCreds()
177177
}
178178

179+
fun baseUrl() = runBlocking {
180+
datastoreRepository.getString(omnivoreSelfHostedApiServer) ?: Constants.apiURL
181+
}
182+
183+
private fun serverUrl() = "${baseUrl()}/api/graphql"
184+
179185
fun validateUsername(potentialUsername: String) {
180186
validateUsernameJob?.cancel()
181187

@@ -209,7 +215,7 @@ class OnboardingViewModel @Inject constructor(
209215
}
210216

211217
val apolloClient =
212-
ApolloClient.Builder().serverUrl("${Constants.apiURL}/api/graphql").build()
218+
ApolloClient.Builder().serverUrl(serverUrl()).build()
213219

214220
try {
215221
val response = apolloClient.query(

android/Omnivore/app/src/main/java/app/omnivore/omnivore/feature/save/SaveURLWorker.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import androidx.work.WorkerParameters
1616
import app.omnivore.omnivore.R
1717
import app.omnivore.omnivore.core.datastore.DatastoreRepository
1818
import app.omnivore.omnivore.core.datastore.omnivoreAuthToken
19+
import app.omnivore.omnivore.core.datastore.omnivoreSelfHostedApiServer
1920
import app.omnivore.omnivore.graphql.generated.SaveUrlMutation
2021
import app.omnivore.omnivore.graphql.generated.type.SaveUrlInput
2122
import app.omnivore.omnivore.utils.Constants
@@ -59,11 +60,16 @@ class SaveURLWorker @AssistedInject constructor(
5960
}
6061
}
6162

63+
suspend fun baseUrl() =
64+
datastoreRepository.getString(omnivoreSelfHostedApiServer) ?: Constants.apiURL
65+
66+
private suspend fun serverUrl() = "${baseUrl()}/api/graphql"
67+
6268
private suspend fun saveURL(url: String): Boolean {
6369
val authToken = datastoreRepository.getString(omnivoreAuthToken) ?: return false
6470

6571
val apolloClient = ApolloClient.Builder()
66-
.serverUrl("${Constants.apiURL}/api/graphql")
72+
.serverUrl(serverUrl())
6773
.addHttpHeader("Authorization", value = authToken)
6874
.build()
6975

android/Omnivore/app/src/main/java/app/omnivore/omnivore/feature/save/SaveViewModel.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import androidx.lifecycle.viewModelScope
1111
import app.omnivore.omnivore.R
1212
import app.omnivore.omnivore.core.datastore.DatastoreRepository
1313
import app.omnivore.omnivore.core.datastore.omnivoreAuthToken
14+
import app.omnivore.omnivore.core.datastore.omnivoreSelfHostedApiServer
1415
import app.omnivore.omnivore.graphql.generated.SaveUrlMutation
1516
import app.omnivore.omnivore.graphql.generated.type.SaveUrlInput
1617
import app.omnivore.omnivore.utils.Constants
@@ -71,6 +72,12 @@ class SaveViewModel @Inject constructor(
7172
return null
7273
}
7374

75+
fun baseUrl() = runBlocking {
76+
datastoreRepo.getString(omnivoreSelfHostedApiServer) ?: Constants.apiURL
77+
}
78+
79+
private fun serverUrl() = "${baseUrl()}/api/graphql"
80+
7481
fun saveURL(url: String) {
7582
viewModelScope.launch {
7683
isLoading = true
@@ -86,7 +93,7 @@ class SaveViewModel @Inject constructor(
8693
}
8794

8895
val apolloClient = ApolloClient.Builder()
89-
.serverUrl("${Constants.apiURL}/api/graphql")
96+
.serverUrl(serverUrl())
9097
.addHttpHeader("Authorization", value = authToken)
9198
.build()
9299

165 KB
Loading
86.5 KB
Loading

docs/guides/images/imported-email.png

28.9 KB
Loading

docs/guides/images/received-email.png

22.1 KB
Loading

docs/guides/images/ses-add-domain.png

452 KB
Loading

docs/guides/images/ses-verify.png

543 KB
Loading
312 KB
Loading
Loading
207 KB
Loading
63.2 KB
Loading
47.9 KB
Loading
120 KB
Loading
Loading
161 KB
Loading

docs/guides/images/sns-topic-menu.png

140 KB
Loading
49.9 KB
Loading
282 KB
Loading
302 KB
Loading
305 KB
Loading

imageproxy/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM willnorris/imageproxy:v0.10.0 as build
1+
FROM ghcr.io/willnorris/imageproxy:main as build
22

33
# Above imageproxy image is built from scratch image and is barebones
44
# Switching over to ubuntu base image to allow us to debug better.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"graphql-tag": "^2.11.0",
3434
"lerna": "^7.4.1",
3535
"prettier": "^2.5.1",
36-
"typescript": "4.5.2"
36+
"typescript": "5.7.3"
3737
},
3838
"volta": {
3939
"node": "18.16.1",

packages/api/.eslintrc

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,27 @@
44
"project": "tsconfig.json"
55
},
66
"rules": {
7-
"@typescript-eslint/no-unsafe-argument": 0
7+
"@typescript-eslint/no-unsafe-argument": 0,
8+
"@typescript-eslint/no-unsafe-member-access": 0,
9+
"@typescript-eslint/no-unnecessary-type-assertion": 0,
10+
"@typescript-eslint/no-unsafe-assignment": 0,
11+
"@typescript-eslint/no-unsafe-return": ["warn"],
12+
"@typescript-eslint/no-unsafe-call" : ["warn"],
13+
"@typescript-eslint/restrict-template-expressions": ["warn"],
14+
"@typescript-eslint/no-misused-promises": ["warn"],
15+
"@typescript-eslint/ban-ts-comment": ["warn"],
16+
"@typescript-eslint/no-unused-vars": 0
817
},
918
"overrides": [
1019
{
1120
"files": ["test/**/*.ts"],
1221
"rules": {
13-
"@typescript-eslint/no-unsafe-member-access": 0
22+
"@typescript-eslint/no-unsafe-member-access": 0,
23+
"@typescript-eslint/no-unnecessary-type-assertion": 0,
24+
"@typescript-eslint/no-unsafe-assignment": 0,
25+
"@typescript-eslint/no-unsafe-return": ["warn"],
26+
"@typescript-eslint/no-unsafe-call" : ["warn"],
27+
"@typescript-eslint/no-unused-vars": 0
1428
}
1529
}
1630
]

0 commit comments

Comments
 (0)