-
Notifications
You must be signed in to change notification settings - Fork 8
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
Improve deployment #143
Merged
Merged
Improve deployment #143
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
5f17e82
build(docker): move dockerfile and add compose file
274ceec
refactor(airflow): change airflow home file path
63be6a6
fix(dags): broken attachment file path
11c0fc8
build(airflow): set airflow home env variable
430ee50
fix(airflow): not load example dags
0ba4446
build(docker): configurable airflow and python version
664a56f
build(pip): solve requirements from poetry and install dependencies f…
514fc95
build(docker): file path
20ed3e8
build(pip): update deps
6e3d0ef
fix(pip): solve some deps runtime error
9743a70
build(docker): add entrypoint script
3b2d034
build(docker): update compose files
b208a82
fix(airflow): update env template
dd52d9a
build(makefile): add deployment alias
5837994
docs(project): update README, add contribute, maintain, and deploymen…
2a67908
build(npm): remove un-used config files
8ede6cb
fix(project): misc
5166cde
docs(project): add more contributing steps
04b1242
build(ci): restore docker image ci config change
eddf1bc
build(docker): restore and change test dockerfile
7a5c76d
fix(docker): create fernet key if not exists
c563ae4
build(project): use pip and constraint file to manage deps
b283f66
fix(docker): not upgrade pip
309058f
docs(project): update README
a161d16
fix(docker): add env variable check on entry script
5f58673
fix(ods): questionnaire test error
fc16627
docs(project): misc
8b0e911
build(docker): create fernet key if not exists
34874b1
docs(project): misc
1ed4c1b
refactor(dags): tpying
185dfdf
build(python): remove poetry and move dev deps to another requiremens…
d3d72bf
docs(project): add venv setup guide
45cdf8f
docs(project): change production project path
de60e7d
ci(python): install dependencies with pip
7b0bfeb
fix(project): upgrade airflow to v1.10.15
6783283
style(project): reformat
3dfdb09
style(project): recover pyproject.toml style rule
e5f4375
style(project): reformat
b047fa1
ci(docker): use gcp artifact-registry
16e015a
docs(project): update
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,4 +1,4 @@ | ||
# get the complete env from other volunteers, please | ||
AIRFLOW_HOME=/opt/airflow | ||
BIGQUERY_PROJECT=pycontw-225217 | ||
DATATEAM_DISCORD_WEBHOOK=<> | ||
GOOGLE_APPLICATION_CREDENTIALS=/usr/local/airflow/service-account.json | ||
GOOGLE_APPLICATION_CREDENTIALS=/opt/airflow/service-account.json | ||
AIRFLOW__CORE__FERNET_KEY=paste-your-fernet-key-here |
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,4 +1,5 @@ | ||
# project stuff | ||
.env.production | ||
.env.staging | ||
env | ||
env.sh | ||
|
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,5 +1,36 @@ | ||
FROM davidtnfsh/pycon_etl:prod | ||
ENV AIRFLOW_TEST_MODE=True | ||
ENV FERNET_KEY="uMnRC6ingT/WjPzPiXLvbWTJYzaA3sJdJRVkinceVp4=" | ||
ARG AIRFLOW_VERSION=1.10.15 | ||
ARG PYTHON_VERSION=3.8 | ||
|
||
FROM apache/airflow:${AIRFLOW_VERSION}-python${PYTHON_VERSION} | ||
|
||
USER root | ||
COPY airflow.test.cfg airflow.cfg | ||
|
||
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 467B942D3A79BD29 \ | ||
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-keys B7B3B788A8D3785C \ | ||
&& apt-get update \ | ||
&& apt-get install -y --no-install-recommends git \ | ||
# 1. if you don't need postgres, remember to remove postgresql-dev and sqlalchemy | ||
# 2. libglib2.0-0 libsm6 libxext6 libxrender-dev libgl1-mesa-dev are required by opencv | ||
# 3. git is required by pip install git+https | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY entrypoint.sh /entrypoint.sh | ||
|
||
RUN chmod +x /entrypoint.sh | ||
|
||
USER airflow | ||
|
||
COPY ./requirements.txt ${AIRFLOW_HOME}/requirements.txt | ||
COPY ./requirements-dev.txt ${AIRFLOW_HOME}/requirements-dev.txt | ||
COPY ./constraints-3.8.txt ${AIRFLOW_HOME}/constraints-3.8.txt | ||
|
||
RUN pip install --no-cache-dir -r ${AIRFLOW_HOME}/requirements.txt -r ${AIRFLOW_HOME}/requirements-dev.txt --constraint constraints-3.8.txt | ||
|
||
COPY airflow.cfg ${AIRFLOW_HOME}/airflow.cfg | ||
|
||
COPY --chown=airflow:root dags ${AIRFLOW_HOME}/dags | ||
|
||
ENV AIRFLOW_TEST_MODE=True | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
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,17 +1,30 @@ | ||
VENV_PREFIX=poetry run | ||
|
||
lint: | ||
$(VENV_PREFIX) black . --check | ||
$(VENV_PREFIX) isort --check-only . | ||
$(VENV_PREFIX) flake8 . | ||
$(VENV_PREFIX) mypy dags/ tests/ | ||
black . --check | ||
isort --check-only . | ||
flake8 . | ||
mypy dags/ tests/ | ||
|
||
format: | ||
$(VENV_PREFIX) black . | ||
$(VENV_PREFIX) isort . | ||
black . | ||
isort . | ||
|
||
test: | ||
PYTHONPATH=./dags $(VENV_PREFIX) pytest | ||
PYTHONPATH=./dags pytest | ||
|
||
coverage: | ||
PYTHONPATH=./dags $(VENV_PREFIX) pytest --cov=dags tests | ||
PYTHONPATH=./dags pytest --cov=dags tests | ||
|
||
build-dev: | ||
docker-compose -f ./docker-compose-dev.yml build | ||
|
||
deploy-dev: | ||
docker-compose -f ./docker-compose-dev.yml up -d | ||
|
||
down-dev: | ||
docker-compose -f ./docker-compose-dev.yml down | ||
|
||
deploy-prod: | ||
docker-compose -f ./docker-compose.yml up -d | ||
|
||
down-prod: | ||
docker-compose -f ./docker-compose.yml down |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: I feel this might be something we should make it configurable. 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is AIRFLOW_HOME redundant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, I mean BIGQUERY_PROJECT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
developer may use their own GCP project for testing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that's why I think making it configurable might be a good idea. WDYT?