Open HsuTing opened 6 years ago
config.yml
Add id_rsa
in ~/.ssh
to add ssh
of .circeleci
.
deploy-heroku:
working_directory: ~/repo
docker:
- image: node:latest
steps:
- checkout
- run:
name: Run heroku setup script
command: bash .circleci/setup-heroku.sh
- add_ssh_keys:
fingerprints:
- "<fingerprints in ssh>"
- run:
name: Deploy to Heroku
command: |
heroku git:remote -a <heroku app name>
git push --force git@heroku.com:<heroku app name>.git develop:master
heroku run npm run prod
heroku restart
setup-heroku.sh
#!/bin/bash
wget https://cli-assets.heroku.com/branches/stable/heroku-linux-amd64.tar.gz mkdir -p /usr/local/lib /usr/local/bin tar -xvzf heroku-linux-amd64.tar.gz -C /usr/local/lib ln -s /usr/local/lib/heroku/bin/heroku /usr/local/bin/heroku
cat > ~/.netrc << EOF machine api.heroku.com login $EMAIL password $HEROKU_API_KEY EOF
cat >> ~/.ssh/config << EOF VerifyHostKeyDNS yes StrictHostKeyChecking no EOF
hjb# Godaddy
config.yml
deploy-godaddy:
working_directory: ~/repo
docker:
- image: node:latest
steps:
- checkout
- run:
name: Install pm2
command: yarn global add pm2
- run:
name: Deploy to Godaddy
command: pm2 deploy production
#!/bin/bash
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash . ~/.bashrc nvm install node
curl -o- -L https://yarnpkg.com/install.sh | bash echo "export PATH=\"\$HOME/.yarn/bin:\$HOME/.config/yarn/global/node_modules/.bin:\$PATH\"" >> ~/.bashrc . ~/.bashrc
yarn global add pm2
rm ~/public_html/.htaccess
cat <
- ecosystem.json
```json
{
"apps" : [{
"name": "server",
"script": "lib/server.js",
"env": {
"PORT": 8000
}
}],
"deploy": {
"production": {
"user": "<user>",
"host": ["<host>"],
"ref": "origin/master",
"repo": "git@github.com:<user name>/<project name>.git",
"path": "/home/<user>",
"ssh_options": "StrictHostKeyChecking=no",
"pre-setup": "./.circleci/setup-godaddy.sh",
"post-setup": "ls -la",
"post-deploy": "yarn install; yarn prod; pm2 startOrRestart ecosystem.json"
}
}
}
add cache to travis
add export env to .circleci
, .travis
with files
https://github.com/HsuTing/notes/issues/10 https://github.com/HsuTing/notes/issues/60