Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Deployment

Ben Alman edited this page Jul 21, 2016 · 6 revisions

Deployment dependencies

Production

Provision a newly created production server:

./deploy/run-playbook.sh init production

Deploy master branch to the provisioned production server:

./deploy/run-playbook.sh deploy production

Notes

  • You should be able to restart the bot service with the following command (you'll need to enter your sudo password), and all active integration bots should disconnect and reconnect:
    • ssh -t skillsbot.bocoup.com sudo service slack_bot restart

Vagrant

In order to test deployment before actually deploying to production, follow these instructions:

Additional dependencies

Set up a slack app for testing

By default, production secrets are baked into the upstart script. This is great for deploying the app to the production server, but isn't great for testing. Testing MUST be done on a totally separate slack app, using a totally separate database.

If you haven't already created a dev slack app and database per the Development instructions, do so now. If you have already created one, you may need to modify it, per the following:

Note these amendments to the Development instructions:

Create the vagrant box

  1. Initialize and provision the vagrant vm
  • vagrant up
  1. Change /etc/init/slack_bot.conf upstart script environment vars to dev values for testing

Modify the upstart script

  1. Ssh into the vagrant box and edit the bot upstart script:
  • ssh -t skillsbot.loc sudo vim /etc/init/slack_bot.conf
  1. In Vim, enter the following case-sensitive commands:
  • /env then the <Enter> key
    • move the cursor to the first occurrence of env
  • dip
    • delete the paragraph under the cursor
  • k
    • move up one line
  • :r !sed 's/^/env /' /mnt/vagrant/.env then the <Enter> key
    • insert the contents of your .env file below the cursor, prepending env to each line
  • :wq then the <Enter> key
    • save changes and quit

If you make a mistake and need to reset the upstart script to its default values, run:

./deploy/run-playbook.sh configure vagrant --tags=services

Deploy and test the slack app

  1. Depending on what version of the app you want to deploy, run one of the following commands (you can run any of these commands at any time to re-deploy)
  • Deploy the local HEAD commit:
    • ./deploy/run-playbook.sh deploy vagrant local=true
  • Deploy the origin master branch:
    • ./deploy/run-playbook.sh deploy vagrant
  • Deploy the origin commit SHA abcdef:
    • ./deploy/run-playbook.sh deploy vagrant commit=abcdef
  1. Visit https://skillsbot.loc and add the app to the Bocoup slack team for testing
  2. You should be able to interact with the bot in DM, like /dm @skillsbot_yourname help

Notes

  • You should be able to restart the bot service with the following command, and all active integration bots should disconnect and reconnect:
    • ssh skillsbot.loc sudo service slack_bot restart
  • You should be able to restart the vagrant vm with the following command, and all active integration bots should reconnect automatically when the box restarts:
    • ssh skillsbot.loc sudo shutdown -r now