-
Notifications
You must be signed in to change notification settings - Fork 11
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
Ease development with Docker #57
Open
aaronjwood
wants to merge
1
commit into
JPHutchins:master
Choose a base branch
from
aaronjwood:docker
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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 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 |
---|---|---|
@@ -0,0 +1,103 @@ | ||
version: "3.9" | ||
services: | ||
rabbitmq: | ||
container_name: oev-rabbit | ||
image: rabbitmq:3.11-alpine | ||
ports: | ||
- "5672:5672" | ||
- "15672:15672" | ||
hostname: "rabbitmq" # Important for how persistence works. | ||
volumes: | ||
- oev-rabbit:/var/lib/rabbitmq | ||
rabbitmqsetup: | ||
image: rabbitmq:3.11-alpine | ||
restart: "no" | ||
entrypoint: ["bash", "-c", "sleep 10 && rabbitmqctl -n rabbit@rabbitmq add_user jp admin && rabbitmqctl -n rabbit@rabbitmq set_user_tags jp administrator && rabbitmqctl -n rabbit@rabbitmq add_vhost myvhost && rabbitmqctl -n rabbit@rabbitmq set_permissions -p myvhost jp \".*\" \".*\" \".*\""] | ||
volumes: | ||
- oev-rabbit:/var/lib/rabbitmq | ||
depends_on: | ||
- rabbitmq # Make use of the cookie in the main container so we can run rabbitmqctl commands. | ||
app: | ||
container_name: oev | ||
build: | ||
context: ./ | ||
dockerfile: ./docker/Dockerfile-app | ||
ports: | ||
- "5000:5000" | ||
environment: | ||
- FLASK_CONFIG=config.DevConfig | ||
- FLASK_APP=open_energy_view | ||
- FLASK_ENV=production | ||
- SECRET_KEY=dev | ||
- JWT_SECRET_KEY=dev | ||
- JWT_BLACKLIST_ENABLED=True | ||
- JWT_TOKEN_LOCATION=cookies | ||
- JWT_ACCESS_COOKIE_PATH=/ | ||
- JWT_REFRESH_COOKIE_PATH=/api/web/token/refresh | ||
- JWT_COOKIE_CSRF_PROTECT=True | ||
- PROD_JWT_COOKIE_SECURE=True | ||
- DEV_JWT_COOKIE_SECURE=False | ||
- PROD_DATABASE_URI=sqlite:///../test/data/energy_history_test.db | ||
- DEV_DATABASE_URI=sqlite:///../test/data/energy_history_test.db | ||
- PGE_CLIENT_ID=client_id | ||
- PGE_CLIENT_SECRET=client_secret | ||
- GOOGLE_CLIENT_ID=GOOGLE_CLIENT_ID | ||
- GOOGLE_CLIENT_SECRET=GOOGLE_CLIENT_SECRET | ||
- OAUTHLIB_INSECURE_TRANSPORT=True | ||
- CERT_PATH=test/cert/cert.crt | ||
- KEY_PATH=test/cert/private.key | ||
- API_RESPONSE_KEY=xS5MqJ6N9CyH-hvqAGrmBVAxFMOyauMpdrdqCZa1eqo= | ||
- PORT=5000 | ||
depends_on: | ||
- rabbitmqsetup | ||
cpu-worker: | ||
restart: unless-stopped | ||
container_name: oev-cpu-worker | ||
build: | ||
context: ./ | ||
dockerfile: ./docker/Dockerfile-worker | ||
environment: | ||
- HOSTNAME=celery.cpus@%h | ||
- QUEUES=cpu | ||
- CONCURRENCY=1 | ||
- POOL=prefork | ||
- FLASK_CONFIG=config.DevConfig | ||
- FLASK_APP=open_energy_view | ||
- FLASK_ENV=production | ||
- SECRET_KEY=dev | ||
- JWT_SECRET_KEY=dev | ||
- JWT_BLACKLIST_ENABLED=True | ||
- JWT_TOKEN_LOCATION=cookies | ||
- JWT_ACCESS_COOKIE_PATH=/ | ||
- JWT_REFRESH_COOKIE_PATH=/api/web/token/refresh | ||
- JWT_COOKIE_CSRF_PROTECT=True | ||
- PROD_JWT_COOKIE_SECURE=True | ||
- DEV_JWT_COOKIE_SECURE=False | ||
- PROD_DATABASE_URI=sqlite:///../test/data/energy_history_test.db | ||
- DEV_DATABASE_URI=sqlite:///../test/data/energy_history_test.db | ||
- PGE_CLIENT_ID=client_id | ||
- PGE_CLIENT_SECRET=client_secret | ||
- GOOGLE_CLIENT_ID=GOOGLE_CLIENT_ID | ||
- GOOGLE_CLIENT_SECRET=GOOGLE_CLIENT_SECRET | ||
- OAUTHLIB_INSECURE_TRANSPORT=True | ||
- CERT_PATH=test/cert/cert.crt | ||
- KEY_PATH=test/cert/private.key | ||
- API_RESPONSE_KEY=xS5MqJ6N9CyH-hvqAGrmBVAxFMOyauMpdrdqCZa1eqo= | ||
- PORT=5000 | ||
depends_on: | ||
- app | ||
io-worker: | ||
restart: unless-stopped | ||
container_name: oev-io-worker | ||
build: | ||
context: ./ | ||
dockerfile: ./docker/Dockerfile-worker | ||
environment: | ||
- HOSTNAME=celery.io@%h | ||
- QUEUES=io | ||
- CONCURRENCY=500 | ||
- POOL=gevent | ||
depends_on: | ||
- app | ||
volumes: | ||
oev-rabbit: |
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,14 @@ | ||
FROM node:10.19.0-slim AS ui | ||
ADD open_energy_view/frontend /frontend | ||
WORKDIR /frontend | ||
RUN npm ci && npm run build | ||
|
||
FROM python:3.8-slim | ||
ADD . /app | ||
WORKDIR /app | ||
RUN apt update && apt install -y build-essential | ||
RUN pip3 install -r ./requirements.txt | ||
RUN apt purge -y build-essential | ||
COPY --from=ui /frontend/dist /app/open_energy_view/frontend/dist | ||
COPY --from=ui /frontend/node_modules /app/open_energy_view/frontend/node_modules | ||
ENTRYPOINT uwsgi --http 0.0.0.0:"$PORT" --gevent 100 --wsgi-file wsgi.py --callable app |
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,2 @@ | ||
FROM open-energy-view_app | ||
ENTRYPOINT celery worker --app open_energy_view.celery_tasks --hostname="$HOSTNAME" --queues="$QUEUES" --loglevel=info --pool="$POOL" --concurrency="$CONCURRENCY" |
Binary file not shown.
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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
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.
@JPHutchins what do you think about moving to PyPy for the JIT sweetness?