Skip to content

Commit

Permalink
chore: move deployment to google cloud run
Browse files Browse the repository at this point in the history
  • Loading branch information
ForbesLindesay committed Jan 16, 2022
1 parent 95a6f29 commit 41a7b9b
Show file tree
Hide file tree
Showing 26 changed files with 514 additions and 1,287 deletions.
113 changes: 2 additions & 111 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,79 +1,14 @@
version: 2.1

orbs:
kubernetes: circleci/[email protected]

refs:
- &only_master
filters:
branches:
only: master

- &not_master
filters:
branches:
ignore: master

workflows:
test:
jobs:
- unit-tests:
<<: *not_master

- staging-approval:
<<: *not_master
type: approval

- deploy-staging:
<<: *not_master
requires:
- staging-approval

release:
jobs:
- deploy-staging:
<<: *only_master

- production-approval:
type: approval
requires:
- deploy-staging

- deploy-production:
<<: *only_master
requires:
- production-approval
- unit-tests

jobs:
unit-tests:
docker:
- image: circleci/node:12.18.2
steps:
- setup

deploy-staging:
docker:
- image: circleci/node:12.18.2
steps:
- setup
- push
- deploy:
environment: staging
- run: node test staging

deploy-production:
docker:
- image: circleci/node:12.18.2
steps:
- setup
- run: node test staging
- deploy:
environment: production
- run: node test production

commands:
setup:
description: 'Checkout and install dependencies'
- image: circleci/node:14.18.3
steps:
- checkout
- run:
Expand All @@ -85,47 +20,3 @@ commands:
- run:
name: Build
command: yarn build

npm_auth:
description: 'Authenticate with the npm registry'
steps:
- run:
name: Authenticate with registry
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc

push:
steps:
- setup_remote_docker
- run:
name: Build Docker
command: docker build -t $DOCKERHUB_USERNAME/esdiscuss:$CIRCLE_SHA1 .
- run:
name: Authenticate
command: echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
- run:
name: Push Docker
command: docker push $DOCKERHUB_USERNAME/esdiscuss:$CIRCLE_SHA1

deploy:
parameters:
environment:
type: enum
enum: ['staging', 'production']
steps:
- kubernetes/install
- run:
name: Copy certificate
command: echo "$KUBERNETES_CLUSTER_CERTIFICATE" | base64 --decode > cert.crt
- run:
name: Deploy to Kubernetes
command: |
ENVIRONMENT=<< parameters.environment >> npx jskube apply \
--kubeconfig=/dev/null \
-f .kube/deployment.ts
- run:
name: Wait for rollout to complete
command: |
npx jskube rollout status \
deployment/esdiscuss-<< parameters.environment >> \
--namespace esdiscuss \
--kubeconfig=/dev/null
11 changes: 11 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*
!package.json
!yarn.lock
!build
!lib
!static
!favicon.ico
!profiles.json

lib/*.d.ts
lib/*.js.map
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ environment.toml

lib/

.env
.env
/build/
1 change: 0 additions & 1 deletion .kube/.gitignore

This file was deleted.

20 changes: 0 additions & 20 deletions .kube/createConfigMap.ts

This file was deleted.

102 changes: 0 additions & 102 deletions .kube/createDeployment.ts

This file was deleted.

72 changes: 0 additions & 72 deletions .kube/createIngress.ts

This file was deleted.

21 changes: 0 additions & 21 deletions .kube/createSecrets.ts

This file was deleted.

Loading

0 comments on commit 41a7b9b

Please sign in to comment.