Set up prod urls

Adjusts variables for production deployment
This commit is contained in:
Antony Messerli 2019-12-20 15:32:02 +00:00
parent a7b55b6de4
commit 35ee4ce2b5
2 changed files with 14 additions and 12 deletions

View File

@ -64,7 +64,7 @@ jobs:
edge: true edge: true
access_key_id: $AWS_ACCESS_KEY_ID access_key_id: $AWS_ACCESS_KEY_ID
secret_access_key: $AWS_SECRET_ACCESS_KEY secret_access_key: $AWS_SECRET_ACCESS_KEY
bucket: $BUCKET_LIVE bucket: $BUCKET_STAGING
local_dir: s3out-latest local_dir: s3out-latest
upload-dir: rc upload-dir: rc
skip_cleanup: true skip_cleanup: true
@ -74,7 +74,7 @@ jobs:
edge: true edge: true
access_key_id: $AWS_ACCESS_KEY_ID access_key_id: $AWS_ACCESS_KEY_ID
secret_access_key: $AWS_SECRET_ACCESS_KEY secret_access_key: $AWS_SECRET_ACCESS_KEY
bucket: $BUCKET_LIVE bucket: $BUCKET_STAGING
local_dir: s3out local_dir: s3out
upload-dir: $RELEASE_TAG upload-dir: $RELEASE_TAG
skip_cleanup: true skip_cleanup: true
@ -102,7 +102,7 @@ jobs:
branch: RC branch: RC
after_deploy: after_deploy:
- aws configure set preview.cloudfront true - aws configure set preview.cloudfront true
- aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DIST_ID_BOOT --paths "rc/*" "rc/ipxe/*" - aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DIST_ID_STAGING --paths "rc/*" "rc/ipxe/*"
- ./script/message rc-push - ./script/message rc-push
- stage: release - stage: release
@ -125,7 +125,7 @@ jobs:
edge: true edge: true
access_key_id: $AWS_ACCESS_KEY_ID access_key_id: $AWS_ACCESS_KEY_ID
secret_access_key: $AWS_SECRET_ACCESS_KEY secret_access_key: $AWS_SECRET_ACCESS_KEY
bucket: $BUCKET_LIVE bucket: $BUCKET_PROD
local_dir: s3out-latest local_dir: s3out-latest
skip_cleanup: true skip_cleanup: true
on: on:
@ -134,7 +134,7 @@ jobs:
edge: true edge: true
access_key_id: $AWS_ACCESS_KEY_ID access_key_id: $AWS_ACCESS_KEY_ID
secret_access_key: $AWS_SECRET_ACCESS_KEY secret_access_key: $AWS_SECRET_ACCESS_KEY
bucket: $BUCKET_LIVE bucket: $BUCKET_PROD
local_dir: s3out local_dir: s3out
upload-dir: $RELEASE_TAG upload-dir: $RELEASE_TAG
skip_cleanup: true skip_cleanup: true
@ -161,5 +161,5 @@ jobs:
branch: master branch: master
after_deploy: after_deploy:
- aws configure set preview.cloudfront true - aws configure set preview.cloudfront true
- aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DIST_ID_BOOT --paths "/*" "/ipxe/*" - aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DIST_ID_PROD --paths "/*" "/ipxe/*"
- ./script/message live-push - ./script/message live-push

View File

@ -4,12 +4,14 @@ set -e
TYPE=$1 TYPE=$1
HARD_RELEASE="2.x" HARD_RELEASE="2.x"
HARD_RC="2.x-RC" HARD_RC="2.x-RC"
LIVE_URL="staging.boot.netboot.xyz" DEV_URL="dev.boot.netboot.xyz"
STAGING_URL="staging.boot.netboot.xyz"
PROD_URL="boot.netboot.xyz"
DOCKER_FILE="Dockerfile-build.production" DOCKER_FILE="Dockerfile-build.production"
# Set boot domain # Set boot domain
if [[ "${TYPE}" == "dev" ]]; then if [[ "${TYPE}" == "dev" ]]; then
BOOT_DOMAIN="s3.amazonaws.com/${BUCKET_DEV}/${TRAVIS_COMMIT}" BOOT_DOMAIN="s3.amazonaws.com/${DEV_URL}/${TRAVIS_COMMIT}"
BOOT_VERSION="Development" BOOT_VERSION="Development"
elif [[ "${TYPE}" == "pr" ]]; then elif [[ "${TYPE}" == "pr" ]]; then
BOOT_DOMAIN="test.com" BOOT_DOMAIN="test.com"
@ -17,10 +19,10 @@ elif [[ "${TYPE}" == "pr" ]]; then
DOCKER_FILE="Dockerfile-build" DOCKER_FILE="Dockerfile-build"
elif [[ "${TYPE}" == "rc" ]]; then elif [[ "${TYPE}" == "rc" ]]; then
BOOT_VERSION=$(cat version.txt)-RC BOOT_VERSION=$(cat version.txt)-RC
BOOT_DOMAIN="${LIVE_URL}/${BOOT_VERSION}" BOOT_DOMAIN="${STAGING_URL}/${BOOT_VERSION}"
elif [[ "${TYPE}" == "release" ]]; then elif [[ "${TYPE}" == "release" ]]; then
BOOT_VERSION=$(cat version.txt) BOOT_VERSION=$(cat version.txt)
BOOT_DOMAIN="${LIVE_URL}/${BOOT_VERSION}" BOOT_DOMAIN="${PROD_URL}/${BOOT_VERSION}"
fi fi
sed -i \ sed -i \
"/^#boot_version/c\boot_version: \"${BOOT_VERSION}\"" \ "/^#boot_version/c\boot_version: \"${BOOT_VERSION}\"" \
@ -51,7 +53,7 @@ if [[ "${TYPE}" == "release" ]] || [[ "${TYPE}" == "rc" ]]; then
if [[ "${TYPE}" == "release" ]]; then if [[ "${TYPE}" == "release" ]]; then
sed -i \ sed -i \
-e "/^boot_version/c\boot_version: \"${HARD_RELEASE}\"" \ -e "/^boot_version/c\boot_version: \"${HARD_RELEASE}\"" \
-e "/^boot_domain/c\boot_domain: ${LIVE_URL}" \ -e "/^boot_domain/c\boot_domain: ${PROD_URL}" \
user_overrides.yml user_overrides.yml
docker build -t localbuild -f ${DOCKER_FILE} . docker build -t localbuild -f ${DOCKER_FILE} .
docker run --rm -it -v $(pwd):/buildout localbuild docker run --rm -it -v $(pwd):/buildout localbuild
@ -59,7 +61,7 @@ if [[ "${TYPE}" == "release" ]] || [[ "${TYPE}" == "rc" ]]; then
if [[ "${TYPE}" == "rc" ]]; then if [[ "${TYPE}" == "rc" ]]; then
sed -i \ sed -i \
-e "/^boot_version/c\boot_version: \"${HARD_RC}\"" \ -e "/^boot_version/c\boot_version: \"${HARD_RC}\"" \
-e "/^boot_domain/c\boot_domain: ${LIVE_URL}/rc" \ -e "/^boot_domain/c\boot_domain: ${STAGING_URL}/rc" \
user_overrides.yml user_overrides.yml
docker build -t localbuild -f ${DOCKER_FILE} . docker build -t localbuild -f ${DOCKER_FILE} .
docker run --rm -it -v $(pwd):/buildout localbuild docker run --rm -it -v $(pwd):/buildout localbuild