mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Rollout deployment
* Replace BACKEND_URL with GRAPHQL_URI environment (DRY) * Trigger rollout deployments by a simple label update * DRY configmap and secret configuration
This commit is contained in:
parent
b21cafb983
commit
c6d9ea052f
@ -47,6 +47,7 @@
|
|||||||
"cors": "~2.8.5",
|
"cors": "~2.8.5",
|
||||||
"cross-env": "~5.2.0",
|
"cross-env": "~5.2.0",
|
||||||
"date-fns": "2.0.0-alpha.27",
|
"date-fns": "2.0.0-alpha.27",
|
||||||
|
"debug": "~4.1.1",
|
||||||
"dotenv": "~7.0.0",
|
"dotenv": "~7.0.0",
|
||||||
"express": "~4.16.4",
|
"express": "~4.16.4",
|
||||||
"faker": "~4.1.0",
|
"faker": "~4.1.0",
|
||||||
@ -86,7 +87,6 @@
|
|||||||
"babel-jest": "~24.5.0",
|
"babel-jest": "~24.5.0",
|
||||||
"chai": "~4.2.0",
|
"chai": "~4.2.0",
|
||||||
"cucumber": "~5.1.0",
|
"cucumber": "~5.1.0",
|
||||||
"debug": "~4.1.1",
|
|
||||||
"eslint": "~5.15.1",
|
"eslint": "~5.15.1",
|
||||||
"eslint-config-standard": "~12.0.0",
|
"eslint-config-standard": "~12.0.0",
|
||||||
"eslint-plugin-import": "~2.16.0",
|
"eslint-plugin-import": "~2.16.0",
|
||||||
|
|||||||
@ -3,13 +3,13 @@
|
|||||||
kind: ConfigMap
|
kind: ConfigMap
|
||||||
data:
|
data:
|
||||||
GRAPHQL_PORT: "4000"
|
GRAPHQL_PORT: "4000"
|
||||||
GRAPHQL_URI: "https://nitro-staging.human-connection.org/api"
|
GRAPHQL_URI: "http://nitro-backend.human-connection:4000"
|
||||||
MOCK: "false"
|
MOCK: "false"
|
||||||
NEO4J_URI: "bolt://nitro-neo4j.human-connection:7687"
|
NEO4J_URI: "bolt://nitro-neo4j.human-connection:7687"
|
||||||
NEO4J_USER: "neo4j"
|
NEO4J_USER: "neo4j"
|
||||||
NEO4J_AUTH: none
|
NEO4J_AUTH: "none"
|
||||||
CLIENT_URI: "https://nitro-staging.human-connection.org"
|
CLIENT_URI: "https://nitro-staging.human-connection.org"
|
||||||
MAPBOX_TOKEN: pk.eyJ1IjoiaHVtYW4tY29ubmVjdGlvbiIsImEiOiJjajl0cnBubGoweTVlM3VwZ2lzNTNud3ZtIn0.KZ8KK9l70omjXbEkkbHGsQ
|
MAPBOX_TOKEN: "pk.eyJ1IjoiaHVtYW4tY29ubmVjdGlvbiIsImEiOiJjajl0cnBubGoweTVlM3VwZ2lzNTNud3ZtIn0.KZ8KK9l70omjXbEkkbHGsQ"
|
||||||
metadata:
|
metadata:
|
||||||
name: configmap
|
name: configmap
|
||||||
namespace: human-connection
|
namespace: human-connection
|
||||||
|
|||||||
@ -4,10 +4,16 @@
|
|||||||
metadata:
|
metadata:
|
||||||
name: nitro-backend
|
name: nitro-backend
|
||||||
namespace: human-connection
|
namespace: human-connection
|
||||||
|
labels:
|
||||||
|
commit: "COMMIT"
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
minReadySeconds: 15
|
minReadySeconds: 15
|
||||||
progressDeadlineSeconds: 60
|
progressDeadlineSeconds: 60
|
||||||
|
strategy:
|
||||||
|
rollingUpdate:
|
||||||
|
maxSurge: 0
|
||||||
|
maxUnavailable: "100%"
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
human-connection.org/selector: deployment-human-connection-backend
|
human-connection.org/selector: deployment-human-connection-backend
|
||||||
@ -23,42 +29,11 @@
|
|||||||
imagePullPolicy: Always
|
imagePullPolicy: Always
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 4000
|
- containerPort: 4000
|
||||||
env:
|
envFrom:
|
||||||
- name: COMMIT
|
- configMapRef:
|
||||||
value: <BACKEND_COMMIT>
|
name: configmap
|
||||||
- name: MOCK
|
- secretRef:
|
||||||
value: "false"
|
name: human-connection
|
||||||
- name: CLIENT_URI
|
|
||||||
valueFrom:
|
|
||||||
configMapKeyRef:
|
|
||||||
name: configmap
|
|
||||||
key: CLIENT_URI
|
|
||||||
- name: GRAPHQL_PORT
|
|
||||||
valueFrom:
|
|
||||||
configMapKeyRef:
|
|
||||||
name: configmap
|
|
||||||
key: GRAPHQL_PORT
|
|
||||||
- name: GRAPHQL_URI
|
|
||||||
valueFrom:
|
|
||||||
configMapKeyRef:
|
|
||||||
name: configmap
|
|
||||||
key: GRAPHQL_URI
|
|
||||||
- name: MAPBOX_TOKEN
|
|
||||||
valueFrom:
|
|
||||||
configMapKeyRef:
|
|
||||||
name: configmap
|
|
||||||
key: MAPBOX_TOKEN
|
|
||||||
- name: JWT_SECRET
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: human-connection
|
|
||||||
key: JWT_SECRET
|
|
||||||
optional: false
|
|
||||||
- name: NEO4J_URI
|
|
||||||
valueFrom:
|
|
||||||
configMapKeyRef:
|
|
||||||
name: configmap
|
|
||||||
key: NEO4J_URI
|
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- mountPath: /nitro-backend/public/uploads
|
- mountPath: /nitro-backend/public/uploads
|
||||||
name: uploads
|
name: uploads
|
||||||
|
|||||||
@ -6,7 +6,6 @@
|
|||||||
namespace: human-connection
|
namespace: human-connection
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
strategy: {}
|
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
human-connection.org/selector: deployment-human-connection-neo4j
|
human-connection.org/selector: deployment-human-connection-neo4j
|
||||||
@ -21,16 +20,12 @@
|
|||||||
image: humanconnection/neo4j:latest
|
image: humanconnection/neo4j:latest
|
||||||
imagePullPolicy: Always
|
imagePullPolicy: Always
|
||||||
env:
|
env:
|
||||||
- name: COMMIT
|
|
||||||
value: <BACKEND_COMMIT>
|
|
||||||
- name: NEO4J_apoc_import_file_enabled
|
- name: NEO4J_apoc_import_file_enabled
|
||||||
value: "true"
|
value: "true"
|
||||||
- name: NEO4J_dbms_memory_pagecache_size
|
- name: NEO4J_dbms_memory_pagecache_size
|
||||||
value: 1G
|
value: 1G
|
||||||
- name: NEO4J_dbms_memory_heap_max__size
|
- name: NEO4J_dbms_memory_heap_max__size
|
||||||
value: 1G
|
value: 1G
|
||||||
- name: NEO4J_AUTH
|
|
||||||
value: none
|
|
||||||
- name: NEO4J_URI
|
- name: NEO4J_URI
|
||||||
valueFrom:
|
valueFrom:
|
||||||
configMapKeyRef:
|
configMapKeyRef:
|
||||||
|
|||||||
@ -3,6 +3,8 @@ kind: Deployment
|
|||||||
metadata:
|
metadata:
|
||||||
name: nitro-web
|
name: nitro-web
|
||||||
namespace: human-connection
|
namespace: human-connection
|
||||||
|
labels:
|
||||||
|
commit: "COMMIT"
|
||||||
spec:
|
spec:
|
||||||
replicas: 2
|
replicas: 2
|
||||||
minReadySeconds: 15
|
minReadySeconds: 15
|
||||||
@ -18,27 +20,14 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: web
|
- name: web
|
||||||
|
envFrom:
|
||||||
|
- configMapRef:
|
||||||
|
name: configmap
|
||||||
|
- secretRef:
|
||||||
|
name: human-connection
|
||||||
env:
|
env:
|
||||||
- name: COMMIT
|
|
||||||
value: <WEBAPP_COMMIT>
|
|
||||||
- name: HOST
|
- name: HOST
|
||||||
value: 0.0.0.0
|
value: 0.0.0.0
|
||||||
- name: BACKEND_URL
|
|
||||||
valueFrom:
|
|
||||||
configMapKeyRef:
|
|
||||||
name: configmap
|
|
||||||
key: GRAPHQL_URI
|
|
||||||
- name: MAPBOX_TOKEN
|
|
||||||
valueFrom:
|
|
||||||
configMapKeyRef:
|
|
||||||
name: configmap
|
|
||||||
key: MAPBOX_TOKEN
|
|
||||||
- name: JWT_SECRET
|
|
||||||
valueFrom:
|
|
||||||
secretKeyRef:
|
|
||||||
name: human-connection
|
|
||||||
key: JWT_SECRET
|
|
||||||
optional: false
|
|
||||||
image: humanconnection/nitro-web:latest
|
image: humanconnection/nitro-web:latest
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 3000
|
- containerPort: 3000
|
||||||
|
|||||||
@ -10,10 +10,10 @@ metadata:
|
|||||||
spec:
|
spec:
|
||||||
tls:
|
tls:
|
||||||
- hosts:
|
- hosts:
|
||||||
- nitro-master.human-connection.org
|
- nitro-staging.human-connection.org
|
||||||
secretName: tls
|
secretName: tls
|
||||||
rules:
|
rules:
|
||||||
- host: nitro-master.human-connection.org
|
- host: nitro-staging.human-connection.org
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- path: /
|
- path: /
|
||||||
|
|||||||
@ -3,6 +3,7 @@ kind: Secret
|
|||||||
data:
|
data:
|
||||||
JWT_SECRET: "Yi8mJjdiNzhCRiZmdi9WZA=="
|
JWT_SECRET: "Yi8mJjdiNzhCRiZmdi9WZA=="
|
||||||
MONGODB_PASSWORD: "TU9OR09EQl9QQVNTV09SRA=="
|
MONGODB_PASSWORD: "TU9OR09EQl9QQVNTV09SRA=="
|
||||||
|
PRIVATE_KEY_PASSPHRASE: "YTdkc2Y3OHNhZGc4N2FkODdzZmFnc2FkZzc4"
|
||||||
metadata:
|
metadata:
|
||||||
name: human-connection
|
name: human-connection
|
||||||
namespace: human-connection
|
namespace: human-connection
|
||||||
|
|||||||
@ -12,7 +12,7 @@ services:
|
|||||||
context: webapp
|
context: webapp
|
||||||
target: build-and-test
|
target: build-and-test
|
||||||
environment:
|
environment:
|
||||||
- BACKEND_URL=http://backend:4123
|
- GRAPHQL_URI=http://backend:4123
|
||||||
backend:
|
backend:
|
||||||
image: humanconnection/nitro-backend:builder
|
image: humanconnection/nitro-backend:builder
|
||||||
build:
|
build:
|
||||||
|
|||||||
@ -13,7 +13,7 @@ services:
|
|||||||
- hc-network
|
- hc-network
|
||||||
environment:
|
environment:
|
||||||
- HOST=0.0.0.0
|
- HOST=0.0.0.0
|
||||||
- BACKEND_URL=http://backend:4000
|
- GRAPHQL_URI=http://backend:4000
|
||||||
- MAPBOX_TOKEN="pk.eyJ1IjoiaHVtYW4tY29ubmVjdGlvbiIsImEiOiJjajl0cnBubGoweTVlM3VwZ2lzNTNud3ZtIn0.bZ8KK9l70omjXbEkkbHGsQ"
|
- MAPBOX_TOKEN="pk.eyJ1IjoiaHVtYW4tY29ubmVjdGlvbiIsImEiOiJjajl0cnBubGoweTVlM3VwZ2lzNTNud3ZtIn0.bZ8KK9l70omjXbEkkbHGsQ"
|
||||||
backend:
|
backend:
|
||||||
image: humanconnection/nitro-backend:latest
|
image: humanconnection/nitro-backend:latest
|
||||||
|
|||||||
4
scripts/deploy.sh
Executable file
4
scripts/deploy.sh
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
sed -i "s/<COMMIT>/${TRAVIS_COMMIT}/g" patch-deployment.yaml
|
||||||
|
kubectl --namespace=human-connection patch deployment nitro-backend -p "$(cat patch-deployment.yaml)"
|
||||||
|
kubectl --namespace=human-connection patch deployment nitro-web -p "$(cat patch-deployment.yaml)"
|
||||||
3
scripts/patch-deployment.yaml
Normal file
3
scripts/patch-deployment.yaml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
commit: <COMMIT>
|
||||||
@ -6,5 +6,5 @@ services:
|
|||||||
context: .
|
context: .
|
||||||
target: build-and-test
|
target: build-and-test
|
||||||
environment:
|
environment:
|
||||||
- BACKEND_URL=http://backend:4123
|
- GRAPHQL_URI=http://backend:4123
|
||||||
- NODE_ENV=test
|
- NODE_ENV=test
|
||||||
|
|||||||
@ -13,7 +13,7 @@ services:
|
|||||||
- hc-network
|
- hc-network
|
||||||
environment:
|
environment:
|
||||||
- HOST=0.0.0.0
|
- HOST=0.0.0.0
|
||||||
- BACKEND_URL=http://backend:4000
|
- GRAPHQL_URI=http://backend:4000
|
||||||
- MAPBOX_TOKEN="pk.eyJ1IjoiaHVtYW4tY29ubmVjdGlvbiIsImEiOiJjajl0cnBubGoweTVlM3VwZ2lzNTNud3ZtIn0.bZ8KK9l70omjXbEkkbHGsQ"
|
- MAPBOX_TOKEN="pk.eyJ1IjoiaHVtYW4tY29ubmVjdGlvbiIsImEiOiJjajl0cnBubGoweTVlM3VwZ2lzNTNud3ZtIn0.bZ8KK9l70omjXbEkkbHGsQ"
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
|
|||||||
@ -123,7 +123,7 @@ module.exports = {
|
|||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
// make this configurable (nuxt-dotenv)
|
// make this configurable (nuxt-dotenv)
|
||||||
target: process.env.BACKEND_URL || 'http://localhost:4000',
|
target: process.env.GRAPHQL_URI || 'http://localhost:4000',
|
||||||
pathRewrite: { '^/api': '' },
|
pathRewrite: { '^/api': '' },
|
||||||
toProxy: true, // cloudflare needs that
|
toProxy: true, // cloudflare needs that
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
export default ({ app }) => {
|
export default ({ app }) => {
|
||||||
const backendUrl = process.env.BACKEND_URL || 'http://localhost:4000'
|
const backendUrl = process.env.GRAPHQL_URI || 'http://localhost:4000'
|
||||||
return {
|
return {
|
||||||
httpEndpoint: process.server ? backendUrl : '/api',
|
httpEndpoint: process.server ? backendUrl : '/api',
|
||||||
httpLinkOptions: {
|
httpLinkOptions: {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user