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 {
|
||||
stage('Setup') {
|
||||
env.MAIN_REPLICAS = 1
|
||||
env.CRON_REPLICAS = 0
|
||||
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 "WORKSPACE: ${env.WORKSPACE}"
|
||||
}
|
||||
|
@ -76,15 +67,19 @@ pipeline {
|
|||
branch 'test'
|
||||
}
|
||||
}
|
||||
environment {
|
||||
DOCKER_HOST = "${env.SWARM_HOST}"
|
||||
}
|
||||
steps {
|
||||
script {
|
||||
def packageJson = readJSON file: 'package.json'
|
||||
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
|
||||
args:
|
||||
- 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:
|
||||
image: registry.verdnatura.es/hedera-web:${VERSION:?}
|
||||
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