Skip to content
This repository has been archived by the owner on May 23, 2019. It is now read-only.

Commit

Permalink
Add AWS control scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
avowkind committed Mar 22, 2019
1 parent 885a4e8 commit a82acd0
Show file tree
Hide file tree
Showing 13 changed files with 50 additions and 17 deletions.
17 changes: 17 additions & 0 deletions aws/buildimage
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Build a docker image for the application and place in the Amazon ECR container repository
# AVW March 2019
# run this in order to release a new version to production.
# after the build update the service on the cluster.

# Get a docker login and run it
$(aws ecr get-login --no-include-email --region ap-southeast-1)

# build the docker image
docker build -t vly1-main-repo .

# tag the image
docker tag vly1-main-repo:latest 585172581592.dkr.ecr.ap-southeast-1.amazonaws.com/vly1-main-repo:latest

# push to the repository
docker push 585172581592.dkr.ecr.ap-southeast-1.amazonaws.com/vly1-main-repo:latest

6 changes: 6 additions & 0 deletions aws/cluster-down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# use the ecs-cli command line to start a new cluster with the given instance type and count
# -f force down previous cluster.
# warning this will take down the services for about 10 minutes.
# to run this you will need the vly1 private key.
# usage: cluster up|down
ecs-cli up --keypair vly1 --capability-iam --size 1 --instance-type t2.small --cluster-config default -f
6 changes: 6 additions & 0 deletions aws/cluster-up
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# use the ecs-cli command line to start a new cluster with the given instance type and count
# -f force down previous cluster.
# warning this will take down the services for about 10 minutes.
# to run this you will need the vly1 private key.
# usage: cluster up|down
ecs-cli $1 --keypair vly1 --capability-iam --size 1 --instance-type t2.small --cluster-config default -f
13 changes: 13 additions & 0 deletions aws/service
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# uses ECS command line to start the containers in the cluster based on the given docker compose yml file.
# this one starts production server using atlas database.
# will only work if you have an IAM account on AWS which is in our security group.
# and have setup local key etc.
# run this as
# source aws/service up
# source aws/service down
ecs-cli compose --verbose --file docker-compose-ecs-atlas.yml service $1

# note this creates a new task definition from the yml file and so you only really need to do this is the parameters have changed.
# Otherwise you should be able to deploy a new container by draining the stack and starting new instances.


5 changes: 0 additions & 5 deletions buildimage.sh

This file was deleted.

3 changes: 1 addition & 2 deletions client/modules/App/components/Header/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ Header.contextTypes = {
};

Header.propTypes = {
toggleAddPost: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
intl: PropTypes.object,
};

export default Header;
4 changes: 1 addition & 3 deletions docker-compose-ecs-atlas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ version: '3'
services:
web:
image: 585172581592.dkr.ecr.ap-southeast-1.amazonaws.com/vly1-main-repo:latest
depends_on:
- db
ports:
- "${WEB_PORT:-80}:8000"
environment:
NODE_ENV: production
MONGO_URL: mongodb+srv://vly-client:ZhF3BUDiwpy8C3xK@vly-cluster-1-dl1mj.mongodb.net/test?retryWrites=true
MONGO_URL: mongodb+srv://vly-client:ZhF3BUDiwpy8C3xK@cluster0-kwmsu.mongodb.net/vly-test?retryWrites=true

2 changes: 1 addition & 1 deletion docker-compose-ecs-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
- "${WEB_PORT:-80}:8000"
environment:
NODE_ENV: development
MONGO_URL: mongodb://db:27017/vly1
MONGO_URL: mongodb://db:27017/vly-dev
db:
image: mongo:latest
ports:
Expand Down
2 changes: 1 addition & 1 deletion docker-compose-ecs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
- "${WEB_PORT:-80}:8000"
environment:
NODE_ENV: production
MONGO_URL: mongodb+srv://vly-client:ZhF3BUDiwpy8C3xK@vly-cluster-1-dl1mj.mongodb.net/test?retryWrites=true
MONGO_URL: MONGO_URL: mongodb://db:27017/vly-dev
db:
image: mongo:latest
ports:
Expand Down
2 changes: 1 addition & 1 deletion docker-compose-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
- "${WEB_PORT:-80}:8000"
environment:
NODE_ENV: production
MONGO_URL: mongodb://db:27017/vly1
MONGO_URL: mongodb://db:27017/vly-prod
db:
image: mongo:latest
volumes:
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ services:
- ./webpack.config.server.js:/usr/src/app/webpack.config.server.js
environment:
NODE_ENV: development
MONGO_URL: mongodb://db:27017/vly1
MONGO_URL: mongodb://db:27017/vly-dev
stdin_open: true
tty: true
db:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.1",
"description": "MERN stack implementation of the Voluntari.ly service.",
"scripts": {
"test": "cross-env NODE_ENV=test PORT=8080 MONGO_URL=mongodb://localhost:27017/mern-test node_modules/.bin/nyc node node_modules/ava/cli.js",
"test": "cross-env NODE_ENV=test PORT=8080 MONGO_URL=mongodb://localhost:27017/vly-test node_modules/.bin/nyc node node_modules/ava/cli.js",
"watch:test": "npm run test -- --watch",
"cover": "nyc npm run test",
"check-coverage": "nyc check-coverage --statements 100 --branches 100 --functions 100 --lines 100",
Expand Down
3 changes: 1 addition & 2 deletions server/config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const config = {
mongoURL: process.env.MONGO_URL || 'mongodb+srv://vly-client:[email protected]/test?retryWrites=true',
// 'mongodb://localhost:27017/vly1',
mongoURL: process.env.MONGO_URL || 'mongodb://localhost:27017/vly-dev',
port: process.env.PORT || 8000,
};

Expand Down

0 comments on commit a82acd0

Please sign in to comment.