google-cloud-node-cluster
google-cloud-node-cluster copied to clipboard
Run a Node.js Cluster with Express on Google Cloud Platform.
google-cloud-node-cluster
Run a Node.js Cluster with Express on Google Cloud Platform.
Setup
- Install Google Cloud SDK
- Create a project on Google Cloud Platform and note down the Project ID
- Enable Google Cloud Platform > Billing
- If using Travis CI:
- Create an account on Travis CI and activate your repository
- Enable Google Cloud Platform > Google App Engine Admin API
- Create a service account on Google Cloud Platform > IAM with Project > Editor role and download the JSON private key
- Rename the downloaded private key to
travis.server.prod.key.jsonand save it in theenvironment/privatefolder - Execute
gem install travis - Execute
travis login - Execute
tar cvf environment/private.tar -C environment/private . && travis encrypt-file environment/private.tar environment/private.tar.enc -f && rm -f environment/private.tar - Replace
encrypted_xxxxxxxxxxxx_keyandencrypted_xxxxxxxxxxxx_ivin the .travis.yml with the values generated in the previous step
Install
npm install
Start
npm start
Develop
npm run develop
Test
npm test
Deploy
Command Line
Replace GOOGLE-CLOUD-PLATFORM-PROJECT-ID with your Project ID and execute the following command.
export ENVIRONMENT=prod && export PROJECT=GOOGLE-CLOUD-PLATFORM-PROJECT-ID && export VERSION=$(node -p -e "require('./package').version") && export VERSION=${VERSION//[^[:alnum:]^-]} && npm run deploy
Travis CI
Add [deploy] to you git commit message.