Skip to content
Permalink
Browse files

Merge pull request #4896 from reactioncommerce/release-2.0.0-rc.8

Release 2.0.0 rc.8
  • Loading branch information...
spencern committed Jan 11, 2019
2 parents 231757b + 05a42a4 commit 98b24baef64afaf554669f5efe30e8476702a829
Showing 453 changed files with 12,720 additions and 4,708 deletions.
@@ -3,9 +3,10 @@
sudo apt-get -y install python3-pip wget
sudo pip3 install awscli

export ENVIRONMENT=feat
export ENVIRONMENT=staging
export CLUSTER=core
export SERVICE_SUFFIX=$CIRCLE_BRANCH
# remove spaces from branch name
export SERVICE_FEATURE=`echo $CIRCLE_BRANCH | sed 's/ //g'`
export SERVICE1=reaction-core
export CONTAINER1=core
export core_CIRCLE_SHA1=$CIRCLE_SHA1
@@ -39,16 +40,24 @@ sudo mv propel /usr/local/bin/propel
sudo chmod +x /usr/local/bin/propel

RELEASE_DESCRIPTION="CircleCI build URL: ${CIRCLE_BUILD_URL}"
propel param copy -f ${PROPEL_CONFIG_FILE} --env $ENVIRONMENT --cluster $CLUSTER --service $SERVICE1 --container $CONTAINER1 --suffix $SERVICE_SUFFIX --overwrite
propel param set ROOT_URL=https://${SERVICE1}-${SERVICE_SUFFIX}.$ENVIRONMENT.reactioncommerce.com/ -f ${PROPEL_CONFIG_FILE} --env $ENVIRONMENT --cluster $CLUSTER --service $SERVICE1 --container $CONTAINER1 --suffix $SERVICE_SUFFIX --overwrite
propel release create --deploy -f ${PROPEL_CONFIG_FILE} --env $ENVIRONMENT --cluster $CLUSTER --descr "${RELEASE_DESCRIPTION}" --service $SERVICE1 --suffix $SERVICE_SUFFIX

export SERVICE2=storefront
propel param copy -f ${PROPEL_CONFIG_FILE} --env $ENVIRONMENT --cluster $CLUSTER --service $SERVICE1 --container $CONTAINER1 --feature $SERVICE_FEATURE --overwrite

propel param set ROOT_URL=https://${SERVICE1}-${SERVICE_FEATURE}.$ENVIRONMENT.reactioncommerce.com/ -f ${PROPEL_CONFIG_FILE} --env $ENVIRONMENT --cluster $CLUSTER --service $SERVICE1 --container $CONTAINER1 --feature $SERVICE_FEATURE --overwrite

propel release create --deploy -f ${PROPEL_CONFIG_FILE} --env $ENVIRONMENT --cluster $CLUSTER --descr "${RELEASE_DESCRIPTION}" --service $SERVICE1 --feature $SERVICE_FEATURE

export SERVICE2=storefront-core
export CONTAINER1=nginx
export CONTAINER2=storefront
propel param copy -f ${PROPEL_CONFIG_FILE} --env $ENVIRONMENT --cluster $CLUSTER --service $SERVICE2 --container $CONTAINER2 --suffix $SERVICE_SUFFIX --overwrite
propel param set CANONICAL_URL=https://${SERVICE1}-${SERVICE_SUFFIX}.$ENVIRONMENT.reactioncommerce.com -f ${PROPEL_CONFIG_FILE} --env $ENVIRONMENT --cluster $CLUSTER --service $SERVICE2 --container $CONTAINER2 --suffix $SERVICE_SUFFIX --overwrite
propel param set OAUTH2_REDIRECT_URL=https://${SERVICE2}-${SERVICE_SUFFIX}.$ENVIRONMENT.reactioncommerce.com/callback -f ${PROPEL_CONFIG_FILE} --env $ENVIRONMENT --cluster $CLUSTER --service $SERVICE2 --container $CONTAINER2 --suffix $SERVICE_SUFFIX --overwrite
propel param set OAUTH2_IDP_HOST_URL=https://${SERVICE1}-${SERVICE_SUFFIX}.$ENVIRONMENT.reactioncommerce.com -f ${PROPEL_CONFIG_FILE} --env $ENVIRONMENT --cluster $CLUSTER --service $SERVICE2 --container $CONTAINER2 --suffix $SERVICE_SUFFIX --overwrite
propel param set EXTERNAL_GRAPHQL_URL=https://${SERVICE1}-${SERVICE_SUFFIX}.$ENVIRONMENT.reactioncommerce.com/graphql-alpha -f ${PROPEL_CONFIG_FILE} --env $ENVIRONMENT --cluster $CLUSTER --service $SERVICE2 --container $CONTAINER2 --suffix $SERVICE_SUFFIX --overwrite
propel param set INTERNAL_GRAPHQL_URL=https://${SERVICE1}-${SERVICE_SUFFIX}.$ENVIRONMENT.reactioncommerce.com/graphql-alpha -f ${PROPEL_CONFIG_FILE} --env $ENVIRONMENT --cluster $CLUSTER --service $SERVICE2 --container $CONTAINER2 --suffix $SERVICE_SUFFIX --overwrite
propel release create --deploy -f ${PROPEL_CONFIG_FILE} --env $ENVIRONMENT --cluster $CLUSTER --descr "${RELEASE_DESCRIPTION}" --service $SERVICE2 --suffix $SERVICE_SUFFIX

propel param copy -f ${PROPEL_CONFIG_FILE} --env $ENVIRONMENT --cluster $CLUSTER --service $SERVICE2 --container $CONTAINER1 --feature $SERVICE_FEATURE --overwrite
propel param copy -f ${PROPEL_CONFIG_FILE} --env $ENVIRONMENT --cluster $CLUSTER --service $SERVICE2 --container $CONTAINER2 --feature $SERVICE_FEATURE --overwrite

propel param set CANONICAL_URL=https://${SERVICE2}-${SERVICE_FEATURE}.$ENVIRONMENT.reactioncommerce.com -f ${PROPEL_CONFIG_FILE} --env $ENVIRONMENT --cluster $CLUSTER --service $SERVICE2 --container $CONTAINER2 --feature $SERVICE_FEATURE --overwrite
propel param set OAUTH2_REDIRECT_URL=https://${SERVICE2}-${SERVICE_FEATURE}.$ENVIRONMENT.reactioncommerce.com/callback -f ${PROPEL_CONFIG_FILE} --env $ENVIRONMENT --cluster $CLUSTER --service $SERVICE2 --container $CONTAINER2 --feature $SERVICE_FEATURE --overwrite
propel param set OAUTH2_IDP_HOST_URL=https://${SERVICE1}-${SERVICE_FEATURE}.$ENVIRONMENT.reactioncommerce.com -f ${PROPEL_CONFIG_FILE} --env $ENVIRONMENT --cluster $CLUSTER --service $SERVICE2 --container $CONTAINER2 --feature $SERVICE_FEATURE --overwrite
propel param set EXTERNAL_GRAPHQL_URL=https://${SERVICE1}-${SERVICE_FEATURE}.$ENVIRONMENT.reactioncommerce.com/graphql-alpha -f ${PROPEL_CONFIG_FILE} --env $ENVIRONMENT --cluster $CLUSTER --service $SERVICE2 --container $CONTAINER2 --feature $SERVICE_FEATURE --overwrite
propel param set INTERNAL_GRAPHQL_URL=https://${SERVICE1}-${SERVICE_FEATURE}.$ENVIRONMENT.reactioncommerce.com/graphql-alpha -f ${PROPEL_CONFIG_FILE} --env $ENVIRONMENT --cluster $CLUSTER --service $SERVICE2 --container $CONTAINER2 --feature $SERVICE_FEATURE --overwrite

propel release create --deploy -f ${PROPEL_CONFIG_FILE} --env $ENVIRONMENT --cluster $CLUSTER --descr "${RELEASE_DESCRIPTION}" --service $SERVICE2 --feature $SERVICE_FEATURE
@@ -6,6 +6,7 @@ sudo pip3 install awscli
export ENVIRONMENT=staging
export CLUSTER=core
export core_CIRCLE_SHA1=$CIRCLE_SHA1
echo core_CIRCLE_SHA1=${core_CIRCLE_SHA1}

PROPEL_CONFIG_FILE="propel.yaml"
if [ ! -f ${PROPEL_CONFIG_FILE} ]; then
@@ -36,4 +37,5 @@ sudo mv propel /usr/local/bin/propel
sudo chmod +x /usr/local/bin/propel

RELEASE_DESCRIPTION="CircleCI build URL: ${CIRCLE_BUILD_URL}"
propel release create --deploy --env $ENVIRONMENT --cluster $CLUSTER --descr "${RELEASE_DESCRIPTION}"
echo Running propel release create --deploy --env $ENVIRONMENT --cluster $CLUSTER --descr "${RELEASE_DESCRIPTION}"
propel release create --deploy --env $ENVIRONMENT --cluster $CLUSTER --descr "${RELEASE_DESCRIPTION}"
@@ -77,14 +77,6 @@ jobs:
key: ${GLOBAL_CACHE_VERSION}-node-modules-{{ .Branch }}-{{ epoch }}
paths:
- node_modules
# mongodb-memory-server installs Mongo binary on npm install, which we need
# later when we run Jest integration tests
- save_cache:
name: Saving mongodb-memory-server MongoDB cache
key: mongodb-memory-server
paths:
- ~/.mongodb-binaries


docker-build:
<<: *defaults
@@ -256,16 +248,25 @@ jobs:
- checkout
- restore_cache:
keys:
- v1-node-modules-{{ checksum "package.json" }}-{{ checksum "package-lock.json" }}
- v1-node-modules-{{ .Branch }}
- v1-node-modules-master
- restore_cache:
name: Restoring mongodb-memory-server MongoDB cache
key: mongodb-memory-server
- ${GLOBAL_CACHE_VERSION}-node-modules-{{ checksum "package.json" }}-{{ checksum "package-lock.json" }}
- ${GLOBAL_CACHE_VERSION}-node-modules-{{ .Branch }}
- ${GLOBAL_CACHE_VERSION}-node-modules-master
- run:
name: Run Integration Tests
command: npm run test:integration

test-e2e:
<<: *defaults
docker:
- image: reactioncommerce/reaction-automation-client:latest
steps:
- setup_remote_docker:
docker_layer_caching: true
- run:
name: Run Tests
command: |
docker run -t -e URL=${STAGING_URL} reactioncommerce/reaction-automation-client:latest npm run-script chrome
dockerfile-lint:
<<: *defaults
docker:
@@ -276,7 +277,7 @@ jobs:
docker_layer_caching: true
- run:
name: Dockerfile Lint
command: |
command: |
hadolint Dockerfile
snyk-security:
@@ -331,10 +332,12 @@ workflows:
- test-unit:
requires:
- build
# TODO uncomment and figure out why they always fail on CI
# - test-integration:
# requires:
# - build
- test-integration:
requires:
- build
- test-e2e:
requires:
- deploy-to-ecs-release-branch
- eslint:
requires:
- build
@@ -352,12 +355,12 @@ workflows:
filters:
branches:
only: /^release-2.*/
- deploy-to-ecs-feature-branch:
requires:
- docker-push
filters:
branches:
only: /^feat.*/
# - deploy-to-ecs-feature-branch:
# requires:
# - docker-push
# filters:
# branches:
# only: /^feat.*/
- deploy-docs:
requires:
- test-unit
@@ -1,11 +1,14 @@
REACTION_EMAIL=me@example.com
REACTION_AUTH=somepassword
REACTION_USER=ReactionAdmin
MONGO_URL=mongodb://mongo:27017/reaction
MONGO_OPLOG_URL=mongodb://mongo:27017/local
ROOT_URL=http://localhost:3000
HYDRA_ADMIN_URL=http://hydra:4445
HYDRA_TOKEN_URL=http://hydra:4444/oauth2/token
HYDRA_OAUTH2_INTROSPECT_URL=http://hydra:4445/oauth2/introspect
HYDRA_TOKEN_URL=http://hydra:4444/oauth2/token
METEOR_DISABLE_OPTIMISTIC_CACHING=1
METEOR_WATCH_POLLING_INTERVAL_MS=10000
MONGO_OPLOG_URL=mongodb://mongo:27017/local
MONGO_URL=mongodb://mongo:27017/reaction
OAUTH2_CLIENT_DOMAINS=http://localhost:4000
SKIP_FIXTURES=1
REACTION_AUTH=r3@cti0n
REACTION_EMAIL=admin@localhost
REACTION_SECURE_DEFAULT_ADMIN=false
REACTION_USER_NAME=admin
REACTION_USER=Admin
ROOT_URL=http://localhost:3000
@@ -48,11 +48,10 @@ twitter-config-ui@1.0.0
# Community Packages
alanning:roles
aldeed:autoform@6.2.0
aldeed:collection2@3.0.0
aldeed:collection2@3.0.1
aldeed:schema-index@3.0.0
aldeed:template-extension
bozhao:accounts-instagram
dispatch:run-as-user
meteorhacks:ssr
meteorhacks:subs-manager
ongoworks:security
@@ -6,7 +6,7 @@ accounts-password@1.5.1
accounts-twitter@1.4.2
alanning:roles@1.2.16
aldeed:autoform@6.3.0
aldeed:collection2@3.0.0
aldeed:collection2@3.0.1
aldeed:schema-index@3.0.0
aldeed:template-extension@4.1.0
allow-deny@1.1.0
@@ -38,7 +38,6 @@ ddp-rate-limiter@1.0.7
ddp-server@2.2.0
deps@1.0.12
diff-sequence@1.1.0
dispatch:run-as-user@1.1.1
dynamic-import@0.5.0
ecmascript@0.12.1
ecmascript-runtime@0.7.0
@@ -0,0 +1,41 @@
This directory contains project hooks for the Reaction development environment.
They are invoked from the reaction-platform build tools which operate across all
projects to aid with orchestration.

These hooks provide means for developers of an application to ensure that the
application configure itself without higher-level coordination outside of the
project.

## Included Hooks

| Name | Description |
| -------------------- | ---------------------------------------------------- |
| `pre-build` | Invoked before Docker build. |
| `post-build` | Invoked after Docker build and before project start. |
| `post-project-start` | Invoked after project start. |
| `post-system-start` | Invoked after entire system start. |

More information can be found in the header documentation of each script.

## General Best Practices

### Check that Services Are Available Before Using Them

The `post-project-start` and `post-system-start` hooks are called after the
services are started with Docker. Though they have been started, it's possible
that they will not yet be available to perform any script actions. This depends
on the startup time for you application.

This can lead to race conditions if you try to use a service in a hook script.

Always check that any service is available before using it.

Tools like [await](https://github.com/betalo-sweden/await) can help.

### Keep Hook Scripts Lightweight

It can be tempting to add code directly to the hook script to directly perform
a task.

It is better to create a script in your project and call it from the hook. This
keeps the scripted action reusable and available outside of the hook context.
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
# Post Build Hook
# Invoked by the reaction-next project bootstrapping process.
#
# Invoked after Docker build.
# Perform any actions here that are required after docker-compose build but
# before the project is started.
#
# Important Notes:
#
# - Expect that services are NOT running at this time.
# - Do not assume that this hook script will run from this local directory.
# The $__dir var is provided for convenience and may be used to invoke other
# scripts.
# - It is good practice to keep this script lightweight and invoke setup
# scripts in your project.

__current_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
__root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
__root_name=$(basename "${__root_dir}")

echo "${__root_name} post-build script invoked." 2>&1
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
# Post Project Start Hook
# Invoked by the reaction-next project bootstrapping process.
#
# Invoked after this service is started. Can be used for project specific
# actions that should be performed after the project is running, like database
# setup, migrations, seeds, etc. Do not depend on other projects in this hook!
#
# Important Notes:
#
# - The hook runs after all Docker Compose services in THIS project are
# started. Though started, there is no guarantee that these services are
# ready (i.e. that they will respond to requests.) It is your responsibility
# to test that services are available before using them to avoid race
# conditions.
# - Do not assume that this hook script will run from this local directory.
# The $__dir var is provided for convenience and may be used to invoke other
# scripts.
# - It is good practice to keep this script lightweight and invoke setup
# scripts in your project.

__current_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
__root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
__root_name=$(basename "${__root_dir}")

echo "${__root_name} post-project-start script invoked." 2>&1
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
# Post System Start Hook
# Invoked by the reaction-next project bootstrapping process.
#
# Invoked after all services in the system have been started.
#
# Important Notes:
#
# - The hook runs after all Docker Compose services in ALL projects are
# started. Though started, there is no guarantee that these services are
# ready (i.e. that they will respond to requests.) It is your responsibility
# to test that services are available before using them to avoid race
# conditions.
# - Do not assume that this hook script will run from this local directory.
# The $__dir var is provided for convenience and may be used to invoke other
# scripts.
# - It is good practice to keep this script lightweight and invoke setup
# scripts in your project.

__current_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
__root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
__root_name=$(basename "${__root_dir}")

echo "${__root_name} post-system-start script invoked." 2>&1
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
# Pre Build Hook
# Invoked by the reaction-next project bootstrapping process.
#
# Invoked before Docker build.
# Perform any actions here that are required before docker-compose build. For
# example, copying values from .env.example to .env.
#
# Important Notes:
#
# - Expect that services are NOT running at this time.
# - Do not assume that this hook script will run from this local directory.
# The $__dir var is provided for convenience and may be used to invoke other
# scripts.
# - It is good practice to keep this script lightweight and invoke setup
# scripts in your project.

__current_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
__root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
__root_name=$(basename "${__root_dir}")

echo "${__root_name} post-project-start script invoked." 2>&1

"${__root_dir}/bin/setup"
Oops, something went wrong.

0 comments on commit 98b24ba

Please sign in to comment.
You can’t perform that action at this time.