Skip to content

Commit

Permalink
Make the app run
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinMind committed Jan 10, 2025
1 parent 507aa66 commit 9997fcb
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
14 changes: 13 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,17 @@
"enableNonRootDocker": "true",
"moby": "true"
}
}
},
"forwardPorts": [80],
"appPort": [80],
"portsAttributes": {
"80": {
"label": "Addons-Server",
"onAutoForward": "notify",
"protocol": "http",
"requireLocalPort": true,
"elevateIfNeeded": true
}
},
"postStartCommand": "make up"
}
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ x-env-mapping: &env
- MEMCACHE_LOCATION=memcached:11211
- MYSQL_DATABASE=olympia
- MYSQL_ROOT_PASSWORD=docker
- OLYMPIA_SITE_URL=http://olympia.test
- PYTHONDONTWRITEBYTECODE=1
- PYTHONUNBUFFERED=1
- PYTHONBREAKPOINT=ipdb.set_trace
Expand All @@ -21,6 +20,7 @@ x-env-mapping: &env
- HISTCONTROL=erasedups
- CIRCLECI
- DATA_BACKUP_SKIP
- OLYMPIA_SITE_URL

x-olympia: &olympia
<<: *env
Expand Down
10 changes: 10 additions & 0 deletions scripts/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ def get_olympia_mount(docker_target):

return olympia_mount, olympia_mount_source

def get_olympia_site_url():
# In codespaces, we set the site URL to the codespace name port 80
# this will map to the nginx service in the devcontainer.
if os.environ.get('CODESPACE_NAME'):
return f'https://{os.environ.get("CODESPACE_NAME")}-80.githubpreview.dev'
# On local hosts, we set the site URL to olympia.test
return 'http://olympia.test'


# Env file should contain values that are referenced in docker-compose*.yml files
# so running docker compose commands produce consistent results in terminal and make.
Expand Down Expand Up @@ -123,6 +131,7 @@ def main():
# use a value derived from other stable values.
debug = os.environ.get('DEBUG', str(False if is_production else True))
olympia_deps = os.environ.get('OLYMPIA_DEPS', docker_target)
olympia_site_url = get_olympia_site_url()

set_env_file(
{
Expand All @@ -140,6 +149,7 @@ def main():
'HOST_MOUNT_SOURCE': olympia_mount_source,
'DEBUG': debug,
'OLYMPIA_DEPS': olympia_deps,
'OLYMPIA_SITE_URL': olympia_site_url,
}
)

Expand Down

0 comments on commit 9997fcb

Please sign in to comment.