add tor env switch

This commit is contained in:
finn 2024-08-08 02:57:33 -07:00
parent b9a432b356
commit 4e948af492
6 changed files with 60 additions and 26 deletions

View File

@ -109,18 +109,20 @@ services:
container_name: tor_service container_name: tor_service
build: build:
context: tor context: tor
environment:
- USE_TOR=${USE_TOR}
depends_on: depends_on:
- backend - backend
networks: networks:
- frontnet - frontnet
pmb: pmb:
build: #build:
args: # args:
GPG_PP: $BUILD_GPG_PP # GPG_PP: $BUILD_GPG_PP
context: pmb-pf # context: pmb-pf
dockerfile: Dockerfile # dockerfile: Dockerfile
#image: site_pmb:latest image: site_pmb:latest
expose: expose:
- "25" - "25"
env_file: env_file:

View File

@ -105,14 +105,24 @@ services:
- backend - backend
networks: networks:
- frontnet - frontnet
hs:
container_name: tor_service
build:
context: tor
environment:
- USE_TOR=${USE_TOR}
depends_on:
- backend
networks:
- frontnet
pmb: pmb:
#build: build:
# args: args:
# GPG_PP: $BUILD_GPG_PP GPG_PP: $BUILD_GPG_PP
# context: pmb-pf context: pmb-pf
# dockerfile: Dockerfile dockerfile: Dockerfile
image: site_pmb:latest #image: site_pmb:latest
expose: expose:
- "25" - "25"
env_file: env_file:

View File

@ -105,14 +105,24 @@ services:
- backend - backend
networks: networks:
- frontnet - frontnet
hs:
container_name: tor_service
build:
context: tor
environment:
- USE_TOR=${USE_TOR}
depends_on:
- backend
networks:
- frontnet
pmb: pmb:
#build: build:
# args: args:
# GPG_PP: $BUILD_GPG_PP GPG_PP: $BUILD_GPG_PP
# context: pmb-pf context: pmb-pf
# dockerfile: Dockerfile dockerfile: Dockerfile
image: site_pmb:latest #image: site_pmb:latest
expose: expose:
- "25" - "25"
env_file: env_file:

13
dotenv
View File

@ -5,23 +5,26 @@ DOTENV_MYSQL_ROOT_PASSWORD=rootp
DOTENV_MYSQL_GITEA_PASSWORD=giteap DOTENV_MYSQL_GITEA_PASSWORD=giteap
DOTENV_MYSQL_FLASK_PASSWORD=flaskp DOTENV_MYSQL_FLASK_PASSWORD=flaskp
GITEA_MAIL_FROM="git@changeme" GITEA_MAIL_FROM="git@e.e"
# Build ARG GPG_PP. May still need to be empty to avoid breakage. # Build ARG GPG_PP. May still need to be empty to avoid breakage.
BUILD_GPG_PP= BUILD_GPG_PP=
# Tor:
# true/false
USE_TOR=false
# Backend: # Backend:
FLASK_SECRET_KEY="changeme" FLASK_SECRET_KEY="flaskkey"
# Inconsequential token: minimal inconvenience if exposed # Inconsequential token: minimal inconvenience if exposed
FLASK_TOKEN_I=dti FLASK_TOKEN_I=dti
# Consequential token: protect # Consequential token: protect
FLASK_TOKEN_C=dtc FLASK_TOKEN_C=dtc
FLASK_MAIL_FROM="git@changeme" FLASK_MAIL_FROM="git@e.e"
# admin email must be valid send from with mail subsystem # admin email must be valid send from with mail subsystem
FLASK_ADMIN_EMAIL="git@changeme" FLASK_ADMIN_EMAIL="git@e.e"
FLASK_JWT_PHRASE="jwtphrase" FLASK_JWT_PHRASE="tphrase"
FLASK_REAL_HOSTNAME="localhost" FLASK_REAL_HOSTNAME="localhost"

View File

@ -6,6 +6,7 @@ RUN apt update && apt install -y tor curl
COPY hidden_service /hidden_service COPY hidden_service /hidden_service
COPY torrc /etc/tor/torrc COPY torrc /etc/tor/torrc
COPY entrypoint.sh /
RUN chown -R tor /etc/tor RUN chown -R tor /etc/tor
RUN chown -R tor /hidden_service RUN chown -R tor /hidden_service
@ -14,5 +15,5 @@ RUN chmod -R go-rwx /hidden_service
USER tor USER tor
ENTRYPOINT ["tor"] ENTRYPOINT ["/entrypoint.sh"]

8
tor/entrypoint.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
if $USE_TOR ; then
echo "@@@@@@@@@@ TOR ENABLED BY ENV"
exec tor
else
echo "@@@@@@@@@@ TOR DISABLED BY ENV"
fi