forked from verdnatura/hedera-web
feat: refs #7442 Kubernetes deploy
This commit is contained in:
parent
f869e7413c
commit
e40a28b649
|
@ -7,17 +7,8 @@ def BRANCH_ENV = [
|
||||||
|
|
||||||
node {
|
node {
|
||||||
stage('Setup') {
|
stage('Setup') {
|
||||||
env.MAIN_REPLICAS = 1
|
|
||||||
env.CRON_REPLICAS = 0
|
|
||||||
env.NODE_ENV = BRANCH_ENV[env.BRANCH_NAME] ?: 'dev'
|
env.NODE_ENV = BRANCH_ENV[env.BRANCH_NAME] ?: 'dev'
|
||||||
|
|
||||||
switch (env.BRANCH_NAME) {
|
|
||||||
case 'master':
|
|
||||||
env.MAIN_REPLICAS = 3
|
|
||||||
env.CRON_REPLICAS = 1
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "NODE_NAME: ${env.NODE_NAME}"
|
echo "NODE_NAME: ${env.NODE_NAME}"
|
||||||
echo "WORKSPACE: ${env.WORKSPACE}"
|
echo "WORKSPACE: ${env.WORKSPACE}"
|
||||||
}
|
}
|
||||||
|
@ -76,15 +67,19 @@ pipeline {
|
||||||
branch 'test'
|
branch 'test'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
environment {
|
|
||||||
DOCKER_HOST = "${env.SWARM_HOST}"
|
|
||||||
}
|
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
def packageJson = readJSON file: 'package.json'
|
def packageJson = readJSON file: 'package.json'
|
||||||
env.VERSION = packageJson.version
|
env.VERSION = packageJson.version
|
||||||
}
|
}
|
||||||
sh "docker stack deploy --with-registry-auth --compose-file docker-compose.yml ${env.STACK_NAME}"
|
withKubeConfig([
|
||||||
|
serverUrl: "$KUBERNETES_API",
|
||||||
|
credentialsId: 'kubernetes',
|
||||||
|
namespace: 'salix'
|
||||||
|
]) {
|
||||||
|
sh 'kubectl set image deployment/hedera-web-$BRANCH_NAME hedera-web-$BRANCH_NAME=$REGISTRY/hedera-web:$VERSION'
|
||||||
|
sh 'kubectl set image deployment/hedera-web-cron-$BRANCH_NAME hedera-web-cron-$BRANCH_NAME=$REGISTRY/hedera-web:$VERSION'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,41 +7,6 @@ services:
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
args:
|
args:
|
||||||
- VERSION=${VERSION:?}
|
- VERSION=${VERSION:?}
|
||||||
ports:
|
|
||||||
- 80
|
|
||||||
configs:
|
|
||||||
- source: config
|
|
||||||
target: /etc/hedera-web/config.my.php
|
|
||||||
volumes:
|
|
||||||
- /mnt/appdata:/mnt/storage
|
|
||||||
- /mnt/appdata/image:/var/lib/hedera-web/image-db
|
|
||||||
- /mnt/appdata/vn-access:/var/lib/hedera-web/vn-access
|
|
||||||
deploy:
|
|
||||||
replicas: ${MAIN_REPLICAS:?}
|
|
||||||
placement:
|
|
||||||
constraints:
|
|
||||||
- node.role == worker
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
memory: 2G
|
|
||||||
cron:
|
cron:
|
||||||
image: registry.verdnatura.es/hedera-web:${VERSION:?}
|
image: registry.verdnatura.es/hedera-web:${VERSION:?}
|
||||||
command: 'cron -f'
|
command: 'cron -f'
|
||||||
configs:
|
|
||||||
- source: config
|
|
||||||
target: /etc/hedera-web/config.my.php
|
|
||||||
volumes:
|
|
||||||
- /mnt/appdata:/mnt/storage
|
|
||||||
- /mnt/appdata/image:/var/lib/hedera-web/image-db
|
|
||||||
deploy:
|
|
||||||
replicas: ${CRON_REPLICAS:?}
|
|
||||||
placement:
|
|
||||||
constraints:
|
|
||||||
- node.role == worker
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
memory: 1G
|
|
||||||
configs:
|
|
||||||
config:
|
|
||||||
external: true
|
|
||||||
name: ${PROJECT_NAME:?}-${BRANCH_NAME:?}
|
|
||||||
|
|
Loading…
Reference in New Issue