# 🇬🇧 Deploy quickly on Clever Cloud with GitLab CI
What is Clever Cloud? It's a French PaaS operated by developers for the developers (but not only the developers of course), and it's here https://www.clever-cloud.com/ (opens new window)
The Clever Cloud team provides a CLI to deploy your web applications quickly on their PaaS, and there is a Docker version of this CLI 🎉, so today I offer you a very simple CI/CD snippet to boost your deployments on Clever Cloud (when you merge on the master
branch):
Add this to the .gitlab-ci.yml
file of your GitLab project
image: clevercloud/clever-tools:latest
variables:
CLEVER_KIND_APPLICATION: "node" # change the value if needed
#-------------------------------
# Deploy
#-------------------------------
production:deploy:to:clever-cloud:
only:
- master
environment:
name: production-clever-cloud/${CI_PROJECT_NAME}
url: https://${CI_PROJECT_NAME}.cleverapps.io
script: |
CREATE_CC_APP=false
clever link -o ${ORGANIZATION_ID} ${CI_PROJECT_NAME} || CREATE_CC_APP=true
if ${CREATE_CC_APP}; then clever create --type ${CLEVER_KIND_APPLICATION} -o ${ORGANIZATION_ID} ${CI_PROJECT_NAME}; sleep 10; fi
clever domain add ${CI_PROJECT_NAME}.cleverapps.io || true
clever deploy -f
#-------------------------------
# Remove - this is a manual job
#-------------------------------
production:remove:from:clever-cloud:
when: manual
only:
- master
environment:
name: production-clever-cloud/${CI_PROJECT_NAME}
action: stop
script: |
DELETE_CC_APP=true
clever link -o ${ORGANIZATION_ID} ${CI_PROJECT_NAME} || DELETE_CC_APP=false
if $DELETE_CC_APP; then clever delete -y -a ${CI_PROJECT_NAME}; fi
Requirements: add theses environment variables
CLEVER_SECRET
,CLEVER_TOKEN
andORGANIZATION_ID
to your CI/CD settings
Now, when you'll merge something on the master
branch it will be deployed on Clever Cloud platform.
# 🖐️ if you used the GitLab shared runner on GitLab.com
replace:
image: clevercloud/clever-tools:latest
by
image:
name: clevercloud/clever-tools:latest
entrypoint: ["/bin/sh", "-c"]
Last Articles
- 🇫🇷 Type Result en Kotlin | 2020-10-31 | Kotlin
- 🇫🇷 Type Result en Kotlin | 2020-10-31 | Kotlin
- 🇬🇧 Every GitLab Page deserves a real CI/CD | 2020-07-23 | GitLab CI
- 🇫🇷 Lit-Element, commencer doucement | 2020-07-20 | WebComponent
- 🇬🇧 Build quickly and host easily your Docker images with GitLab and GitLab CI | 2020-06-02 | GitLab CI
- 🇬🇧 Deploy quickly on Clever Cloud with GitLab CI | 2020-05-31 | GitLab CI
- 🇫🇷 Borg Collective, mes jouets pour apprendre Knative | 2020-05-30 | Knative
- 🇬🇧 Borg Collective, Toys to learn Knative | 2020-05-30 | Knative
- 🇫🇷 M5Stack, une petit device IOT bien sympathique, programmable en Python | 2020-05-09 | IOT
- 🇫🇷 Knative, l'outil qui rend Kubernetes sympathique | 2020-05-02 | kubernetes