Skip to content

Commit

Permalink
Deploys phoenix to production (#14)
Browse files Browse the repository at this point in the history
* adds config to deploy to s3

* removes datasources not needed

* fixes vulnerabilities

* adds express for healthcheck

* adds prisma deployment for production

* adds sample env file for phoenix

* Adds deployment to AWS
  • Loading branch information
utkarsh867 authored Oct 7, 2019
1 parent 8dad56f commit 3ca7ae0
Show file tree
Hide file tree
Showing 17 changed files with 327 additions and 137 deletions.
2 changes: 2 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PRISMA_HOST=
PRISMA_SECRET=
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ node_modules/
.idea

.env
.env.prod
prisma/.env
env.db

Expand Down
22 changes: 21 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
language: node_js
node_js:
- "10"

cache:
npm: true

services:
- docker

Expand All @@ -9,6 +13,11 @@ before_install:
- npm install
- docker-compose -f prisma/docker-compose.yml up -d

stages:
- test
- build
- deploy

jobs:
include:
- stage: test
Expand All @@ -20,4 +29,15 @@ jobs:
- stage: build
script:
- cd prisma && prisma generate && prisma deploy
- npm run build
- npm run build

- stage: deploy
script:
- cd prisma && prisma generate && prisma deploy && cd ..
- npm run build
- pip install --user awscli
- export PATH=$PATH:$HOME/.local/bin
- docker login --username $DOCKER_USER -p $DOCKER_PASS
- docker build -t rctechclub/phoenix:dev .
- docker push rctechclub/phoenix:dev
- aws ecs update-service --cluster phoenix-prod --service phoenix --force-new-deployment --region us-east-2
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:10
FROM node:10-alpine
WORKDIR usr/src/app
COPY package.json .
RUN npm install
Expand Down
5 changes: 2 additions & 3 deletions __tests__/users.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import * as env from 'dotenv';
env.config();
import { prisma } from '../src/generated/prisma-client';
import typeDefs from '../src/schema';
import resolvers from '../src/resolvers';
import * as env from 'dotenv';

const { ApolloServer, gql } = require('apollo-server');
const { createTestClient } = require('apollo-server-testing');

env.config();

const prepareServer = async () => {
return new ApolloServer({
typeDefs,
Expand Down
2 changes: 2 additions & 0 deletions __tests__/washers.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as env from 'dotenv';
env.config();
import typeDefs from '../src/schema';
import resolvers from '../src/resolvers';
import { prisma } from '../src/generated/prisma-client';
Expand Down
10 changes: 0 additions & 10 deletions docker-compose.yml

This file was deleted.

Loading

0 comments on commit 3ca7ae0

Please sign in to comment.