mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-14 10:58:06 -04:00
disable cache persistence & env updates
This commit is contained in:
@@ -152,6 +152,8 @@ class Config(object):
|
||||
ONE_OFF_MESSAGE_FILENAME = 'Report'
|
||||
MAX_VERIFY_CODE_COUNT = 5
|
||||
MAX_FAILED_LOGIN_COUNT = 10
|
||||
|
||||
SES_STUB_URL = None # TODO: set to a URL in env and remove this to use a stubbed SES service
|
||||
|
||||
# be careful increasing this size without being sure that we won't see slowness in pysftp
|
||||
MAX_LETTER_PDF_ZIP_FILESIZE = 40 * 1024 * 1024 # 40mb
|
||||
@@ -381,7 +383,6 @@ class Config(object):
|
||||
# these environment vars aren't defined in the manifest so to set them on paas use `cf set-env`
|
||||
MMG_URL = os.environ.get("MMG_URL", "https://api.mmg.co.uk/jsonv2a/api.php")
|
||||
FIRETEXT_URL = os.environ.get("FIRETEXT_URL", "https://www.firetext.co.uk/api/sendsms/json")
|
||||
SES_STUB_URL = os.environ.get("SES_STUB_URL")
|
||||
|
||||
AWS_REGION = 'us-west-2'
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ class User(db.Model):
|
||||
state = db.Column(db.String, nullable=False, default='pending')
|
||||
platform_admin = db.Column(db.Boolean, nullable=False, default=False)
|
||||
current_session_id = db.Column(UUID(as_uuid=True), nullable=True)
|
||||
auth_type = db.Column(db.String, db.ForeignKey('auth_type.name'), index=True, nullable=False, default=SMS_AUTH_TYPE)
|
||||
auth_type = db.Column(db.String, db.ForeignKey('auth_type.name'), index=True, nullable=False, default=EMAIL_AUTH_TYPE)
|
||||
email_access_validated_at = db.Column(
|
||||
db.DateTime, index=False, unique=False, nullable=False, default=datetime.datetime.utcnow
|
||||
)
|
||||
@@ -1841,7 +1841,7 @@ class InvitedUser(db.Model):
|
||||
db.ForeignKey('auth_type.name'),
|
||||
index=True,
|
||||
nullable=False,
|
||||
default=SMS_AUTH_TYPE
|
||||
default=EMAIL_AUTH_TYPE
|
||||
)
|
||||
folder_permissions = db.Column(JSONB(none_as_null=True), nullable=False, default=[])
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ RUN apt-get update \
|
||||
RUN pip install --upgrade pip
|
||||
|
||||
COPY devcontainer-api/scripts/notify-dev-entrypoint.sh /usr/local/bin/
|
||||
COPY devcontainer-api/scripts/notify-worker-entrypoint.sh /usr/local/bin/
|
||||
|
||||
ENV SHELL /bin/zsh
|
||||
|
||||
|
||||
40
devcontainer-api/scripts/notify-worker-entrypoint.sh
Executable file
40
devcontainer-api/scripts/notify-worker-entrypoint.sh
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
set -ex
|
||||
|
||||
###################################################################
|
||||
# This script will get executed *once* the Docker container has
|
||||
# been built. Commands that need to be executed with all available
|
||||
# tools and the filesystem mount enabled should be located here.
|
||||
###################################################################
|
||||
|
||||
# Define aliases
|
||||
echo -e "\n\n# User's Aliases" >> ~/.zshrc
|
||||
echo -e "alias fd=fdfind" >> ~/.zshrc
|
||||
echo -e "alias l='ls -al --color'" >> ~/.zshrc
|
||||
echo -e "alias ls='exa'" >> ~/.zshrc
|
||||
echo -e "alias l='exa -alh'" >> ~/.zshrc
|
||||
echo -e "alias ll='exa -alh@ --git'" >> ~/.zshrc
|
||||
echo -e "alias lt='exa -al -T -L 2'" >> ~/.zshrc
|
||||
|
||||
# # Kubectl aliases and command autocomplete
|
||||
# echo -e "alias k='kubectl'" >> ~/.zshrc
|
||||
# echo -e "alias k-staging='aws eks --region ca-central-1 update-kubeconfig --name notification-canada-ca-staging-eks-cluster'" >> ~/.zshrc
|
||||
# echo -e "alias k-prod='aws eks --region ca-central-1 update-kubeconfig --name notification-canada-ca-production-eks-cluster'" >> ~/.zshrc
|
||||
# echo -e "source <(kubectl completion zsh)" >> ~/.zshrc
|
||||
# echo -e "complete -F __start_kubectl k" >> ~/.zshrc
|
||||
|
||||
cd /workspace
|
||||
|
||||
# Warm up git index prior to display status in prompt else it will
|
||||
# be quite slow on every invocation of starship.
|
||||
git status
|
||||
|
||||
make generate-version-file
|
||||
pip3 install -r requirements.txt
|
||||
pip3 install -r requirements_for_test.txt
|
||||
|
||||
# Install virtualenv to support running the isolated make freeze-requirements from within the devcontainer
|
||||
pip3 install virtualenv
|
||||
|
||||
# Run Celery worker
|
||||
# make run-celery
|
||||
42
devcontainer-worker/.devcontainer.json
Normal file
42
devcontainer-worker/.devcontainer.json
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "notification-api",
|
||||
"dockerComposeFile": "../docker-compose.devcontainer.yml",
|
||||
"service": "worker",
|
||||
"workspaceFolder": "/workspace",
|
||||
"shutdownAction": "stopCompose",
|
||||
"remoteEnv": {
|
||||
"PATH": "/home/vscode/.local/bin:${containerEnv:PATH}" // give our installed Python modules precedence
|
||||
},
|
||||
"settings": {
|
||||
"[python]": {
|
||||
"editor.formatOnSave": true
|
||||
},
|
||||
"python.linting.enabled": true,
|
||||
"python.linting.pylintEnabled": true,
|
||||
"python.pythonPath": "/usr/local/bin/python"
|
||||
},
|
||||
"features": {
|
||||
"docker-from-docker": {
|
||||
"version": "latest",
|
||||
"moby": true
|
||||
}
|
||||
},
|
||||
"extensions": [
|
||||
"ms-python.black-formatter",
|
||||
"donjayamanne.python-extension-pack",
|
||||
"ms-azuretools.vscode-docker",
|
||||
"ms-python.vscode-pylance",
|
||||
"eamodio.gitlens",
|
||||
"wholroyd.jinja",
|
||||
"pmbenjamin.vscode-snyk",
|
||||
"visualstudioexptteam.vscodeintellicode",
|
||||
"yzhang.markdown-all-in-one",
|
||||
"ms-ossdata.vscode-postgresql",
|
||||
"GitHub.copilot",
|
||||
"ms-vsliveshare.vsliveshare",
|
||||
"mtxr.sqltools",
|
||||
"mtxr.sqltools-driver-pg",
|
||||
],
|
||||
"postCreateCommand": "notify-worker-entrypoint.sh",
|
||||
"remoteUser": "vscode"
|
||||
}
|
||||
@@ -24,7 +24,7 @@ services:
|
||||
container_name: redis
|
||||
image: redis:6.2
|
||||
restart: always
|
||||
command: redis-server --port 6380
|
||||
command: sh -c "rm -f /data/dump.rdb && redis-server --port 6380" # disable persistence
|
||||
ports:
|
||||
- "6380:6380"
|
||||
expose:
|
||||
|
||||
@@ -16,8 +16,8 @@ import sqlalchemy as sa
|
||||
service_id = 'd6aa2c68-a2d9-4437-ab19-3ae8eb202553'
|
||||
def upgrade():
|
||||
op.get_bind()
|
||||
op.execute("update services set email_from = 'gov.uk.notify' where id = '{}'".format(service_id))
|
||||
op.execute("update services_history set email_from = 'gov.uk.notify' where id = '{}'".format(service_id))
|
||||
op.execute("update services set email_from = 'testsender' where id = '{}'".format(service_id))
|
||||
op.execute("update services_history set email_from = 'testsender' where id = '{}'".format(service_id))
|
||||
|
||||
|
||||
def downgrade():
|
||||
|
||||
@@ -20,10 +20,10 @@ SECRET_KEY=dev-notify-secret-key
|
||||
DANGEROUS_SALT=dev-notify-salt
|
||||
|
||||
# URL of admin app
|
||||
ADMIN_BASE_URL=http://admin:6012
|
||||
ADMIN_BASE_URL=http://0.0.0.0:6012
|
||||
|
||||
# URL of api app (on AWS this is the internal api endpoint)
|
||||
API_HOST_NAME=http://dev:6011
|
||||
API_HOST_NAME=http://0.0.0.0:6011
|
||||
|
||||
# URL of redis instance
|
||||
REDIS_URL=redis://redis:6380
|
||||
|
||||
Reference in New Issue
Block a user