Run a Node.js Cluster with Express on Google Cloud Platform.
- 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
npm install
npm start
npm run develop
npm test
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
Add [deploy] to you git commit message.