From d059da156dfbb63bf649d33bf949e9cca7defb9b Mon Sep 17 00:00:00 2001 From: Giles Bradshaw Date: Tue, 22 Sep 2020 15:32:45 +0100 Subject: [PATCH] . --- .drone/drone-home.yml | 15 --------------- .drone/package.json | 2 +- .drone/yarn.lock | 8 ++++---- init-postgresql.sh | 2 ++ 4 files changed, 7 insertions(+), 20 deletions(-) create mode 100644 init-postgresql.sh diff --git a/.drone/drone-home.yml b/.drone/drone-home.yml index 2993a17..b562aab 100644 --- a/.drone/drone-home.yml +++ b/.drone/drone-home.yml @@ -37,16 +37,11 @@ steps: - postgres_db - postgres_user - postgres_password - host: ${SSH_HOST} - key: ${SSH_KEY} - passphrase: ${SSH_PASSPHRASE} - port: ${SSH_PORT} script: - rm -f env-guacamole - "echo \"export POSTGRES_DB='$${POSTGRES_DB}'\" >> env-guacamole # \"postgres-db\"" - "echo \"export POSTGRES_USER='$${POSTGRES_USER}'\" >> env-guacamole # \"postgres-user\"" - "echo \"export POSTGRES_PASSWORD='$${POSTGRES_PASSWORD}'\" >> env-guacamole # \"postgres-password\"" - username: ${SSH_USER} environment: POSTGRES_DB: from_secret: postgres-db @@ -59,14 +54,9 @@ steps: image: appleboy/drone-scp:1.6.2@sha256:bd37a55f4b97e7742b0de7333669b96220b3cc422d366e1fa8c34059b736ab47 settings: command_timeout: 2m - host: ${SSH_HOST} - key: ${SSH_KEY} - passphrase: ${SSH_PASSPHRASE} - port: ${SSH_PORT} source: - . target: /stack/guacamole - username: ${SSH_USER} - name: wait image: alpine:3.12.0@sha256:90baa0922fe90624b05cb5766fa5da4e337921656c2f8e2b13bd3c052a0baac1 @@ -100,10 +90,6 @@ steps: - postgres_db - postgres_user - postgres_password - host: ${SSH_HOST} - key: ${SSH_KEY} - passphrase: ${SSH_PASSPHRASE} - port: ${SSH_PORT} script: - export POSTGRES_PASSWORD=$${POSTGRES_PASSWORD} - export POSTGRES_DB=$${POSTGRES_DB} @@ -116,7 +102,6 @@ steps: - sh .drone/login.sh - sh .drone/pull.sh - sh .drone/deploy.sh - username: ${SSH_USER} environment: POSTGRES_DB: from_secret: postgres-db diff --git a/.drone/package.json b/.drone/package.json index 22cfdd2..33bc5f1 100644 --- a/.drone/package.json +++ b/.drone/package.json @@ -4,6 +4,6 @@ "build": "drone jsonnet --source drone-home.jsonnet --target drone-home.yml --stream" }, "dependencies": { - "@sigyl/jsonnet-drone": "^0.1.0" + "@sigyl/jsonnet-drone": "^0.1.1" } } diff --git a/.drone/yarn.lock b/.drone/yarn.lock index 44ab354..35ba3cd 100644 --- a/.drone/yarn.lock +++ b/.drone/yarn.lock @@ -12,10 +12,10 @@ resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone-environment/-/jsonnet-drone-environment-0.0.5.tgz#9ea85e08904777bd21a3e4b30b0b91461d0285ff" integrity sha512-xVGmdMO1pOyozAWUbJm6mzKBgsLPJ+1hWnGCK3AxPkr7kkDh18hu30+TLzlcQtqq76s5jUfvJUztezsGj/mIcw== -"@sigyl/jsonnet-drone@^0.1.0": - version "0.1.0" - resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone/-/jsonnet-drone-0.1.0.tgz#feda1797e8e9ef799cad72e65f7163ca26a9e3a5" - integrity sha512-QY/ngucxFOtLfL8Mt0f2bxN4fQDUOGOFtaRpSH2cNyg84xADkzehT0ORZtbLitr+AwhyF5KN/zAGvzkyNAoqPw== +"@sigyl/jsonnet-drone@^0.1.1": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone/-/jsonnet-drone-0.1.1.tgz#37afda650e8420a664e89c762236a1e59aa485d9" + integrity sha512-GR7LXYaUJYjkcWRyyLlwrBX9Jw04Vlcc/XS32rNaSz4wtrD9opvnmESxNC1UTWXsT/3ybuQhLhCboEb2GiTWmw== dependencies: "@sigyl/jsonnet-compose" "^0.0.2" "@sigyl/jsonnet-drone-environment" "0.0.5" diff --git a/init-postgresql.sh b/init-postgresql.sh new file mode 100644 index 0000000..ac780e2 --- /dev/null +++ b/init-postgresql.sh @@ -0,0 +1,2 @@ +docker exec -it $1 psql -U postgres -d $POSTGRES_DB -f /initdb.sql +docker exec -it $1 psql -U postgres -d $POSTGRES_DB -f /init-user.sql -v password=$POSTGRES_PASSWORD -v user=$POSTGRES_USER \ No newline at end of file