Skip to content

Commit

Permalink
refactoring how node-packages are loaded:
Browse files Browse the repository at this point in the history
- using lerna to keep track of versions for all node-packages
- using relative paths in services to load node-packages
- hack to load node-packages for each service with git cloning the git repo again as we don't have access to the parent directories because of docker context
- linking node-packes with yarn link when we run dev modes locally so we have them in realtime within the services
- new container (node-packages-lerna) which runs 'yarn run watch' in all node-packages
  • Loading branch information
Schnitzel committed Jul 6, 2017
1 parent 4034734 commit 0c81853
Show file tree
Hide file tree
Showing 56 changed files with 16,843 additions and 835 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ deploytest
*.retry
startVagrant.sh
minishift
**/v8-*
33 changes: 21 additions & 12 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ version: '2'
services:
webhook-handler:
build: services/webhook-handler
command: yarn run dev
command: bash -c "yarn run link-node-packages && yarn run dev"
ports:
- "7777:7777"
links:
- rabbitmq
environment:
- RABBITMQ_HOST=rabbitmq
volumes:
- ./services/webhook-handler/src:/app/src
- ./services/webhook-handler/src:/app/services/webhook-handler/src
- ./node-packages:/node-packages
rabbitmq:
build: services/rabbitmq
environment:
Expand All @@ -37,7 +38,7 @@ services:
# - ./services/gitpush2ansibledeploy/src:/app/src
openshiftremove:
build: services/openshiftremove
command: yarn run dev
command: bash -c "yarn run link-node-packages && yarn run dev"
links:
- rabbitmq
- api
Expand All @@ -47,10 +48,11 @@ services:
- AMAZEEIO_API_HOST=http://api:3000
- JENKINS_URL=http://admin:admin@jenkins:8080
volumes:
- ./services/openshiftremove/src:/app/src
- ./services/openshiftremove/src:/app/services/openshiftremove/src
- ./node-packages:/node-packages
openshiftdeploy:
build: services/openshiftdeploy
command: yarn run dev
command: bash -c "yarn run link-node-packages && yarn run dev"
links:
- rabbitmq
- api
Expand All @@ -62,11 +64,11 @@ services:
- OC_BUILD_DEPLOY_IMAGE_LOCATION=absolute
- DOCKER_RUN_PARARM=--network=lagoon_default
volumes:
- ./services/openshiftdeploy/src:/app/src
- ./node-packages:/node-packages
- ./services/openshiftdeploy/src:/app/services/openshiftdeploy/src
- ./node-packages:/app/node-packages
logs2slack:
build: services/logs2slack
command: yarn run dev
command: bash -c "yarn run link-node-packages && yarn run dev"
links:
- rabbitmq
- api
Expand All @@ -76,27 +78,29 @@ services:
- AMAZEEIO_API_HOST=http://api:3000
volumes:
- ./services/logs2slack/src:/app/src
- ./node-packages:/node-packages
webhooks2tasks:
build: services/webhooks2tasks
command: yarn run dev
command: bash -c "yarn run link-node-packages && yarn run dev"
links:
- rabbitmq
- api
environment:
- RABBITMQ_HOST=rabbitmq
- AMAZEEIO_API_HOST=http://api:3000
volumes:
- ./services/webhooks2tasks/src:/app/src
- ./services/webhooks2tasks/src:/app/services/webhooks2tasks/src
- ./node-packages:/node-packages
rest2tasks:
build: services/rest2tasks
command: yarn run dev
command: bash -c "yarn run link-node-packages && yarn run dev"
links:
- rabbitmq
environment:
- RABBITMQ_HOST=rabbitmq
- AMAZEEIO_API_HOST=http://api:3000
volumes:
- ./services/rest2tasks/src:/app/src
- ./services/rest2tasks/src:/app/services/rest2tasks/src
- ./node-packages:/node-packages
ports:
- "5555:3000"
Expand Down Expand Up @@ -190,3 +194,8 @@ services:
- rest2tasks
ports:
- "8090:3000"
node-packages-lerna:
build: node-packages
command: lerna run --parallel watch
volumes:
- .:/app
11 changes: 11 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"lerna": "2.0.0-rc.5",
"packages": [
"node-packages/*"
],
"version": "independent",
"npmClient": "yarn",
"npmClientArgs": [
"--no-optional"
]
}
1 change: 1 addition & 0 deletions node-packages/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/node_modules
2 changes: 2 additions & 0 deletions node-packages/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM amazeeio/centos7-node-builder:6
RUN yarn global add lerna
3 changes: 2 additions & 1 deletion node-packages/amazeeio-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"start": "node dist/index.js",
"build": "babel src -d dist",
"prepublish": "yarn run build",
"dev": "nodemon src/index.js --exec babel-node"
"dev": "nodemon src/index.js --exec babel-node",
"watch": "nodemon --ignore dist --exec 'yarn run build'"
},
"author": "amazee.io <[email protected]> (http://www.amazee.io)",
"repository": {
Expand Down
Loading

0 comments on commit 0c81853

Please sign in to comment.