Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: First time developer setup #1677

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .devcontainer/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ MONGODB_USER=mongouser
MONGODB_PASSWORD=mongopass

# database settings
POSTGRES_DB=tactical
POSTGRES_USER=postgres
POSTGRES_PASS=postgrespass

Expand All @@ -29,3 +30,9 @@ HTTP_PROTOCOL=https
DOCKER_NETWORK=172.21.0.0/24
DOCKER_NGINX_IP=172.21.0.20
NATS_PORTS=4222:4222

# The nginx container expects CERT_PUB_KEY and CERT_PRIV_KEY to be base64 encoded
#CERT_PUB_KEY='VGhlIG5naW54IGNvbnRhaW5lciBleHBlY3RzIENFUlRfUFVCX0tFWSBhbmQgQ0VSVF9QUklWX0tF
# WSB0byBiZSBiYXNlNjQgZW5jb2RlZA=='
#CERT_PRIV_KEY='VGhlIG5naW54IGNvbnRhaW5lciBleHBlY3RzIENFUlRfUFVCX0tFWSBhbmQgQ0VSVF9QUklWX0tF
# WSB0byBiZSBiYXNlNjQgZW5jb2RlZA=='
8 changes: 5 additions & 3 deletions .devcontainer/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ set -e
: "${MESH_PASS:=meshcentralpass}"
: "${MESH_HOST:=tactical-meshcentral}"
: "${API_HOST:=tactical-backend}"
: "${APP_HOST:=tactical-frontend}"
: "${REDIS_HOST:=tactical-redis}"
: "${API_PORT:=8000}"

Expand Down Expand Up @@ -49,7 +50,7 @@ function django_setup {
MESH_TOKEN="$(cat ${TACTICAL_DIR}/tmp/mesh_token)"

DJANGO_SEKRET=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 80 | head -n 1)

localvars="$(cat << EOF
SECRET_KEY = '${DJANGO_SEKRET}'

Expand All @@ -69,6 +70,7 @@ ALLOWED_HOSTS = ['${API_HOST}', '*']
ADMIN_URL = 'admin/'

CORS_ORIGIN_ALLOW_ALL = True
CORS_ORIGIN_WHITELIST = ['https://${APP_HOST}']

DATABASES = {
'default': {
Expand Down Expand Up @@ -116,9 +118,9 @@ EOF
"${VIRTUAL_ENV}"/bin/python manage.py create_natsapi_conf
"${VIRTUAL_ENV}"/bin/python manage.py create_installer_user
"${VIRTUAL_ENV}"/bin/python manage.py post_update_tasks


# create super user

# create super user
echo "from accounts.models import User; User.objects.create_superuser('${TRMM_USER}', 'admin@example.com', '${TRMM_PASS}') if not User.objects.filter(username='${TRMM_USER}').exists() else 0;" | python manage.py shell
}

Expand Down
Loading