From 6deb07e62f8008b3b8c1a5053c7540c2b7dd9988 Mon Sep 17 00:00:00 2001 From: Alexandru Ianta Date: Wed, 23 Jun 2021 13:16:24 -0300 Subject: [PATCH 01/27] added deployment script --- dev_deploy.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 dev_deploy.sh diff --git a/dev_deploy.sh b/dev_deploy.sh new file mode 100644 index 0000000..53b850e --- /dev/null +++ b/dev_deploy.sh @@ -0,0 +1,46 @@ +# Dev Deployment Script + +# COPY PLUGIN FILES +echo "Cloned repo into $(Pipeline.Workspace)/s/" +echo "Repo contents:" +ls $(Pipeline.Workspace)/s/ + +# If the extension folder does not exist create it. +if [ ! -d $(CKANEXTS_PATH)$(EXT_NAME) ] +then + echo "Extension folder does not exist, creating it now." + sudo mkdir $(ckanexts_path)$(ext_name) +else + echo "Extension folder exists, clearing old contents!" + sudo rm -r $(ckanexts_path)$(ext_name)/* +fi +echo "Copying new files" +sudo cp -r $(Pipeline.Workspace)/s/* $(ckanexts_path)$(ext_name) +sudo chmod 777 -R $(ckanexts_path)$(ext_name) + +echo "Installing plugin into CKAN venv" +sudo docker exec ckan /bin/bash -c "source $(docker_venv_path) && \ + cd $(docker_exts_path)ckanext-vitality_prototype/ && pip install -r requirements.txt" +sudo docker exec ckan /bin/bash -c "source $(docker_venv_path) && \ + cd $(docker_exts_path)ckanext-vitality_prototype/ && python setup.py develop" + +# SHUTDOWN CKAN +cd $(docker_path) +sudo docker-compose down + +# RESTART CKAN +cd $(docker_path) +sudo docker-compose up -d + +# SEED VITALITY AUTHORIZATION MODEL +echo "Seeding users into metadata authorization model" +sudo docker exec ckan /usr/local/bin/ckan-paster --plugin=ckanext-vitality_prototype \ + vitality seed --config=/etc/ckan/production.ini + +# RE-INDEX DATASETS +echo "Re-indexing datasets..." +sudo docker exec ckan /usr/local/bin/ckan-paster --plugin=ckan search-index \ + rebuild --config=/etc/ckan/production.ini + +sudo docker exec ckan /usr/local/bin/ckan-paster --plugin=ckanext-harvest harvester \ + reindex --config=/etc/ckan/production.ini \ No newline at end of file From da977a7c85de45fbcfa314c6543d96785a61f2ab Mon Sep 17 00:00:00 2001 From: Alexandru Ianta Date: Wed, 23 Jun 2021 14:03:51 -0300 Subject: [PATCH 02/27] neuter the deploy script for now --- dev_deploy.sh | 97 +++++++++++++++++++++++++++++---------------------- 1 file changed, 55 insertions(+), 42 deletions(-) diff --git a/dev_deploy.sh b/dev_deploy.sh index 53b850e..32c6200 100644 --- a/dev_deploy.sh +++ b/dev_deploy.sh @@ -1,46 +1,59 @@ # Dev Deployment Script -# COPY PLUGIN FILES -echo "Cloned repo into $(Pipeline.Workspace)/s/" -echo "Repo contents:" -ls $(Pipeline.Workspace)/s/ +# ENSURE ENVIRONMENT VARIABLES EXIST, OTHERWISE CRASH +# IT'S CRITICAL THIS EXISTS OTHERWISE THE DEPLOYING SERVER WILL GET NUKED!! +if [ -z "$(docker_exts_path)"] || + [ -z "$(ckanexts_path)"] || + [ -z "$(ext_name)"] || + [ -z "$(docker_venv_path)"] || + [ -z "$(docker_venv_path)"] || + -# If the extension folder does not exist create it. -if [ ! -d $(CKANEXTS_PATH)$(EXT_NAME) ] then - echo "Extension folder does not exist, creating it now." - sudo mkdir $(ckanexts_path)$(ext_name) -else - echo "Extension folder exists, clearing old contents!" - sudo rm -r $(ckanexts_path)$(ext_name)/* -fi -echo "Copying new files" -sudo cp -r $(Pipeline.Workspace)/s/* $(ckanexts_path)$(ext_name) -sudo chmod 777 -R $(ckanexts_path)$(ext_name) - -echo "Installing plugin into CKAN venv" -sudo docker exec ckan /bin/bash -c "source $(docker_venv_path) && \ - cd $(docker_exts_path)ckanext-vitality_prototype/ && pip install -r requirements.txt" -sudo docker exec ckan /bin/bash -c "source $(docker_venv_path) && \ - cd $(docker_exts_path)ckanext-vitality_prototype/ && python setup.py develop" - -# SHUTDOWN CKAN -cd $(docker_path) -sudo docker-compose down - -# RESTART CKAN -cd $(docker_path) -sudo docker-compose up -d - -# SEED VITALITY AUTHORIZATION MODEL -echo "Seeding users into metadata authorization model" -sudo docker exec ckan /usr/local/bin/ckan-paster --plugin=ckanext-vitality_prototype \ - vitality seed --config=/etc/ckan/production.ini - -# RE-INDEX DATASETS -echo "Re-indexing datasets..." -sudo docker exec ckan /usr/local/bin/ckan-paster --plugin=ckan search-index \ - rebuild --config=/etc/ckan/production.ini - -sudo docker exec ckan /usr/local/bin/ckan-paster --plugin=ckanext-harvest harvester \ - reindex --config=/etc/ckan/production.ini \ No newline at end of file + echo "Required environment variables not set! Exiting to prevent catastrophic behavior!" + exit 1 + +# # COPY PLUGIN FILES +# echo "Cloned repo into $(Pipeline.Workspace)/s/" +# echo "Repo contents:" +# ls $(Pipeline.Workspace)/s/ + +# # If the extension folder does not exist create it. +# if [ ! -d $(CKANEXTS_PATH)$(EXT_NAME) ] +# then +# echo "Extension folder does not exist, creating it now." +# sudo mkdir $(ckanexts_path)$(ext_name) +# else +# echo "Extension folder exists, clearing old contents!" +# sudo rm -r $(ckanexts_path)$(ext_name)/* +# fi +# echo "Copying new files" +# sudo cp -r $(Pipeline.Workspace)/s/* $(ckanexts_path)$(ext_name) +# sudo chmod 777 -R $(ckanexts_path)$(ext_name) + +# echo "Installing plugin into CKAN venv" +# sudo docker exec ckan /bin/bash -c "source $(docker_venv_path) && \ +# cd $(docker_exts_path)ckanext-vitality_prototype/ && pip install -r requirements.txt" +# sudo docker exec ckan /bin/bash -c "source $(docker_venv_path) && \ +# cd $(docker_exts_path)ckanext-vitality_prototype/ && python setup.py develop" + +# # SHUTDOWN CKAN +# cd $(docker_path) +# sudo docker-compose down + +# # RESTART CKAN +# cd $(docker_path) +# sudo docker-compose up -d + +# # SEED VITALITY AUTHORIZATION MODEL +# echo "Seeding users into metadata authorization model" +# sudo docker exec ckan /usr/local/bin/ckan-paster --plugin=ckanext-vitality_prototype \ +# vitality seed --config=/etc/ckan/production.ini + +# # RE-INDEX DATASETS +# echo "Re-indexing datasets..." +# sudo docker exec ckan /usr/local/bin/ckan-paster --plugin=ckan search-index \ +# rebuild --config=/etc/ckan/production.ini + +# sudo docker exec ckan /usr/local/bin/ckan-paster --plugin=ckanext-harvest harvester \ +# reindex --config=/etc/ckan/production.ini \ No newline at end of file From 6f40bc549fe539f48f058ee963c18bd87f39d9ad Mon Sep 17 00:00:00 2001 From: Alexandru Ianta Date: Wed, 23 Jun 2021 14:10:53 -0300 Subject: [PATCH 03/27] verify variable existence before doing anything --- dev_deploy.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/dev_deploy.sh b/dev_deploy.sh index 32c6200..4017d9d 100644 --- a/dev_deploy.sh +++ b/dev_deploy.sh @@ -2,13 +2,15 @@ # ENSURE ENVIRONMENT VARIABLES EXIST, OTHERWISE CRASH # IT'S CRITICAL THIS EXISTS OTHERWISE THE DEPLOYING SERVER WILL GET NUKED!! -if [ -z "$(docker_exts_path)"] || +if [ -z "$(ckan_log_path)"] || + [ -z "$(ckan_port)"] || + [ -z "$(ckan_site_url)"] || + [ -z "$(ckan_tag)"] || [ -z "$(ckanexts_path)"] || - [ -z "$(ext_name)"] || + [ -z "$(docker_exts_path)"] || [ -z "$(docker_venv_path)"] || - [ -z "$(docker_venv_path)"] || - - + [ -z "$(docker_path)"] || + [ -z "$(ext_name)"] then echo "Required environment variables not set! Exiting to prevent catastrophic behavior!" exit 1 From dcefe31bb36474177ad833a8e7d6d5d095ce2853 Mon Sep 17 00:00:00 2001 From: Alexandru Ianta Date: Wed, 23 Jun 2021 14:18:21 -0300 Subject: [PATCH 04/27] checking that required env variables are set before executing deployment scripts... --- azure-pipelines.yml | 20 ++++++++++++++++++++ dev_deploy.sh | 19 ++++++++++--------- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9d303ca..14174c0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -8,6 +8,26 @@ trigger: pool: Default +steps: +- script: | + echo "Preventing calamity. Please wait while environment variables are verified..." + # ENSURE ENVIRONMENT VARIABLES EXIST, OTHERWISE CRASH + # IT'S CRITICAL THIS EXISTS OTHERWISE THE DEPLOYING SERVER WILL GET NUKED!! + if [ -z "$(ckan_log_path)" || + -z "$(ckan_port)" || + -z "$(ckan_site_url)" || + -z "$(ckan_tag)" || + -z "$(ckanexts_path)" || + -z "$(docker_exts_path)" || + -z "$(docker_venv_path)" || + -z "$(docker_path)" || + -z "$(ext_name)"] + then + echo "Required environment variables not set! Exiting to prevent catastrophic behavior!" + exit 1 + continueOnError: false + displayName: 'Environment Variable check' + steps: - script: | diff --git a/dev_deploy.sh b/dev_deploy.sh index 4017d9d..76bf878 100644 --- a/dev_deploy.sh +++ b/dev_deploy.sh @@ -1,16 +1,17 @@ # Dev Deployment Script +echo "Preventing calamity. Please wait while environment variables are verified..." # ENSURE ENVIRONMENT VARIABLES EXIST, OTHERWISE CRASH # IT'S CRITICAL THIS EXISTS OTHERWISE THE DEPLOYING SERVER WILL GET NUKED!! -if [ -z "$(ckan_log_path)"] || - [ -z "$(ckan_port)"] || - [ -z "$(ckan_site_url)"] || - [ -z "$(ckan_tag)"] || - [ -z "$(ckanexts_path)"] || - [ -z "$(docker_exts_path)"] || - [ -z "$(docker_venv_path)"] || - [ -z "$(docker_path)"] || - [ -z "$(ext_name)"] +if [ -z "$(ckan_log_path)" || + -z "$(ckan_port)" || + -z "$(ckan_site_url)" || + -z "$(ckan_tag)" || + -z "$(ckanexts_path)" || + -z "$(docker_exts_path)" || + -z "$(docker_venv_path)" || + -z "$(docker_path)" || + -z "$(ext_name)"] then echo "Required environment variables not set! Exiting to prevent catastrophic behavior!" exit 1 From aea0f50f35fbb84afb5950452ac67c83199c5714 Mon Sep 17 00:00:00 2001 From: Alexandru Ianta Date: Wed, 23 Jun 2021 14:20:39 -0300 Subject: [PATCH 05/27] azure-pipelines.yml typo fixed --- azure-pipelines.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 14174c0..f54f5e8 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -28,7 +28,6 @@ steps: continueOnError: false displayName: 'Environment Variable check' -steps: - script: | echo Cloned repo into $(Agent.BuildDirectory)/s/ From f8540fb330a9f9f4c2b05897a2c83f58b51fd2c9 Mon Sep 17 00:00:00 2001 From: Alexandru Ianta Date: Wed, 23 Jun 2021 14:26:46 -0300 Subject: [PATCH 06/27] disabling pipeline until variable check is tested --- azure-pipelines.yml | 92 ++++++++++++++++++++++----------------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f54f5e8..83b22ff 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -28,61 +28,61 @@ steps: continueOnError: false displayName: 'Environment Variable check' -- script: | +# - script: | - echo Cloned repo into $(Agent.BuildDirectory)/s/ - echo Repo contents: - ls $(Agent.BuildDirectory)/s/ +# echo Cloned repo into $(Agent.BuildDirectory)/s/ +# echo "Repo contents:" +# ls $(Agent.BuildDirectory)/s/ - # If the extension folder does not exist create it. - if [ ! -d $(CKANEXTS_PATH)$(EXT_NAME) ] - then - echo Extension folder does not exist, creating it now. - sudo mkdir $(ckanexts_path)$(ext_name) - else - echo Extension folder exists, clearing old contents! - sudo rm -r $(ckanexts_path)$(ext_name)/* - fi - echo Copying new files - sudo cp -r $(Agent.BuildDirectory)/s/* $(ckanexts_path)$(ext_name) - sudo chmod 777 -R $(ckanexts_path)$(ext_name) +# # If the extension folder does not exist create it. +# if [ ! -d $(CKANEXTS_PATH)$(EXT_NAME) ] +# then +# echo Extension folder does not exist, creating it now. +# sudo mkdir $(ckanexts_path)$(ext_name) +# else +# echo Extension folder exists, clearing old contents! +# sudo rm -r $(ckanexts_path)$(ext_name)/* +# fi +# echo Copying new files +# sudo cp -r $(Agent.BuildDirectory)/s/* $(ckanexts_path)$(ext_name) +# sudo chmod 777 -R $(ckanexts_path)$(ext_name) - echo "Installing plugin into CKAN venv" - sudo docker exec ckan /bin/bash -c "source $(docker_venv_path) && \ - cd $(docker_exts_path)ckanext-vitality_prototype/ && pip install -r requirements.txt" - sudo docker exec ckan /bin/bash -c "source $(docker_venv_path) && \ - cd $(docker_exts_path)ckanext-vitality_prototype/ && python setup.py develop" +# echo "Installing plugin into CKAN venv" +# sudo docker exec ckan /bin/bash -c "source $(docker_venv_path) && \ +# cd $(docker_exts_path)ckanext-vitality_prototype/ && pip install -r requirements.txt" +# sudo docker exec ckan /bin/bash -c "source $(docker_venv_path) && \ +# cd $(docker_exts_path)ckanext-vitality_prototype/ && python setup.py develop" - displayName: 'Updating extension files' +# displayName: 'Updating extension files' -- script: | - cd $(docker_path) - sudo docker-compose down - continueOnError: true # In the case where CKAN wasn't up to begin with - displayName: 'Shutting down CKAN' +# - script: | +# cd $(docker_path) +# sudo docker-compose down +# continueOnError: true # In the case where CKAN wasn't up to begin with +# displayName: 'Shutting down CKAN' -- script: | - cd $(docker_path) - sudo docker-compose up -d - displayName: 'Restarting CKAN' - env: - DATASTORE_READONLY_PASSWORD: $(datastore_readonly_password) - POSTGRES_PASSWORD: $(postgres_password) +# - script: | +# cd $(docker_path) +# sudo docker-compose up -d +# displayName: 'Restarting CKAN' +# env: +# DATASTORE_READONLY_PASSWORD: $(datastore_readonly_password) +# POSTGRES_PASSWORD: $(postgres_password) -- script: | - echo "Seeding users into metadata authorization model" - sudo docker exec ckan /usr/local/bin/ckan-paster --plugin=ckanext-vitality_prototype \ - vitality seed --config=/etc/ckan/production.ini +# - script: | +# echo "Seeding users into metadata authorization model" +# sudo docker exec ckan /usr/local/bin/ckan-paster --plugin=ckanext-vitality_prototype \ +# vitality seed --config=/etc/ckan/production.ini - displayName: 'Seeding Authorization Model' +# displayName: 'Seeding Authorization Model' -- script: | - echo "Re-indexing datasets..." - sudo docker exec ckan /usr/local/bin/ckan-paster --plugin=ckan search-index \ - rebuild --config=/etc/ckan/production.ini +# - script: | +# echo "Re-indexing datasets..." +# sudo docker exec ckan /usr/local/bin/ckan-paster --plugin=ckan search-index \ +# rebuild --config=/etc/ckan/production.ini - sudo docker exec ckan /usr/local/bin/ckan-paster --plugin=ckanext-harvest harvester \ - reindex --config=/etc/ckan/production.ini +# sudo docker exec ckan /usr/local/bin/ckan-paster --plugin=ckanext-harvest harvester \ +# reindex --config=/etc/ckan/production.ini - displayName: 'Re-Indexing Datasets' +# displayName: 'Re-Indexing Datasets' From 0cda0048fca649751302e51638da9ac5d1909f95 Mon Sep 17 00:00:00 2001 From: Alexandru Ianta Date: Thu, 24 Jun 2021 12:49:59 -0300 Subject: [PATCH 07/27] syntax error bash script --- dev_deploy.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/dev_deploy.sh b/dev_deploy.sh index 76bf878..a8cbb7c 100644 --- a/dev_deploy.sh +++ b/dev_deploy.sh @@ -15,6 +15,7 @@ if [ -z "$(ckan_log_path)" || then echo "Required environment variables not set! Exiting to prevent catastrophic behavior!" exit 1 +fi # # COPY PLUGIN FILES # echo "Cloned repo into $(Pipeline.Workspace)/s/" From 0d2d64e827b2e42bfbda5bda362b5c4c426c1d67 Mon Sep 17 00:00:00 2001 From: Alexandru Ianta Date: Thu, 24 Jun 2021 12:52:40 -0300 Subject: [PATCH 08/27] troubleshooting pipeline script --- dev_deploy.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/dev_deploy.sh b/dev_deploy.sh index a8cbb7c..dd068a7 100644 --- a/dev_deploy.sh +++ b/dev_deploy.sh @@ -3,15 +3,15 @@ echo "Preventing calamity. Please wait while environment variables are verified..." # ENSURE ENVIRONMENT VARIABLES EXIST, OTHERWISE CRASH # IT'S CRITICAL THIS EXISTS OTHERWISE THE DEPLOYING SERVER WILL GET NUKED!! -if [ -z "$(ckan_log_path)" || - -z "$(ckan_port)" || - -z "$(ckan_site_url)" || - -z "$(ckan_tag)" || - -z "$(ckanexts_path)" || - -z "$(docker_exts_path)" || - -z "$(docker_venv_path)" || - -z "$(docker_path)" || - -z "$(ext_name)"] +if [ -z "$CKAN_LOG_PATH" || + -z "$CKAN_PORT" || + -z "$CKAN_SITE_URL" || + -z "$CKAN_TAG" || + -z "$CKANEXTS_PATH" || + -z "$DOCKER_EXTS_PATH" || + -z "$DOCKER_VENV_PATH" || + -z "$DOCKER_PATH" || + -z "$EXT_NAME"] then echo "Required environment variables not set! Exiting to prevent catastrophic behavior!" exit 1 From 6ecc0fc6c1469fab6464eb0e36cc1813e3fdd234 Mon Sep 17 00:00:00 2001 From: Alexandru Ianta Date: Thu, 24 Jun 2021 12:54:57 -0300 Subject: [PATCH 09/27] print env variables --- dev_deploy.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dev_deploy.sh b/dev_deploy.sh index dd068a7..f0644f6 100644 --- a/dev_deploy.sh +++ b/dev_deploy.sh @@ -17,6 +17,15 @@ then exit 1 fi +echo $CKAN_LOG_PATH +echo $CKAN_PORT +echo $CKAN_TAG +echo $CKAN_SITE_URL +echo $CKANEXTS_PATH +echo $EXT_NAME +echo $DOCKER_PATH +echo $DOCKER_VENV_PATH + # # COPY PLUGIN FILES # echo "Cloned repo into $(Pipeline.Workspace)/s/" # echo "Repo contents:" From 2f603159cf7f86e78e37c4e4d599930e8980837a Mon Sep 17 00:00:00 2001 From: Alexandru Ianta Date: Thu, 24 Jun 2021 12:58:17 -0300 Subject: [PATCH 10/27] added curly brackets --- dev_deploy.sh | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/dev_deploy.sh b/dev_deploy.sh index f0644f6..b4196d4 100644 --- a/dev_deploy.sh +++ b/dev_deploy.sh @@ -3,28 +3,28 @@ echo "Preventing calamity. Please wait while environment variables are verified..." # ENSURE ENVIRONMENT VARIABLES EXIST, OTHERWISE CRASH # IT'S CRITICAL THIS EXISTS OTHERWISE THE DEPLOYING SERVER WILL GET NUKED!! -if [ -z "$CKAN_LOG_PATH" || - -z "$CKAN_PORT" || - -z "$CKAN_SITE_URL" || - -z "$CKAN_TAG" || - -z "$CKANEXTS_PATH" || - -z "$DOCKER_EXTS_PATH" || - -z "$DOCKER_VENV_PATH" || - -z "$DOCKER_PATH" || - -z "$EXT_NAME"] +if [ -z "${CKAN_LOG_PATH}" || + -z "${CKAN_PORT}" || + -z "${CKAN_SITE_URL}" || + -z "${CKAN_TAG}" || + -z "${CKANEXTS_PATH}" || + -z "${DOCKER_EXTS_PATH}" || + -z "${DOCKER_VENV_PATH}" || + -z "${DOCKER_PATH}" || + -z "${EXT_NAME}"] then echo "Required environment variables not set! Exiting to prevent catastrophic behavior!" exit 1 fi -echo $CKAN_LOG_PATH -echo $CKAN_PORT -echo $CKAN_TAG -echo $CKAN_SITE_URL -echo $CKANEXTS_PATH -echo $EXT_NAME -echo $DOCKER_PATH -echo $DOCKER_VENV_PATH +echo ${CKAN_LOG_PATH} +echo ${CKAN_PORT} +echo ${CKAN_TAG} +echo ${CKAN_SITE_URL} +echo ${CKANEXTS_PATH} +echo ${EXT_NAME} +echo ${DOCKER_PATH} +echo ${DOCKER_VENV_PATH} # # COPY PLUGIN FILES # echo "Cloned repo into $(Pipeline.Workspace)/s/" From bf5f45874ed252ff9f81d226af9681543fd74edc Mon Sep 17 00:00:00 2001 From: Alexandru Ianta Date: Thu, 24 Jun 2021 12:59:58 -0300 Subject: [PATCH 11/27] troubleshooting --- dev_deploy.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev_deploy.sh b/dev_deploy.sh index b4196d4..402ad60 100644 --- a/dev_deploy.sh +++ b/dev_deploy.sh @@ -3,7 +3,7 @@ echo "Preventing calamity. Please wait while environment variables are verified..." # ENSURE ENVIRONMENT VARIABLES EXIST, OTHERWISE CRASH # IT'S CRITICAL THIS EXISTS OTHERWISE THE DEPLOYING SERVER WILL GET NUKED!! -if [ -z "${CKAN_LOG_PATH}" || +if [[ -z "${CKAN_LOG_PATH}" || -z "${CKAN_PORT}" || -z "${CKAN_SITE_URL}" || -z "${CKAN_TAG}" || @@ -11,7 +11,7 @@ if [ -z "${CKAN_LOG_PATH}" || -z "${DOCKER_EXTS_PATH}" || -z "${DOCKER_VENV_PATH}" || -z "${DOCKER_PATH}" || - -z "${EXT_NAME}"] + -z "${EXT_NAME}"]]; then echo "Required environment variables not set! Exiting to prevent catastrophic behavior!" exit 1 From 4ee15602cb0351dc9de97cd5a840a7ab3588bad3 Mon Sep 17 00:00:00 2001 From: Alexandru Ianta Date: Thu, 24 Jun 2021 13:07:06 -0300 Subject: [PATCH 12/27] fixed env check syntax --- dev_deploy.sh | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/dev_deploy.sh b/dev_deploy.sh index 402ad60..a183560 100644 --- a/dev_deploy.sh +++ b/dev_deploy.sh @@ -1,17 +1,15 @@ # Dev Deployment Script echo "Preventing calamity. Please wait while environment variables are verified..." -# ENSURE ENVIRONMENT VARIABLES EXIST, OTHERWISE CRASH -# IT'S CRITICAL THIS EXISTS OTHERWISE THE DEPLOYING SERVER WILL GET NUKED!! -if [[ -z "${CKAN_LOG_PATH}" || - -z "${CKAN_PORT}" || - -z "${CKAN_SITE_URL}" || - -z "${CKAN_TAG}" || - -z "${CKANEXTS_PATH}" || - -z "${DOCKER_EXTS_PATH}" || - -z "${DOCKER_VENV_PATH}" || - -z "${DOCKER_PATH}" || - -z "${EXT_NAME}"]]; +# ENSURE ENVIRONMENT VARIABLES EXIST, OTHERWISE CRASH # IT'S CRITICAL THIS EXISTS OTHERWISE THE DEPLOYING SERVER WILL GET NUKED!! if [ -z "${CKAN_LOG_PATH}"] ||\ + [ -z "${CKAN_PORT}"] ||\ + [ -z "${CKAN_SITE_URL}"] ||\ + [ -z "${CKAN_TAG}"] ||\ + [ -z "${CKANEXTS_PATH}"] ||\ + [ -z "${DOCKER_EXTS_PATH}"] ||\ + [ -z "${DOCKER_VENV_PATH}"] ||\ + [ -z "${DOCKER_PATH}"] ||\ + [ -z "${EXT_NAME}"] then echo "Required environment variables not set! Exiting to prevent catastrophic behavior!" exit 1 From f091c5b736648fcf0677823ed4e1d5770323c15a Mon Sep 17 00:00:00 2001 From: Alexandru Ianta Date: Thu, 24 Jun 2021 13:07:59 -0300 Subject: [PATCH 13/27] also updated pipeline file --- azure-pipelines.yml | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 83b22ff..782c358 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -11,20 +11,19 @@ pool: Default steps: - script: | echo "Preventing calamity. Please wait while environment variables are verified..." - # ENSURE ENVIRONMENT VARIABLES EXIST, OTHERWISE CRASH - # IT'S CRITICAL THIS EXISTS OTHERWISE THE DEPLOYING SERVER WILL GET NUKED!! - if [ -z "$(ckan_log_path)" || - -z "$(ckan_port)" || - -z "$(ckan_site_url)" || - -z "$(ckan_tag)" || - -z "$(ckanexts_path)" || - -z "$(docker_exts_path)" || - -z "$(docker_venv_path)" || - -z "$(docker_path)" || - -z "$(ext_name)"] + # ENSURE ENVIRONMENT VARIABLES EXIST, OTHERWISE CRASH # IT'S CRITICAL THIS EXISTS OTHERWISE THE DEPLOYING SERVER WILL GET NUKED!! if [ -z "${CKAN_LOG_PATH}"] ||\ + [ -z "${CKAN_PORT}"] ||\ + [ -z "${CKAN_SITE_URL}"] ||\ + [ -z "${CKAN_TAG}"] ||\ + [ -z "${CKANEXTS_PATH}"] ||\ + [ -z "${DOCKER_EXTS_PATH}"] ||\ + [ -z "${DOCKER_VENV_PATH}"] ||\ + [ -z "${DOCKER_PATH}"] ||\ + [ -z "${EXT_NAME}"] then echo "Required environment variables not set! Exiting to prevent catastrophic behavior!" exit 1 + fi continueOnError: false displayName: 'Environment Variable check' From 84a51c329baf15d1f520d7266f93abd4c92ee073 Mon Sep 17 00:00:00 2001 From: Alexandru Ianta Date: Thu, 24 Jun 2021 13:10:12 -0300 Subject: [PATCH 14/27] more fixes --- dev_deploy.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev_deploy.sh b/dev_deploy.sh index a183560..8ccfeae 100644 --- a/dev_deploy.sh +++ b/dev_deploy.sh @@ -1,7 +1,8 @@ # Dev Deployment Script echo "Preventing calamity. Please wait while environment variables are verified..." -# ENSURE ENVIRONMENT VARIABLES EXIST, OTHERWISE CRASH # IT'S CRITICAL THIS EXISTS OTHERWISE THE DEPLOYING SERVER WILL GET NUKED!! if [ -z "${CKAN_LOG_PATH}"] ||\ +# ENSURE ENVIRONMENT VARIABLES EXIST, OTHERWISE CRASH # IT'S CRITICAL THIS EXISTS OTHERWISE THE DEPLOYING SERVER WILL GET NUKED!! +if [ -z "${CKAN_LOG_PATH}"] ||\ [ -z "${CKAN_PORT}"] ||\ [ -z "${CKAN_SITE_URL}"] ||\ [ -z "${CKAN_TAG}"] ||\ From d20e712c7bf9cd9bb1bf2bb816e15b4b6d30c0ff Mon Sep 17 00:00:00 2001 From: Alexandru Ianta Date: Thu, 24 Jun 2021 13:13:34 -0300 Subject: [PATCH 15/27] tinkering away --- azure-pipelines.yml | 17 +++++++++-------- dev_deploy.sh | 34 +++++++++++++++++----------------- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 782c358..b27802b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -12,14 +12,15 @@ steps: - script: | echo "Preventing calamity. Please wait while environment variables are verified..." # ENSURE ENVIRONMENT VARIABLES EXIST, OTHERWISE CRASH # IT'S CRITICAL THIS EXISTS OTHERWISE THE DEPLOYING SERVER WILL GET NUKED!! if [ -z "${CKAN_LOG_PATH}"] ||\ - [ -z "${CKAN_PORT}"] ||\ - [ -z "${CKAN_SITE_URL}"] ||\ - [ -z "${CKAN_TAG}"] ||\ - [ -z "${CKANEXTS_PATH}"] ||\ - [ -z "${DOCKER_EXTS_PATH}"] ||\ - [ -z "${DOCKER_VENV_PATH}"] ||\ - [ -z "${DOCKER_PATH}"] ||\ - [ -z "${EXT_NAME}"] + if [ -z "${CKAN_LOG_PATH}" ] ||\ + [ -z "${CKAN_PORT}" ] ||\ + [ -z "${CKAN_SITE_URL}" ] ||\ + [ -z "${CKAN_TAG}" ] ||\ + [ -z "${CKANEXTS_PATH}" ] ||\ + [ -z "${DOCKER_EXTS_PATH}" ] ||\ + [ -z "${DOCKER_VENV_PATH}" ] ||\ + [ -z "${DOCKER_PATH}" ] ||\ + [ -z "${EXT_NAME}" ] then echo "Required environment variables not set! Exiting to prevent catastrophic behavior!" exit 1 diff --git a/dev_deploy.sh b/dev_deploy.sh index 8ccfeae..dc14c94 100644 --- a/dev_deploy.sh +++ b/dev_deploy.sh @@ -2,28 +2,28 @@ echo "Preventing calamity. Please wait while environment variables are verified..." # ENSURE ENVIRONMENT VARIABLES EXIST, OTHERWISE CRASH # IT'S CRITICAL THIS EXISTS OTHERWISE THE DEPLOYING SERVER WILL GET NUKED!! -if [ -z "${CKAN_LOG_PATH}"] ||\ - [ -z "${CKAN_PORT}"] ||\ - [ -z "${CKAN_SITE_URL}"] ||\ - [ -z "${CKAN_TAG}"] ||\ - [ -z "${CKANEXTS_PATH}"] ||\ - [ -z "${DOCKER_EXTS_PATH}"] ||\ - [ -z "${DOCKER_VENV_PATH}"] ||\ - [ -z "${DOCKER_PATH}"] ||\ - [ -z "${EXT_NAME}"] +if [ -z "${CKAN_LOG_PATH}" ] ||\ + [ -z "${CKAN_PORT}" ] ||\ + [ -z "${CKAN_SITE_URL}" ] ||\ + [ -z "${CKAN_TAG}" ] ||\ + [ -z "${CKANEXTS_PATH}" ] ||\ + [ -z "${DOCKER_EXTS_PATH}" ] ||\ + [ -z "${DOCKER_VENV_PATH}" ] ||\ + [ -z "${DOCKER_PATH}" ] ||\ + [ -z "${EXT_NAME}" ] then echo "Required environment variables not set! Exiting to prevent catastrophic behavior!" exit 1 fi -echo ${CKAN_LOG_PATH} -echo ${CKAN_PORT} -echo ${CKAN_TAG} -echo ${CKAN_SITE_URL} -echo ${CKANEXTS_PATH} -echo ${EXT_NAME} -echo ${DOCKER_PATH} -echo ${DOCKER_VENV_PATH} +echo "CKAN_LOG_PATH: ${CKAN_LOG_PATH}" +echo "CKAN_PORT: ${CKAN_PORT}" +echo "CKAN_TAG: ${CKAN_TAG}" +echo "CKAN_SITE_URL: ${CKAN_SITE_URL}" +echo "CKANEXTS_PATH: ${CKANEXTS_PATH}" +echo "EXT_NAME: ${EXT_NAME}" +echo "DOCKER_PATH: ${DOCKER_PATH}" +echo "DOCKER_VENV_PATH: ${DOCKER_VENV_PATH}" # # COPY PLUGIN FILES # echo "Cloned repo into $(Pipeline.Workspace)/s/" From 84c84d470bb1d3996ba0516450199d6d9717241a Mon Sep 17 00:00:00 2001 From: Alexandru Ianta Date: Thu, 24 Jun 2021 13:17:41 -0300 Subject: [PATCH 16/27] re-added the copy code --- dev_deploy.sh | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/dev_deploy.sh b/dev_deploy.sh index dc14c94..ddd60c0 100644 --- a/dev_deploy.sh +++ b/dev_deploy.sh @@ -25,23 +25,23 @@ echo "EXT_NAME: ${EXT_NAME}" echo "DOCKER_PATH: ${DOCKER_PATH}" echo "DOCKER_VENV_PATH: ${DOCKER_VENV_PATH}" -# # COPY PLUGIN FILES -# echo "Cloned repo into $(Pipeline.Workspace)/s/" -# echo "Repo contents:" -# ls $(Pipeline.Workspace)/s/ +# COPY PLUGIN FILES +echo "Cloned repo into $(Pipeline.Workspace)/s/" +echo "Repo contents:" +ls $(Pipeline.Workspace)/s/ -# # If the extension folder does not exist create it. -# if [ ! -d $(CKANEXTS_PATH)$(EXT_NAME) ] -# then -# echo "Extension folder does not exist, creating it now." -# sudo mkdir $(ckanexts_path)$(ext_name) -# else -# echo "Extension folder exists, clearing old contents!" -# sudo rm -r $(ckanexts_path)$(ext_name)/* -# fi -# echo "Copying new files" -# sudo cp -r $(Pipeline.Workspace)/s/* $(ckanexts_path)$(ext_name) -# sudo chmod 777 -R $(ckanexts_path)$(ext_name) +# If the extension folder does not exist create it. +if [ ! -d ${CKANEXTS_PATH}${EXT_NAME} ] +then + echo "Extension folder does not exist, creating it now." + sudo mkdir ${CKANEXTS_PATH}${EXT_NAME} +else + echo "Extension folder exists, clearing old contents in ${CKANEXTS_PATH}${EXT_NAME}" + # sudo rm -r ${CKANEXTS_PATH}${EXT_NAME} +fi +echo "Copying new files" +sudo cp -r $(Pipeline.Workspace)/s/* ${CKANEXTS_PATH}${EXT_NAME} +sudo chmod 777 -R ${CKANEXTS_PATH}${EXT_NAME} # echo "Installing plugin into CKAN venv" # sudo docker exec ckan /bin/bash -c "source $(docker_venv_path) && \ From bc61a58ab5e5889cf71e7d85de6af8174015670d Mon Sep 17 00:00:00 2001 From: Alexandru Ianta Date: Thu, 24 Jun 2021 13:20:41 -0300 Subject: [PATCH 17/27] using predefined variables --- dev_deploy.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev_deploy.sh b/dev_deploy.sh index ddd60c0..aa24563 100644 --- a/dev_deploy.sh +++ b/dev_deploy.sh @@ -26,9 +26,9 @@ echo "DOCKER_PATH: ${DOCKER_PATH}" echo "DOCKER_VENV_PATH: ${DOCKER_VENV_PATH}" # COPY PLUGIN FILES -echo "Cloned repo into $(Pipeline.Workspace)/s/" +echo "Cloned repo into $PIPELINE_WORKSPACE/s/" echo "Repo contents:" -ls $(Pipeline.Workspace)/s/ +ls $PIPELINE_WORKSPACE/s/ # If the extension folder does not exist create it. if [ ! -d ${CKANEXTS_PATH}${EXT_NAME} ] From fcaa94243ce71d7d97ae04109c535311d8067281 Mon Sep 17 00:00:00 2001 From: Alexandru Ianta Date: Thu, 24 Jun 2021 13:23:14 -0300 Subject: [PATCH 18/27] curly brackets --- dev_deploy.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev_deploy.sh b/dev_deploy.sh index aa24563..8bee0cf 100644 --- a/dev_deploy.sh +++ b/dev_deploy.sh @@ -26,9 +26,9 @@ echo "DOCKER_PATH: ${DOCKER_PATH}" echo "DOCKER_VENV_PATH: ${DOCKER_VENV_PATH}" # COPY PLUGIN FILES -echo "Cloned repo into $PIPELINE_WORKSPACE/s/" +echo "Cloned repo into ${PIPELINE_WORKSPACE}/s/" echo "Repo contents:" -ls $PIPELINE_WORKSPACE/s/ +ls ${PIPELINE_WORKSPACE}/s/ # If the extension folder does not exist create it. if [ ! -d ${CKANEXTS_PATH}${EXT_NAME} ] From 2d1365c6557de1983949d21b64ce71b47c6525cb Mon Sep 17 00:00:00 2001 From: Alexandru Ianta Date: Thu, 24 Jun 2021 13:25:25 -0300 Subject: [PATCH 19/27] use agent release directory instead of pipeline workspace --- dev_deploy.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev_deploy.sh b/dev_deploy.sh index 8bee0cf..45646f5 100644 --- a/dev_deploy.sh +++ b/dev_deploy.sh @@ -26,9 +26,9 @@ echo "DOCKER_PATH: ${DOCKER_PATH}" echo "DOCKER_VENV_PATH: ${DOCKER_VENV_PATH}" # COPY PLUGIN FILES -echo "Cloned repo into ${PIPELINE_WORKSPACE}/s/" +echo "Cloned repo into ${AGENT_RELEASEDIRECTORY}/s/" echo "Repo contents:" -ls ${PIPELINE_WORKSPACE}/s/ +ls ${AGENT_RELEASEDIRECTORY}/s/ # If the extension folder does not exist create it. if [ ! -d ${CKANEXTS_PATH}${EXT_NAME} ] From 4f62651754ce58c75193301b6902f7dce6edf1a7 Mon Sep 17 00:00:00 2001 From: Alexandru Ianta Date: Thu, 24 Jun 2021 13:26:34 -0300 Subject: [PATCH 20/27] /s/ no longer needed? --- dev_deploy.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev_deploy.sh b/dev_deploy.sh index 45646f5..b2f2f6d 100644 --- a/dev_deploy.sh +++ b/dev_deploy.sh @@ -26,9 +26,9 @@ echo "DOCKER_PATH: ${DOCKER_PATH}" echo "DOCKER_VENV_PATH: ${DOCKER_VENV_PATH}" # COPY PLUGIN FILES -echo "Cloned repo into ${AGENT_RELEASEDIRECTORY}/s/" +echo "Cloned repo into ${AGENT_RELEASEDIRECTORY}" echo "Repo contents:" -ls ${AGENT_RELEASEDIRECTORY}/s/ +ls ${AGENT_RELEASEDIRECTORY} # If the extension folder does not exist create it. if [ ! -d ${CKANEXTS_PATH}${EXT_NAME} ] From 7f67cf6421bebfad77d94b5b0ff3cbdd86c4e3c7 Mon Sep 17 00:00:00 2001 From: Alexandru Ianta Date: Thu, 24 Jun 2021 13:30:52 -0300 Subject: [PATCH 21/27] building release path --- dev_deploy.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev_deploy.sh b/dev_deploy.sh index b2f2f6d..4163814 100644 --- a/dev_deploy.sh +++ b/dev_deploy.sh @@ -26,9 +26,9 @@ echo "DOCKER_PATH: ${DOCKER_PATH}" echo "DOCKER_VENV_PATH: ${DOCKER_VENV_PATH}" # COPY PLUGIN FILES -echo "Cloned repo into ${AGENT_RELEASEDIRECTORY}" +echo "Cloned repo into ${AGENT_RELEASEDIRECTORY}/${RELEASE_PRIMARYARTIFACTSOURCEALIAS}" echo "Repo contents:" -ls ${AGENT_RELEASEDIRECTORY} +ls ${AGENT_RELEASEDIRECTORY}/${RELEASE_PRIMARYARTIFACTSOURCEALIAS} # If the extension folder does not exist create it. if [ ! -d ${CKANEXTS_PATH}${EXT_NAME} ] From c1a012e651549a0272ebea4d3abde80bc3c0f1c3 Mon Sep 17 00:00:00 2001 From: Alexandru Ianta Date: Thu, 24 Jun 2021 13:36:12 -0300 Subject: [PATCH 22/27] clearing old folder again --- dev_deploy.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev_deploy.sh b/dev_deploy.sh index 4163814..a1e6610 100644 --- a/dev_deploy.sh +++ b/dev_deploy.sh @@ -37,10 +37,10 @@ then sudo mkdir ${CKANEXTS_PATH}${EXT_NAME} else echo "Extension folder exists, clearing old contents in ${CKANEXTS_PATH}${EXT_NAME}" - # sudo rm -r ${CKANEXTS_PATH}${EXT_NAME} + rm -r ${CKANEXTS_PATH}${EXT_NAME} fi echo "Copying new files" -sudo cp -r $(Pipeline.Workspace)/s/* ${CKANEXTS_PATH}${EXT_NAME} +sudo cp -r ${AGENT_RELEASEDIRECTORY}/${RELEASE_PRIMARYARTIFACTSOURCEALIAS}/* ${CKANEXTS_PATH}${EXT_NAME} sudo chmod 777 -R ${CKANEXTS_PATH}${EXT_NAME} # echo "Installing plugin into CKAN venv" From 3bb6b27095612153ed791cdce8ecd9920ee9186a Mon Sep 17 00:00:00 2001 From: Alexandru Ianta Date: Thu, 24 Jun 2021 13:37:29 -0300 Subject: [PATCH 23/27] need sudo --- dev_deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev_deploy.sh b/dev_deploy.sh index a1e6610..e32d43a 100644 --- a/dev_deploy.sh +++ b/dev_deploy.sh @@ -37,7 +37,7 @@ then sudo mkdir ${CKANEXTS_PATH}${EXT_NAME} else echo "Extension folder exists, clearing old contents in ${CKANEXTS_PATH}${EXT_NAME}" - rm -r ${CKANEXTS_PATH}${EXT_NAME} + sudo rm -r ${CKANEXTS_PATH}${EXT_NAME} fi echo "Copying new files" sudo cp -r ${AGENT_RELEASEDIRECTORY}/${RELEASE_PRIMARYARTIFACTSOURCEALIAS}/* ${CKANEXTS_PATH}${EXT_NAME} From a49df7a267c0f167790c3c41e5cd09912bd328c8 Mon Sep 17 00:00:00 2001 From: Alexandru Ianta Date: Thu, 24 Jun 2021 13:39:30 -0300 Subject: [PATCH 24/27] use a mkdir approach, which seems safer --- dev_deploy.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/dev_deploy.sh b/dev_deploy.sh index e32d43a..f1cdbbb 100644 --- a/dev_deploy.sh +++ b/dev_deploy.sh @@ -38,6 +38,7 @@ then else echo "Extension folder exists, clearing old contents in ${CKANEXTS_PATH}${EXT_NAME}" sudo rm -r ${CKANEXTS_PATH}${EXT_NAME} + sudo mkdir ${CKANEXTS_PATH}${EXT_NAME} fi echo "Copying new files" sudo cp -r ${AGENT_RELEASEDIRECTORY}/${RELEASE_PRIMARYARTIFACTSOURCEALIAS}/* ${CKANEXTS_PATH}${EXT_NAME} From 8c440c52c2db44fcbdcd19ed237b8642f72b6890 Mon Sep 17 00:00:00 2001 From: Alexandru Ianta Date: Thu, 24 Jun 2021 13:48:02 -0300 Subject: [PATCH 25/27] install dependencies --- dev_deploy.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/dev_deploy.sh b/dev_deploy.sh index f1cdbbb..11f7c72 100644 --- a/dev_deploy.sh +++ b/dev_deploy.sh @@ -24,6 +24,7 @@ echo "CKANEXTS_PATH: ${CKANEXTS_PATH}" echo "EXT_NAME: ${EXT_NAME}" echo "DOCKER_PATH: ${DOCKER_PATH}" echo "DOCKER_VENV_PATH: ${DOCKER_VENV_PATH}" +echo "DOCKER_EXTS_PATH: ${DOCKER_EXTS_PATH}" # COPY PLUGIN FILES echo "Cloned repo into ${AGENT_RELEASEDIRECTORY}/${RELEASE_PRIMARYARTIFACTSOURCEALIAS}" @@ -44,11 +45,11 @@ echo "Copying new files" sudo cp -r ${AGENT_RELEASEDIRECTORY}/${RELEASE_PRIMARYARTIFACTSOURCEALIAS}/* ${CKANEXTS_PATH}${EXT_NAME} sudo chmod 777 -R ${CKANEXTS_PATH}${EXT_NAME} -# echo "Installing plugin into CKAN venv" -# sudo docker exec ckan /bin/bash -c "source $(docker_venv_path) && \ -# cd $(docker_exts_path)ckanext-vitality_prototype/ && pip install -r requirements.txt" -# sudo docker exec ckan /bin/bash -c "source $(docker_venv_path) && \ -# cd $(docker_exts_path)ckanext-vitality_prototype/ && python setup.py develop" +echo "Installing plugin into CKAN venv" +sudo docker exec ckan /bin/bash -c "source ${DOCKER_VENV_PATH} && \ + cd ${DOCKER_EXTS_PATH}${EXT_NAME}/ && pip install -r requirements.txt" +sudo docker exec ckan /bin/bash -c "source ${DOCKER_VENV_PATH} && \ + cd ${DOCKER_EXTS_PATH}${EXT_NAME}/ && python setup.py develop" # # SHUTDOWN CKAN # cd $(docker_path) From c562d3df9893bda906964bdc8b6e2798d5ec194c Mon Sep 17 00:00:00 2001 From: Alexandru Ianta Date: Thu, 24 Jun 2021 13:50:48 -0300 Subject: [PATCH 26/27] added restart step --- dev_deploy.sh | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/dev_deploy.sh b/dev_deploy.sh index 11f7c72..abfa474 100644 --- a/dev_deploy.sh +++ b/dev_deploy.sh @@ -51,23 +51,23 @@ sudo docker exec ckan /bin/bash -c "source ${DOCKER_VENV_PATH} && \ sudo docker exec ckan /bin/bash -c "source ${DOCKER_VENV_PATH} && \ cd ${DOCKER_EXTS_PATH}${EXT_NAME}/ && python setup.py develop" -# # SHUTDOWN CKAN -# cd $(docker_path) -# sudo docker-compose down +# SHUTDOWN CKAN +cd ${DOCKER_PATH} +sudo docker-compose down -# # RESTART CKAN -# cd $(docker_path) -# sudo docker-compose up -d +# RESTART CKAN +cd ${DOCKER_PATH} +sudo docker-compose up -d -# # SEED VITALITY AUTHORIZATION MODEL -# echo "Seeding users into metadata authorization model" -# sudo docker exec ckan /usr/local/bin/ckan-paster --plugin=ckanext-vitality_prototype \ -# vitality seed --config=/etc/ckan/production.ini +# SEED VITALITY AUTHORIZATION MODEL +echo "Seeding users into metadata authorization model" +sudo docker exec ckan /usr/local/bin/ckan-paster --plugin=${EXT_NAME} \ + vitality seed --config=/etc/ckan/production.ini -# # RE-INDEX DATASETS -# echo "Re-indexing datasets..." -# sudo docker exec ckan /usr/local/bin/ckan-paster --plugin=ckan search-index \ -# rebuild --config=/etc/ckan/production.ini +# RE-INDEX DATASETS +echo "Re-indexing datasets..." +sudo docker exec ckan /usr/local/bin/ckan-paster --plugin=ckan search-index \ + rebuild --config=/etc/ckan/production.ini -# sudo docker exec ckan /usr/local/bin/ckan-paster --plugin=ckanext-harvest harvester \ -# reindex --config=/etc/ckan/production.ini \ No newline at end of file +sudo docker exec ckan /usr/local/bin/ckan-paster --plugin=ckanext-harvest harvester \ + reindex --config=/etc/ckan/production.ini \ No newline at end of file From 13e881ddf54483a18515a6ef86dc1dc06089a7bc Mon Sep 17 00:00:00 2001 From: Alexandru Ianta Date: Thu, 24 Jun 2021 14:02:06 -0300 Subject: [PATCH 27/27] removed deprecated azure-pipelines.yml file --- azure-pipelines.yml | 88 --------------------------------------------- 1 file changed, 88 deletions(-) delete mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index b27802b..0000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,88 +0,0 @@ -# Starter pipeline -# Start with a minimal pipeline that you can customize to build and deploy your code. -# Add steps that build, run tests, deploy, and more: -# https://aka.ms/yaml - -trigger: -- main - -pool: Default - -steps: -- script: | - echo "Preventing calamity. Please wait while environment variables are verified..." - # ENSURE ENVIRONMENT VARIABLES EXIST, OTHERWISE CRASH # IT'S CRITICAL THIS EXISTS OTHERWISE THE DEPLOYING SERVER WILL GET NUKED!! if [ -z "${CKAN_LOG_PATH}"] ||\ - if [ -z "${CKAN_LOG_PATH}" ] ||\ - [ -z "${CKAN_PORT}" ] ||\ - [ -z "${CKAN_SITE_URL}" ] ||\ - [ -z "${CKAN_TAG}" ] ||\ - [ -z "${CKANEXTS_PATH}" ] ||\ - [ -z "${DOCKER_EXTS_PATH}" ] ||\ - [ -z "${DOCKER_VENV_PATH}" ] ||\ - [ -z "${DOCKER_PATH}" ] ||\ - [ -z "${EXT_NAME}" ] - then - echo "Required environment variables not set! Exiting to prevent catastrophic behavior!" - exit 1 - fi - continueOnError: false - displayName: 'Environment Variable check' - -# - script: | - -# echo Cloned repo into $(Agent.BuildDirectory)/s/ -# echo "Repo contents:" -# ls $(Agent.BuildDirectory)/s/ - -# # If the extension folder does not exist create it. -# if [ ! -d $(CKANEXTS_PATH)$(EXT_NAME) ] -# then -# echo Extension folder does not exist, creating it now. -# sudo mkdir $(ckanexts_path)$(ext_name) -# else -# echo Extension folder exists, clearing old contents! -# sudo rm -r $(ckanexts_path)$(ext_name)/* -# fi -# echo Copying new files -# sudo cp -r $(Agent.BuildDirectory)/s/* $(ckanexts_path)$(ext_name) -# sudo chmod 777 -R $(ckanexts_path)$(ext_name) - -# echo "Installing plugin into CKAN venv" -# sudo docker exec ckan /bin/bash -c "source $(docker_venv_path) && \ -# cd $(docker_exts_path)ckanext-vitality_prototype/ && pip install -r requirements.txt" -# sudo docker exec ckan /bin/bash -c "source $(docker_venv_path) && \ -# cd $(docker_exts_path)ckanext-vitality_prototype/ && python setup.py develop" - -# displayName: 'Updating extension files' - -# - script: | -# cd $(docker_path) -# sudo docker-compose down -# continueOnError: true # In the case where CKAN wasn't up to begin with -# displayName: 'Shutting down CKAN' - -# - script: | -# cd $(docker_path) -# sudo docker-compose up -d -# displayName: 'Restarting CKAN' -# env: -# DATASTORE_READONLY_PASSWORD: $(datastore_readonly_password) -# POSTGRES_PASSWORD: $(postgres_password) - -# - script: | -# echo "Seeding users into metadata authorization model" -# sudo docker exec ckan /usr/local/bin/ckan-paster --plugin=ckanext-vitality_prototype \ -# vitality seed --config=/etc/ckan/production.ini - -# displayName: 'Seeding Authorization Model' - -# - script: | -# echo "Re-indexing datasets..." -# sudo docker exec ckan /usr/local/bin/ckan-paster --plugin=ckan search-index \ -# rebuild --config=/etc/ckan/production.ini - -# sudo docker exec ckan /usr/local/bin/ckan-paster --plugin=ckanext-harvest harvester \ -# reindex --config=/etc/ckan/production.ini - -# displayName: 'Re-Indexing Datasets' -