Fixed config files that were missing from git. Added email ARGs to the config

This commit is contained in:
Josh Krawczyk 2020-02-16 00:30:41 -05:00
parent 80fd378282
commit fbb4017e3c
7 changed files with 83 additions and 4 deletions

View File

@ -17,5 +17,13 @@ SALT_PASS=password
ADMIN_URL=admin
DJANGO_SEKRET=secret12341234123412341234
DJANGO_DEBUG=False
TWO_FACTOR_OTP=3HTDZVFRYP4OPXHL
EMAIL_TLS=True
EMAIL_HOST=smtp.gmail.com
EMAIL_USER=example@gmail.com
EMAIL_PASS=changeme
EMAIL_PORT=587
EMAIL_ALERT_RECIPIENTS="example@gmail.com",

View File

@ -1,6 +1,7 @@
FROM tiangolo/uwsgi-nginx:python3.7
WORKDIR /app
ARG DJANGO_SEKRET
ARG DJANGO_DEBUG
ARG POSTGRES_USER
ARG POSTGRES_PASS
ARG POSTGRES_HOST
@ -14,6 +15,12 @@ ARG APP_HOST
ARG API_HOST
ARG ADMIN_URL
ARG TWO_FACTOR_OTP
ARG EMAIL_TLS
ARG EMAIL_HOST
ARG EMAIL_USER
ARG EMAIL_PASS
ARG EMAIL_PORT
ARG EMAIL_RECIPIENTS
EXPOSE 80
@ -25,5 +32,5 @@ COPY ./docker/api/uwsgi.ini .
COPY ./docker/api/api.conf /app/api.conf.tmp
RUN envsubst '\$APP_HOST, \$API_HOST' < /app/api.conf.tmp > /app/nginx.conf && \
rm /app/api.conf.tmp
COPY ./docker/api/local_settings.py ./tacticalrmm/local_settings.py.tmp
COPY ./docker/api/local_settings.py.keep ./tacticalrmm/local_settings.py.tmp
RUN envsubst < /app/tacticalrmm/local_settings.py.tmp > /app/tacticalrmm/local_settings.py && rm /app/tacticalrmm/local_settings.py.tmp

View File

@ -0,0 +1,53 @@
SECRET_KEY = '${DJANGO_SEKRET}'
ALLOWED_HOSTS = ['${API_HOST}']
ADMIN_URL = "${ADMIN_URL}"
CORS_ORIGIN_WHITELIST = ["https://${APP_HOST}"]
DEBUG = ${DJANGO_DEBUG}
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'tacticalrmm',
'USER': '${POSTGRES_USER}',
'PASSWORD': '${POSTGRES_PASS}',
'HOST': '${POSTGRES_HOST}',
'PORT': '5432',
}
}
REST_FRAMEWORK = {
'DATETIME_FORMAT': "%b-%d-%Y - %H:%M",
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAuthenticated',
),
'DEFAULT_AUTHENTICATION_CLASSES': (
'knox.auth.TokenAuthentication',
),
}
if not DEBUG:
REST_FRAMEWORK.update({
'DEFAULT_RENDERER_CLASSES': (
'rest_framework.renderers.JSONRenderer',
)
})
EMAIL_USE_TLS = ${EMAIL_TLS}
EMAIL_HOST = '${EMAIL_HOST}'
EMAIL_HOST_USER = '${EMAIL_USER}'
EMAIL_HOST_PASSWORD = '${EMAIL_PASS}'
EMAIL_PORT = ${EMAIL_PORT}
EMAIL_ALERT_RECIPIENTS = [${EMAIL_RECIPIENTS}]
SALT_USERNAME = "${SALT_USER}"
SALT_PASSWORD = "${SALT_PASS}"
MESH_USERNAME = "${MESH_USER}"
MESH_SITE = "https://${MESH_HOST}"
REDIS_HOST = "${REDIS_HOST}"
SALT_HOST = "${SALT_HOST}"
TWO_FACTOR_OTP = "${TWO_FACTOR_OTP}"

View File

@ -0,0 +1,2 @@
VUE_APP_PROD_URL = "https://${APP_HOST}"
VUE_APP_DEV_URL = "http://localhost:8000"

View File

@ -5,8 +5,8 @@ EXPOSE 80
WORKDIR /home/node
RUN apk add gettext
COPY ./web .
COPY ./docker/app/.env.local /home/.env.local.tmp
RUN envsubst '\$APP_HOST, \$API_HOST' < /home/.env.local.tmp > /home/node/.env.local && rm /home/.env.local.tmp
COPY ./docker/app/.env.local.keep /home/.env.local.tmp
RUN envsubst '\$APP_HOST' < /home/.env.local.tmp > /home/node/.env.local && rm /home/.env.local.tmp
RUN npm install && npm run build
COPY ./docker/app/app.conf /home/node/app.conf.tmp
RUN envsubst '\$APP_HOST' < /home/node/app.conf.tmp > /home/node/app.conf

View File

@ -71,6 +71,7 @@ services:
dockerfile: "./docker/api/dockerfile"
args:
- DJANGO_SEKRET=${DJANGO_SEKRET}
- DJANGO_DEBUG=${DJANGO_DEBUG}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASS=${POSTGRES_PASS}
- POSTGRES_HOST=${POSTGRES_HOST}
@ -84,6 +85,12 @@ services:
- API_HOST=${API_HOST}
- ADMIN_URL=${ADMIN_URL}
- TWO_FACTOR_OTP=${TWO_FACTOR_OTP}
- EMAIL_TLS=${EMAIL_TLS}
- EMAIL_HOST=${EMAIL_HOST}
- EMAIL_USER=${EMAIL_USER}
- EMAIL_PASS=${EMAIL_PASS}
- EMAIL_PORT=${EMAIL_PORT}
- EMAIL_RECIPIENTS=${EMAIL_RECIPIENTS}
networks:
- proxy
- database

View File

@ -13,12 +13,14 @@ sudo apt-get install certbot
Generate the wildcard certificate. Add the DNS entry for domain validation.
```sudo certbot certonly --manual -d *.example.com --agree-tos --no-bootstrap --manual-public-ip-logging-ok --preferred-challenges dns
```
sudo certbot certonly --manual -d *.example.com --agree-tos --no-bootstrap --manual-public-ip-logging-ok --preferred-challenges dns
```
Copy the fullchain.pem and privkey.pem to the cert directory.
## Run the environment with Docker
Copy the .env.example to .env
Change values in .env to match your environment
```