Env vars for systemd

This commit is contained in:
Paolo Basso 2020-11-03 21:22:14 +01:00
parent f652c324ca
commit 39de891005
2 changed files with 17 additions and 7 deletions

View File

@ -111,6 +111,7 @@ optional arguments:
--debug Activates debug mode for the server (default False) --debug Activates debug mode for the server (default False)
--https-only Enforces HTTPS redirects for all requests (default False) --https-only Enforces HTTPS redirects for all requests (default False)
``` ```
You may want to set the environment variables in the host OS.
### E) Manual ### E) Manual
Clone the repo and run the following commands to start the app in a local-only environment: Clone the repo and run the following commands to start the app in a local-only environment:
@ -123,6 +124,7 @@ source venv/bin/activate
pip install -r requirements.txt pip install -r requirements.txt
./run ./run
``` ```
You may want to set the environment variables in the host OS.
#### systemd Configuration #### systemd Configuration
After building the virtual environment, you can add the following to `/lib/systemd/system/whoogle.service` to set up a Whoogle Search systemd service: After building the virtual environment, you can add the following to `/lib/systemd/system/whoogle.service` to set up a Whoogle Search systemd service:
@ -132,6 +134,14 @@ After building the virtual environment, you can add the following to `/lib/syste
Description=Whoogle Description=Whoogle
[Service] [Service]
# Basic auth configuration, remove to disable
Environment=WHOOGLE_USER=username
Environment=WHOOGLE_PASS=password
# Proxy configuration, remove to disable
Environment=WHOOGLE_PROXY_USER=username
Environment=WHOOGLE_PROXY_PASS=password
Environment=WHOOGLE_PROXY_TYPE=socks5
Environment=WHOOGLE_PROXY_LOC=ip
Type=simple Type=simple
User=root User=root
WorkingDirectory=<whoogle_directory> WorkingDirectory=<whoogle_directory>
@ -209,7 +219,7 @@ heroku open
``` ```
This series of commands can take a while, but once you run it once, you shouldn't have to run it again. The final command, `heroku open` will launch a tab in your web browser, where you can test out Whoogle and even [set it as your primary search engine](https://github.com/benbusby/whoogle#set-whoogle-as-your-primary-search-engine). This series of commands can take a while, but once you run it once, you shouldn't have to run it again. The final command, `heroku open` will launch a tab in your web browser, where you can test out Whoogle and even [set it as your primary search engine](https://github.com/benbusby/whoogle#set-whoogle-as-your-primary-search-engine).
You can also edit environment variables from your apps Settings tab in the Heroku Dashboard. You may also edit environment variables from your apps Settings tab in the Heroku Dashboard.
#### Using your own server, or alternative container deployment #### Using your own server, or alternative container deployment
There are other methods for deploying docker containers that are well outlined in [this article](https://rollout.io/blog/the-shortlist-of-docker-hosting/), but there are too many to describe set up for each here. Generally it should be about the same amount of effort as the Heroku deployment. There are other methods for deploying docker containers that are well outlined in [this article](https://rollout.io/blog/the-shortlist-of-docker-hosting/), but there are too many to describe set up for each here. Generally it should be about the same amount of effort as the Heroku deployment.

View File

@ -5,12 +5,12 @@ services:
image: benbusby/whoogle-search image: benbusby/whoogle-search
container_name: whoogle-search container_name: whoogle-search
environment: environment:
- WHOOGLE_USER=username # empty to disable - WHOOGLE_USER=username # remove to disable
- WHOOGLE_PASS=password # empty to disable - WHOOGLE_PASS=password # remove to disable
- WHOOGLE_PROXY_USER=username # empty to disable - WHOOGLE_PROXY_USER=username # remove to disable
- WHOOGLE_PROXY_PASS=password # empty to disable - WHOOGLE_PROXY_PASS=password # remove to disable
- WHOOGLE_PROXY_TYPE=socks5 # empty to disable - WHOOGLE_PROXY_TYPE=socks5 # remove to disable
- WHOOGLE_PROXY_LOC=ip # empty to disable - WHOOGLE_PROXY_LOC=ip # remove to disable
ports: ports:
- 5000:5000 - 5000:5000
restart: unless-stopped restart: unless-stopped