From 63a5bbc143019686bf00dbd510a59156cd71fda6 Mon Sep 17 00:00:00 2001 From: Alireza Azizi Date: Thu, 24 Feb 2022 18:23:03 +0330 Subject: [PATCH 1/6] feat:add drone config --- .drone.yml | 50 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/.drone.yml b/.drone.yml index 2193f47..8d91963 100644 --- a/.drone.yml +++ b/.drone.yml @@ -2,23 +2,49 @@ kind: pipeline type: exec name: default +settings: + sh_key: + from_secret: /home/administrator/.ssh/id_rsa + steps: -- name: build - commands: - - docker build -t registry.willaspace.com/willaspace/${IMAGE_NAME}:latest --build-arg ssh_prv_key="$(cat /home/administrator/.ssh/id_rsa)" - - cd /home/administrator/apps/${IMAGE_NAME}/;sudo ./BuildDocker + - name: build_production + commands: + - docker build -t registry.willaspace.com/willaspace/${IMAGE_NAME}:latest --build-arg ssh_prv_key="$(cat /home/administrator/.ssh/id_rsa)" . + - cd /home/administrator/apps/${IMAGE_NAME}/;sudo ./BuildDocker + when: + branch: + - master + + - name: deploy_production + commands: + - cd /home/administrator/apps/${IMAGE_NAME}/ ; docker-compose up -d + - docker exec willaengine bash -c "COMPOSER=composer-prod.json composer update" + - docker exec willaengine service cron start + - docker exec willaengine php artisan config:cache + - docker exec willaengine php artisan route:cache + when: + branch: + - master + + - name: build_staging + commands: + - docker build -t registry.willaspace.com/willaspace/${IMAGE_NAME}-staging:latest -f Dockerfile.staging --build-arg ssh_prv_key="$(cat /home/administrator/.ssh/id_rsa)" . + - docker build -t registry.willaspace.com/willaspace/${IMAGE_NAME}-staging-nginx:latest -f Dockerfile.nginx . + when: + branch: + - dev -- name: deploy - commands: - - cd /home/administrator/apps/${IMAGE_NAME}/ ; docker-compose up -d - - docker exec willaengine bash -c "COMPOSER=composer-prod.json composer update" - - docker exec willaengine service cron start - - docker exec willaengine php artisan config:cache - - docker exec willaengine php artisan route:cache + - name: deploy_staging + commands: + - cd /apps/${IMAGE_NAME}-staging/ ; docker-compose up -d + when: + branch: + - dev trigger: branch: - - master + - master + - dev environment: - IMAGE_NAME=willaengine From 76c0de6b5ee7a7abc801b211526fe40c44387092 Mon Sep 17 00:00:00 2001 From: Alireza Azizi Date: Thu, 24 Feb 2022 18:24:03 +0330 Subject: [PATCH 2/6] fix --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 8d91963..0b1506c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,6 +1,6 @@ kind: pipeline type: exec -name: default +name: willaengine settings: sh_key: From 8d8ba19f1cb32029d17e4f8be5a8f6bffd0f846c Mon Sep 17 00:00:00 2001 From: Alireza Azizi Date: Thu, 24 Feb 2022 18:26:13 +0330 Subject: [PATCH 3/6] fix drone settings --- .drone.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.drone.yml b/.drone.yml index 0b1506c..97b0cc5 100644 --- a/.drone.yml +++ b/.drone.yml @@ -2,10 +2,6 @@ kind: pipeline type: exec name: willaengine -settings: - sh_key: - from_secret: /home/administrator/.ssh/id_rsa - steps: - name: build_production commands: From e22211e6e872645ed3c22df4c737592a8453171c Mon Sep 17 00:00:00 2001 From: saeid_01 Date: Thu, 24 Feb 2022 15:35:20 +0000 Subject: [PATCH 4/6] Update '.drone.yml' --- .drone.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 97b0cc5..ce65af7 100644 --- a/.drone.yml +++ b/.drone.yml @@ -6,7 +6,6 @@ steps: - name: build_production commands: - docker build -t registry.willaspace.com/willaspace/${IMAGE_NAME}:latest --build-arg ssh_prv_key="$(cat /home/administrator/.ssh/id_rsa)" . - - cd /home/administrator/apps/${IMAGE_NAME}/;sudo ./BuildDocker when: branch: - master From 068e21f8eade6d718e5ec0c5a8297e0934114f36 Mon Sep 17 00:00:00 2001 From: saeid_01 Date: Thu, 24 Feb 2022 15:48:31 +0000 Subject: [PATCH 5/6] Update '.drone.yml' --- .drone.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.drone.yml b/.drone.yml index ce65af7..d4308a0 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,16 +1,16 @@ kind: pipeline type: exec -name: willaengine +name: default steps: - - name: build_production + - name: build to production commands: - docker build -t registry.willaspace.com/willaspace/${IMAGE_NAME}:latest --build-arg ssh_prv_key="$(cat /home/administrator/.ssh/id_rsa)" . when: branch: - master - - name: deploy_production + - name: deploy to production commands: - cd /home/administrator/apps/${IMAGE_NAME}/ ; docker-compose up -d - docker exec willaengine bash -c "COMPOSER=composer-prod.json composer update" @@ -21,7 +21,7 @@ steps: branch: - master - - name: build_staging + - name: build to staging commands: - docker build -t registry.willaspace.com/willaspace/${IMAGE_NAME}-staging:latest -f Dockerfile.staging --build-arg ssh_prv_key="$(cat /home/administrator/.ssh/id_rsa)" . - docker build -t registry.willaspace.com/willaspace/${IMAGE_NAME}-staging-nginx:latest -f Dockerfile.nginx . @@ -29,7 +29,7 @@ steps: branch: - dev - - name: deploy_staging + - name: deploy to staging commands: - cd /apps/${IMAGE_NAME}-staging/ ; docker-compose up -d when: From 75557324722476f700e74572a5e6182731c5bfa2 Mon Sep 17 00:00:00 2001 From: saeid_01 Date: Thu, 24 Feb 2022 16:16:23 +0000 Subject: [PATCH 6/6] Update '.drone.yml' --- .drone.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.drone.yml b/.drone.yml index d4308a0..04aed84 100644 --- a/.drone.yml +++ b/.drone.yml @@ -5,14 +5,14 @@ name: default steps: - name: build to production commands: - - docker build -t registry.willaspace.com/willaspace/${IMAGE_NAME}:latest --build-arg ssh_prv_key="$(cat /home/administrator/.ssh/id_rsa)" . + - docker build -t registry.willaspace.com/willaspace/willaengine:latest . when: branch: - master - name: deploy to production commands: - - cd /home/administrator/apps/${IMAGE_NAME}/ ; docker-compose up -d + - cd /home/administrator/apps/willaengine/ ; docker-compose up -d - docker exec willaengine bash -c "COMPOSER=composer-prod.json composer update" - docker exec willaengine service cron start - docker exec willaengine php artisan config:cache @@ -23,15 +23,15 @@ steps: - name: build to staging commands: - - docker build -t registry.willaspace.com/willaspace/${IMAGE_NAME}-staging:latest -f Dockerfile.staging --build-arg ssh_prv_key="$(cat /home/administrator/.ssh/id_rsa)" . - - docker build -t registry.willaspace.com/willaspace/${IMAGE_NAME}-staging-nginx:latest -f Dockerfile.nginx . + - docker build -t registry.willaspace.com/willaspace/willaengine-staging:latest -f Dockerfile.staging . + - docker build -t registry.willaspace.com/willaspace/willaengine-staging-nginx:latest -f Dockerfile.nginx . when: branch: - dev - name: deploy to staging commands: - - cd /apps/${IMAGE_NAME}-staging/ ; docker-compose up -d + - cd /apps/willaengine-staging/ ; docker-compose up -d when: branch: - dev @@ -40,6 +40,3 @@ trigger: branch: - master - dev - -environment: - - IMAGE_NAME=willaengine