From f181336df28d838a6d2f8cdf5ef151b033179b33 Mon Sep 17 00:00:00 2001 From: Josh Worden Date: Wed, 12 Jun 2019 09:01:51 -0500 Subject: [PATCH 1/4] Set default service URLs --- packages/service-clients/src/env.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/service-clients/src/env.js b/packages/service-clients/src/env.js index dc4b21d4..96d42396 100644 --- a/packages/service-clients/src/env.js +++ b/packages/service-clients/src/env.js @@ -17,6 +17,6 @@ const services = [ module.exports = cleanEnv(process.env, services.reduce((o, name) => { const prop = `${name.toUpperCase()}_SERVICE_URL`; - const validator = nonemptystr({ desc: `The ID|Me ${name} service URL to connect to.` }); + const validator = nonemptystr({ desc: `The ID|Me ${name} service URL to connect to.`, default: `http://${name}` }); return { ...o, [prop]: validator }; }, {})); From 2915a9449bb5665f3c3d9d64e770eabcde131398 Mon Sep 17 00:00:00 2001 From: Josh Worden Date: Wed, 12 Jun 2019 09:02:37 -0500 Subject: [PATCH 2/4] CD support for locale service --- .travis.yml | 4 ++++ scripts/deploy.js | 1 + 2 files changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index 38d3c185..196acc51 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,6 +31,10 @@ jobs: name: GraphQL Service script: scripts/deploy.js graphql + - stage: deploy + name: Locale Service + script: scripts/deploy.js locale + - stage: deploy name: Mailer Service script: scripts/deploy.js mailer diff --git a/scripts/deploy.js b/scripts/deploy.js index ef822c4d..be7717df 100755 --- a/scripts/deploy.js +++ b/scripts/deploy.js @@ -31,6 +31,7 @@ const image = `basecms/identity-x-${service}-service`; const nrIds = { application: 238098240, graphql: 238106643, + locale: 242186677, mailer: 238106582, membership: 238106610, organization: 238106397, From cc9e4b512d554c7145a5ad1b091a00107a53aff4 Mon Sep 17 00:00:00 2001 From: Josh Worden Date: Wed, 12 Jun 2019 09:37:09 -0500 Subject: [PATCH 3/4] Update docker builds --- Dockerfile | 12 ++++++++++++ scripts/deploy-image.sh | 11 ++--------- services/application/Dockerfile | 9 --------- services/locale/Dockerfile | 9 --------- services/mailer/Dockerfile | 9 --------- services/membership/Dockerfile | 9 --------- services/organization/Dockerfile | 9 --------- services/token/Dockerfile | 9 --------- services/user/Dockerfile | 9 --------- 9 files changed, 14 insertions(+), 72 deletions(-) create mode 100644 Dockerfile delete mode 100644 services/application/Dockerfile delete mode 100644 services/locale/Dockerfile delete mode 100644 services/mailer/Dockerfile delete mode 100644 services/membership/Dockerfile delete mode 100644 services/organization/Dockerfile delete mode 100644 services/token/Dockerfile delete mode 100644 services/user/Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..640ee397 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM node:10.15 +WORKDIR /identity-x +ENV NODE_ENV production +ARG SERVICE + +ADD package.json yarn.lock /identity-x/ +ADD packages /identity-x/packages +ADD services/$SERVICE /identity-x/services/$SERVICE +RUN yarn --production --pure-lockfile + +WORKDIR /identity-x/services/$SERVICE +ENTRYPOINT [ "./node_modules/.bin/micro", "-l", "tcp://0.0.0.0:80" ] diff --git a/scripts/deploy-image.sh b/scripts/deploy-image.sh index ffb62b51..5a36f426 100755 --- a/scripts/deploy-image.sh +++ b/scripts/deploy-image.sh @@ -2,15 +2,8 @@ set -e echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin -mv services ../ -mkdir services -mv ../services/$1 services/ - -cp "services/$1/Dockerfile" Dockerfile -docker build -q -t "$1:$2" --build-arg SERVICE=$1 . - -mv ../services/* services/ -rm -rf ../services +[[ -f "services/$1/Dockerfile" ]] && cp "services/$1/Dockerfile" Dockerfile +docker build -t "$1:$2" --build-arg SERVICE=$1 . docker tag "$1:$2" "basecms/identity-x-$1-service:$2" docker push "basecms/identity-x-$1-service:$2" diff --git a/services/application/Dockerfile b/services/application/Dockerfile deleted file mode 100644 index c7a3a2af..00000000 --- a/services/application/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM node:10.15 -ENV NODE_ENV production -ADD ./ /id-me -WORKDIR /id-me - -RUN yarn --production - -WORKDIR /id-me/services/application -ENTRYPOINT [ "./node_modules/.bin/micro", "-l", "tcp://0.0.0.0:80" ] diff --git a/services/locale/Dockerfile b/services/locale/Dockerfile deleted file mode 100644 index 238fd899..00000000 --- a/services/locale/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM node:10.15 -ENV NODE_ENV production -ADD ./ /id-me -WORKDIR /id-me - -RUN yarn --production - -WORKDIR /id-me/services/locale -ENTRYPOINT [ "./node_modules/.bin/micro", "-l", "tcp://0.0.0.0:80" ] diff --git a/services/mailer/Dockerfile b/services/mailer/Dockerfile deleted file mode 100644 index d7063e2b..00000000 --- a/services/mailer/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM node:10.15 -ENV NODE_ENV production -ADD ./ /id-me -WORKDIR /id-me - -RUN yarn --production - -WORKDIR /id-me/services/mailer -ENTRYPOINT [ "./node_modules/.bin/micro", "-l", "tcp://0.0.0.0:80" ] diff --git a/services/membership/Dockerfile b/services/membership/Dockerfile deleted file mode 100644 index 5b97e1bf..00000000 --- a/services/membership/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM node:10.15 -ENV NODE_ENV production -ADD ./ /id-me -WORKDIR /id-me - -RUN yarn --production - -WORKDIR /id-me/services/membership -ENTRYPOINT [ "./node_modules/.bin/micro", "-l", "tcp://0.0.0.0:80" ] diff --git a/services/organization/Dockerfile b/services/organization/Dockerfile deleted file mode 100644 index 13c36b04..00000000 --- a/services/organization/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM node:10.15 -ENV NODE_ENV production -ADD ./ /id-me -WORKDIR /id-me - -RUN yarn --production - -WORKDIR /id-me/services/organization -ENTRYPOINT [ "./node_modules/.bin/micro", "-l", "tcp://0.0.0.0:80" ] diff --git a/services/token/Dockerfile b/services/token/Dockerfile deleted file mode 100644 index a6a48a28..00000000 --- a/services/token/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM node:10.15 -ENV NODE_ENV production -ADD ./ /id-me -WORKDIR /id-me - -RUN yarn --production - -WORKDIR /id-me/services/token -ENTRYPOINT [ "./node_modules/.bin/micro", "-l", "tcp://0.0.0.0:80" ] diff --git a/services/user/Dockerfile b/services/user/Dockerfile deleted file mode 100644 index 377ee27f..00000000 --- a/services/user/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM node:10.15 -ENV NODE_ENV production -ADD ./ /id-me -WORKDIR /id-me - -RUN yarn --production - -WORKDIR /id-me/services/user -ENTRYPOINT [ "./node_modules/.bin/micro", "-l", "tcp://0.0.0.0:80" ] From 5299d3bb08a593593260385c78439cd5756002e3 Mon Sep 17 00:00:00 2001 From: Josh Worden Date: Wed, 12 Jun 2019 09:37:21 -0500 Subject: [PATCH 4/4] Unify graph & manage builds --- services/graphql/Dockerfile | 11 +++++++---- services/manage/Dockerfile | 12 +++++++----- services/manage/nginx.conf | 2 +- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/services/graphql/Dockerfile b/services/graphql/Dockerfile index a193f273..5a144e9c 100644 --- a/services/graphql/Dockerfile +++ b/services/graphql/Dockerfile @@ -1,9 +1,12 @@ FROM node:10.15 +WORKDIR /identity-x ENV NODE_ENV production -ADD ./ /id-me -WORKDIR /id-me +ARG SERVICE -RUN yarn --production +ADD package.json yarn.lock /identity-x/ +ADD packages /identity-x/packages +ADD services/$SERVICE /identity-x/services/$SERVICE +RUN yarn --production --pure-lockfile -WORKDIR /id-me/services/graphql +WORKDIR /identity-x/services/$SERVICE ENTRYPOINT [ "node", "src/index.js" ] diff --git a/services/manage/Dockerfile b/services/manage/Dockerfile index 46964238..3b79fdbf 100644 --- a/services/manage/Dockerfile +++ b/services/manage/Dockerfile @@ -1,11 +1,13 @@ FROM danlynn/ember-cli:3.9.0 as ember -WORKDIR /id-me -COPY package.json yarn.lock /id-me/ -COPY ./services/manage /id-me/services/manage/ +WORKDIR /identity-x + +ADD package.json yarn.lock /identity-x/ +ADD packages /identity-x/packages +ADD services/manage /identity-x/services/manage RUN yarn -WORKDIR /id-me/services/manage +WORKDIR /identity-x/services/manage RUN ember build --env=production FROM nginx:alpine -COPY --from=ember /id-me/services/manage/dist /id-me/services/manage/dist +COPY --from=ember /identity-x/services/manage/dist /identity-x/services/manage/dist COPY ./services/manage/nginx.conf /etc/nginx/conf.d/manage.conf diff --git a/services/manage/nginx.conf b/services/manage/nginx.conf index 9f8db066..05daa0a1 100644 --- a/services/manage/nginx.conf +++ b/services/manage/nginx.conf @@ -4,7 +4,7 @@ server { gunzip on; listen 80 default_server; listen [::]:80 default_server; - root /id-me/services/manage/dist; + root /identity-x/services/manage/dist; index index.html; location / { try_files $uri $uri/ /index.html;