-
Notifications
You must be signed in to change notification settings - Fork 0
Deployment
-
Ansible (version 2.x)
- Install
ansible
via apt (Ubuntu), yum (Fedora), homebrew (OS X), etc. See the Ansible installation instructions for detailed, platform-specific information.
- Install
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
- 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
In order to test deployment before actually deploying to production, follow these instructions:
-
VirtualBox
- Download (All platforms)
- Install
virtualbox
via homebrew cask (OS X)
-
Vagrant
- Download (All platforms)
- Install
vagrant
via homebrew cask (OS X)
-
vagrant-hostsupdater
- Install with
vagrant plugin install vagrant-hostsupdater
(All platforms)
- Install with
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:
- Don't run ngrok.
- Do use https://skillsbot.loc and https://skillsbot.loc/authorize for the slack app URLs.
-
Don't actually run the server with the
npm run start-dev
command, or any of the instructions following it. -
Do add the Bocoup db secrets to your
.env
file via the instructions in step 1 of the Importing Bocoup expertise data section.
- Initialize and provision the vagrant vm
vagrant up
- Change
/etc/init/slack_bot.conf
upstart script environment vars to dev values for testing
- See the modify the upstart script section for specific instructions.
- Ssh into the vagrant box and edit the bot upstart script:
ssh -t skillsbot.loc sudo vim /etc/init/slack_bot.conf
- In Vim, enter the following case-sensitive commands:
-
/env
then the<Enter>
key- move the cursor to the first occurrence of
env
- move the cursor to the first occurrence of
-
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, prependingenv
to each line
- insert the contents of your
-
: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
- 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
- Visit https://skillsbot.loc and add the app to the Bocoup slack team for testing
- You should be able to interact with the bot in DM, like
/dm @skillsbot_yourname help
- 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