-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/uuid-query-endpoint
- Loading branch information
Showing
399 changed files
with
33,661 additions
and
11,395 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,69 @@ | ||
FROM python:3.9 | ||
FROM mcr.microsoft.com/vscode/devcontainers/python:0-3.10@sha256:ef9cc483a593c95e1e83f2cf00b6a0e1ec7df43344416a41ccb3a88aef27beac | ||
|
||
ARG USERNAME=vscode | ||
ARG USER_UID=1000 | ||
ARG USER_GID=$USER_UID | ||
ARG KUBENS_VERSION="0.9.4" | ||
ARG OCTANT_VERSION="0.25.1" | ||
ENV POETRY_VERSION="1.7.1" | ||
|
||
# Install packages | ||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
postgresql-client \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN apt-get update \ | ||
&& apt-get -y install --no-install-recommends apt-utils 2>&1 \ | ||
&& apt-get -y install git openssh-client less iproute2 procps lsb-release libsodium-dev \ | ||
&& groupadd --gid $USER_GID $USERNAME \ | ||
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \ | ||
&& apt-get install -y sudo \ | ||
&& apt-get -y install curl unzip net-tools emacs fd-find exa \ | ||
&& apt-get -y install manpages man-db tldr \ | ||
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\ | ||
&& chmod 0440 /etc/sudoers.d/$USERNAME \ | ||
&& apt-get -y install --no-install-recommends \ | ||
apt-utils \ | ||
postgresql-client \ | ||
2>&1 \ | ||
&& apt-get -y install \ | ||
curl \ | ||
dnsutils \ | ||
emacs \ | ||
exa \ | ||
fd-find \ | ||
git \ | ||
iproute2 \ | ||
less \ | ||
libsodium-dev \ | ||
lsb-release \ | ||
man-db \ | ||
manpages \ | ||
net-tools \ | ||
nodejs \ | ||
npm \ | ||
openssh-client \ | ||
procps \ | ||
sudo \ | ||
tldr \ | ||
unzip \ | ||
vim \ | ||
libgtk2.0-0 \ | ||
libgtk-3-0 \ | ||
libgbm-dev \ | ||
libnotify-dev \ | ||
libgconf-2-4 \ | ||
libnss3 \ | ||
libxss1 \ | ||
libasound2 \ | ||
libxtst6 \ | ||
xauth \ | ||
xvfb \ | ||
&& apt-get autoremove -y \ | ||
&& apt-get clean -y \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN curl -O -J -L https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/FiraMono.zip \ | ||
&& unzip FiraMono.zip -d ~/.fonts \ | ||
&& rm FiraMono.zip \ | ||
&& fc-cache -fv | ||
# Upgrade pip | ||
RUN pip install --upgrade pip | ||
|
||
RUN curl -fsSL https://starship.rs/install.sh | bash -s -- -y | ||
# Install kubens | ||
RUN git clone -b v${KUBENS_VERSION} --single-branch https://github.com/ahmetb/kubectx /opt/kubectx \ | ||
&& ln -s /opt/kubectx/kubectx /usr/local/bin/kubectx \ | ||
&& ln -s /opt/kubectx/kubens /usr/local/bin/kubens | ||
|
||
COPY .devcontainer/scripts/notify-dev-entrypoint.sh /usr/local/bin/ | ||
# Install Octant | ||
RUN curl -Lo octant.tar.gz https://github.com/vmware-tanzu/octant/releases/download/v${OCTANT_VERSION}/octant_${OCTANT_VERSION}_Linux-64bit.tar.gz \ | ||
&& tar -xvf octant.tar.gz \ | ||
&& mv octant_${OCTANT_VERSION}_Linux-64bit/octant /usr/local/bin/ \ | ||
&& rm -rf octant_${OCTANT_VERSION}_Linux-64bit | ||
|
||
EXPOSE 8000 | ||
COPY .devcontainer/scripts/notify-dev-entrypoint.sh /usr/local/bin/ | ||
|
||
RUN python -m pip install wheel | ||
ENV SHELL /bin/zsh | ||
|
||
RUN echo "eval '$(starship init bash)'" >> /root/.bashrc | ||
EXPOSE 8000 | ||
EXPOSE 6011 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,65 @@ | ||
{ | ||
"name": "Python 3.9 & PostgreSQL", | ||
"name": "notification-api", | ||
"dockerComposeFile": "docker-compose.yml", | ||
"service": "dev", | ||
"workspaceFolder": "/workspace", | ||
|
||
"settings": { | ||
"python.linting.enabled": true, | ||
"python.linting.pylintEnabled": true, | ||
"python.linting.pylintPath": "/usr/local/bin/pylint", | ||
"python.pythonPath": "/usr/local/bin/python", | ||
"terminal.integrated.shell.linux": "/bin/bash", | ||
"terminal.integrated.fontFamily": "FiraCode Nerd Font Mono" | ||
"shutdownAction": "stopCompose", | ||
"remoteEnv": { | ||
"PATH": "/home/vscode/.local/bin:${containerEnv:PATH}" // give our installed Python modules precedence | ||
}, | ||
|
||
"extensions": [ | ||
"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", | ||
"googlecloudtools.cloudcode" | ||
] | ||
} | ||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"[python]": { | ||
"editor.formatOnSave": true | ||
}, | ||
"python.formatting.blackPath": "/usr/local/bin/black", | ||
"python.linting.enabled": true, | ||
"python.linting.pylintEnabled": true, | ||
"python.linting.pylintPath": "/usr/local/bin/pylint", | ||
"python.pythonPath": "/usr/local/bin/python" | ||
}, | ||
"extensions": [ | ||
"bungcip.better-toml", | ||
"donjayamanne.python-extension-pack", | ||
"eamodio.gitlens", | ||
"GitHub.copilot", | ||
"GitHub.copilot-labs", | ||
"googlecloudtools.cloudcode", | ||
"kaiwood.center-editor-window", | ||
"matangover.mypy", | ||
"ms-azuretools.vscode-docker", | ||
"ms-ossdata.vscode-postgresql", | ||
"ms-python.python", | ||
"ms-python.vscode-pylance", | ||
"ms-vsliveshare.vsliveshare", | ||
"mtxr.sqltools", | ||
"mtxr.sqltools-driver-pg", | ||
"pmbenjamin.vscode-snyk", | ||
"timonwong.shellcheck", | ||
"usernamehw.errorlens", | ||
"visualstudioexptteam.vscodeintellicode", | ||
"wenfangdu.jump", | ||
"wholroyd.jinja", | ||
"yzhang.markdown-all-in-one" | ||
] | ||
} | ||
}, | ||
"features": { | ||
"docker-from-docker": { | ||
"version": "latest", | ||
"moby": true | ||
}, | ||
"kubectl-helm-minikube": { | ||
"version": "latest", | ||
"helm": "latest", | ||
"minikube": "none" | ||
}, | ||
"ghcr.io/devcontainers/features/node:1": { | ||
"version": "14.17.4" | ||
} | ||
}, | ||
"postCreateCommand": "notify-dev-entrypoint.sh", | ||
"remoteUser": "vscode", | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,57 @@ | ||
#!/bin/bash | ||
set -ex | ||
set -ex | ||
|
||
################################################################### | ||
# This script will get executed *once* the Docker container has | ||
# 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. | ||
# tools and the filesystem mount enabled should be located here. | ||
################################################################### | ||
|
||
# We want to enable broadcast message which by default is disabled. | ||
sed '/mesg/d' ~/.profile > ~/.profile.bak && mv ~/.profile.bak ~/.profile | ||
echo -e "\ntest -t 0 && mesg n" >> ~/.profile | ||
|
||
# Define aliases | ||
echo -e "\n\n# User's Aliases" >> ~/.profile | ||
echo -e "alias fd=fdfind" >> ~/.profile | ||
echo -e "alias l='ls -al --color'" >> ~/.profile | ||
echo -e "alias ls='exa'" >> ~/.profile | ||
echo -e "alias l='exa -alh'" >> ~/.profile | ||
echo -e "alias ll='exa -alh@ --git'" >> ~/.profile | ||
echo -e "alias lt='exa -al -T -L 2'" >> ~/.profile | ||
|
||
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 | ||
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 | ||
|
||
# Smoke test | ||
# requires adding files .env_staging and .env_prod to the root of the project | ||
echo -e "alias smoke-local='cd /workspace && cp .env_smoke_local tests_smoke/.env && poetry run make smoke-test-local'" >> ~/.zshrc | ||
echo -e "alias smoke-staging='cd /workspace && cp .env_smoke_staging tests_smoke/.env && poetry run make smoke-test'" >> ~/.zshrc | ||
echo -e "alias smoke-prod='cd /workspace && cp .env_smoke_prod tests_smoke/.env && poetry run make smoke-test'" >> ~/.zshrc | ||
|
||
cd /workspace | ||
|
||
# Poetry autocomplete | ||
echo -e "fpath+=/.zfunc" >> ~/.zshrc | ||
echo -e "autoload -Uz compinit && compinit" | ||
|
||
pip install poetry==${POETRY_VERSION} | ||
export PATH=$PATH:/home/vscode/.local/bin/ | ||
which poetry | ||
poetry --version | ||
|
||
# Initialize poetry autocompletions | ||
mkdir ~/.zfunc | ||
touch ~/.zfunc/_poetry | ||
poetry completions zsh > ~/.zfunc/_poetry | ||
|
||
make generate-version-file | ||
pip3 install -r requirements.txt | ||
pip3 install -r requirements_for_test.txt | ||
|
||
# Upgrade schema of the notification_api database. | ||
flask db upgrade | ||
# Install dependencies | ||
poetry install | ||
|
||
wall "The dev container entrypoint setup is complete!" | ||
# Upgrade schema of the notification_api database. | ||
poetry run flask db upgrade | ||
|
||
# Bubble up the main Docker command to container. | ||
exec "$@" | ||
# install npm deps (i.e. cypress) | ||
cd tests_cypress && npm install && npx cypress install && cd .. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
NOTIFY_ENVIRONMENT=development | ||
|
||
REDIS_ENABLED="1" | ||
REDIS_URL=redis://host.docker.internal:6380 | ||
|
||
FF_REDIS_BATCH_SAVING=true | ||
FF_BATCH_INSERTION=true | ||
FF_PRIORITY_LANES=true |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.