Skip to content

Commit

Permalink
Use network name as TLD in domain names
Browse files Browse the repository at this point in the history
Set a network name that is safe to use as a TLD.
  • Loading branch information
simonbru committed Oct 24, 2024
1 parent d3699be commit 47b914f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions cookiecutter.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"project_name": "My Project",
"project_slug": "{{ cookiecutter.project_name|lower|replace(' ', '_')|replace('-', '_') }}",
"__network_name": "{{ cookiecutter.project_slug|replace('_', '') }}",
"jira_prefix": "",
"virtualization_tool": ["docker", "nothing"],
"override_user_model": "y",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% set subdomain = cookiecutter.project_slug|replace("_", "-") %}# Docker-compose override examples
{% set subdomain = cookiecutter.project_slug|replace("_", "-") -%}
# Docker-compose override examples
# ================================
#
# Make a copy of this file and name it `docker-compose.override.yml`, then
Expand Down Expand Up @@ -41,6 +42,7 @@
# JIRA_USERNAME: username
# JIRA_PASSWORD: password
# JIRA_URL: https://jira.liip.ch
#
# x-build-args: &x-build-args
# USER_ID: 1000 # Change this if your host user is not 1000
# GROUP_ID: 1000 # Change this if your host group is not 1000
Expand Down Expand Up @@ -103,6 +105,7 @@
# - 'traefik.http.routers.{{ cookiecutter.project_slug }}_mailhog.middlewares=https_redirect@file'
# - 'traefik.http.routers.{{ cookiecutter.project_slug }}_mailhog.rule=Host(`{{ subdomain }}-mail.docker.test`)'
# - 'traefik.http.services.{{ cookiecutter.project_slug }}_mailhog.loadbalancer.server.port=8025'
#
# networks:
# pontsun:
# external: true
10 changes: 8 additions & 2 deletions {{cookiecutter.project_slug}}/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{% set network_name = cookiecutter.project_slug|replace("_", "") -%}
x-environment:
&x-environment
INITIAL: "${INITIAL:-0}"
Expand All @@ -19,8 +20,8 @@ services:
<<: *x-environment
ALLOWED_HOSTS: >-
localhost
DATABASE_URL: postgresql://postgres:{{ cookiecutter.project_slug }}@db/{{ cookiecutter.project_slug }}
EMAIL_URL: smtp://mailhog:1025
DATABASE_URL: postgresql://postgres:{{ cookiecutter.project_slug }}@db.{{ cookiecutter.__network_name }}/{{ cookiecutter.project_slug }}
EMAIL_URL: smtp://mailhog.{{ cookiecutter.__network_name }}:1025
MEDIA_ROOT: /opt/media
volumes:
- media:/opt/media
Expand All @@ -42,6 +43,11 @@ services:
<<: *x-environment
mailhog:
image: mailhog/mailhog:v1.0.1

networks:
default:
name: {{ cookiecutter.__network_name }}

volumes:
media:
pgdata:
Expand Down

0 comments on commit 47b914f

Please sign in to comment.