Skip to content
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

Use AWS Container Registry instead of DockerHub #942

Merged
merged 5 commits into from
Nov 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
OSPC_ANACONDA_TOKEN := `cat ~/.ospc_anaconda_token`
NEW_RELIC_TOKEN := `cat ~/.newrelic-$(VERSION)`
NEW_RELIC_TOKEN := `cat ~/.newrelic-$(MODE)`

dist-build:
cd distributed && \
docker build -t opensourcepolicycenter/distributed:$(TAG) ./ --build-arg PUF_TOKEN=$(OSPC_ANACONDA_TOKEN) && \
docker build --no-cache --build-arg TAG=$(TAG) -t opensourcepolicycenter/flask:$(TAG) --file Dockerfile.flask ./ && \
docker build --no-cache --build-arg TAG=$(TAG) -t opensourcepolicycenter/celery:$(TAG) --file Dockerfile.celery ./
docker build -t distributed:$(TAG) ./ --build-arg PUF_TOKEN=$(OSPC_ANACONDA_TOKEN) && \
docker build --no-cache --build-arg TAG=$(TAG) -t flask:$(TAG) --file Dockerfile.flask ./ && \
docker build --no-cache --build-arg TAG=$(TAG) -t celery:$(TAG) --file Dockerfile.celery ./

dist-push:
cd distributed && \
docker push opensourcepolicycenter/distributed:$(TAG) && \
docker push opensourcepolicycenter/flask:$(TAG) && \
docker push opensourcepolicycenter/celery:$(TAG)
docker tag distributed:$(TAG) $(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com/distributed:$(TAG) && \
docker tag flask:$(TAG) $(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com/flask:$(TAG) && \
docker tag celery:$(TAG) $(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com/celery:$(TAG) && \
docker push $(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com/distributed:$(TAG) && \
docker push $(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com/flask:$(TAG) && \
docker push $(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com/celery:$(TAG)

dist-test:
cd distributed && \
Expand All @@ -20,12 +23,11 @@ dist-test:
docker-compose rm -f

webapp-build:
docker build --build-arg NEW_RELIC_TOKEN=$(NEW_RELIC_TOKEN) -t opensourcepolicycenter/web:$(TAG) ./
docker build --build-arg NEW_RELIC_TOKEN=$(NEW_RELIC_TOKEN) -t web:$(TAG) ./

webapp-push:
docker tag opensourcepolicycenter/web:$(TAG) registry.heroku.com/ospc-$(VERSION)/web
docker push registry.heroku.com/ospc-$(VERSION)/web
docker push opensourcepolicycenter/web:$(TAG)
docker tag ospc-web:$(TAG) registry.heroku.com/ospc-$(MODE)/web
docker push registry.heroku.com/ospc-$(MODE)/web

webapp-release:
heroku container:release web -a ospc-$(VERSION)
heroku container:release web -a ospc-$(MODE)
1 change: 1 addition & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Release 1.7.4 on 2018-11-06
- None

**Minor Changes**
- [#942](https://github.com/ospc-org/ospc.org/pull/939) - Use AWS Container Registry instead of DockerHub #942 - Hank Doupe
- [#939](https://github.com/ospc-org/ospc.org/pull/939) - Update to Tax-Calculator 0.22.2 - Hank Doupe

**Bug Fixes**
Expand Down
2 changes: 1 addition & 1 deletion distributed/Dockerfile.celery
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG TAG
FROM opensourcepolicycenter/distributed:$TAG
FROM distributed:$TAG

ENV CELERY_BROKER_URL redis://redis:6379/0
ENV CELERY_RESULT_BACKEND redis://redis:6379/0
Expand Down
2 changes: 1 addition & 1 deletion distributed/Dockerfile.flask
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG TAG
FROM opensourcepolicycenter/distributed:$TAG
FROM distributed:$TAG

LABEL build="flask" date="2018-06-13"

Expand Down
29 changes: 29 additions & 0 deletions distributed/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Distributed deploy instructions

1. Build and push images to AWS container registry
```
export TAG= AWS_ACCOUNT_ID= AWS_REGION=
rm -rf PolicyBrain
git clone https://github.com/OpenSourcePolicyCenter/PolicyBrain
cd PolicyBrain
git fetch origin
git checkout -b $TAG $TAG
make dist-build && make dist-push
```


2. Pull distributed images to AWS server
```
sudo docker-compose down
sudo docker-compose rm
docker system prune --all
sudo apt-get install awscli
sudo apt-get install python3-pip
pip3 install --upgrade awscli
aws configure
sudo $AWS_ACCOUNT_ID= $AWS_REGION=
sudo $(aws ecr get-login --region $AWS_REGION --no-include-email)
sudo REPO=$AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com TAG=$TAG
sudo docker-compose up -d
```
4 changes: 2 additions & 2 deletions distributed/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
version: '3'
services:
flask:
image: "opensourcepolicycenter/flask:${TAG}"
image: "${REPO}/flask:${TAG}"
ports:
- 5050:5050
depends_on:
- redis
- celery
celery:
image: "opensourcepolicycenter/celery:${TAG}"
image: "${REPO}/celery:${TAG}"
depends_on:
- redis
redis:
Expand Down