SlashDeploy uses a Gemfile
to document dependencies.
The following external dependencies are also required:
Postgresql 9.6
Redis
Ruby 2.6.7
(optionallyrbenv
)bundler
- install brew
- install
PostgreSQL 9
:brew install [email protected]
- start
PostgreSQL 9
:brew services start [email protected]
- install
rbenv
:brew install rbenv
- install
bundler
:gem install bundler
- TODO
- clone
slashdeploy
:git clone [email protected]:remind101/slashdeploy.git
- change dir to project root:
cd slashdeploy
- install
slashdeploy
:bundle install
- create database schema:
bundle exec rake db:setup
- migrate database schema:
bundle exec rake db:migrate
The full test suite can be run with:
./bin/rake
You can also use Docker for development and testing:
make dev # run the whole stack containerized
make test # run the test suite
Read on for more details about how to set up a full dev environment below.
The basic process is to set up a Slack app and GitHub app which you will need to authenticate with in order to facilitate communication between them. Because you're setting this up locally, you need a way for Slack and GitHub to reach your development server, which is achieved via Ngrok. Ngrok will open a reverse proxy connection to an Ngrok server, which will proxy traffic back to your local machine over a secure tunnel. This both provides a publicly routable address that services like GitHub, Slack and users can reach, and also provides valid TLS encryption for the connection, all the way back to your local server (provided you trust Ngrok, since they're essentially performing MITM on your traffic).
IMPORTANT! Ngrok will provide you with both an HTTP and HTTPS URL; make sure you're using the HTTPS version everywhere.
- Install ngrok if you don't already have it. Put it
somewhere in your
PATH
. - Run
make ngrok
. This will start proxying traffic to localhost:3000.
- Create an
.env
file in the root of the repository. This file will be ignored via.gitignore
, and is for storing credentials/secrets for your development instance. Start with:
STATE_KEY=""
# the ngrok.io URI. Make sure this is HTTPS!
URL="https://xxx.ngrok.io"
You'll continue adding configuration to this file as we proceed.
- Create a New Slack Workspace. This is important! If you install the app we're about to create in an existing/production workspace, you'll conflict with the existing SlashDeploy installation, and expose your dev environment to everyone in the workspace. Additionally, you must create the workspace and be signed into the new workspace when you create the Slack app. Slack will not allow you to install the app to another workspace without publishing it.
- Create a Slack App
- Select 'Slash Commands' from the left sidebar, under the 'Features' heading
- Select 'Create New Command'
- Enter the following information:
Command | /deploy
Request URL |
https://xxx.ngrok.io/slack/commands
Short Description | SlashDeployyour name
Usage Hint | Whatever you like Escape channels, users, and links sent to your app | unchecked - Important! Make sure to click 'Save' down in the lower right
- Select 'OAuth & Permissions' from the left sidebar, under the 'Features'
heading
- Select the 'Add New Redirect URL' button under the 'Redirect URLs' section
- Set the Redirect URL to
https://xxx.ngrok.io/auth/slack/callback
- Click the 'Add' button
- Click the 'Save' button
- Select 'Interactivity & Shortcuts' from the left sidebar, under the
'Features' heading
- Turn the feature on with the toggle button
- Set the Interactivity Request URL to
https://xxx.ngrok.io/slack/actions
- Important! Make sure to click 'Save' down in the lower right
- Select 'Install App' from the left sidebar, under the 'Settings' heading
- Click the 'Install App to Workspace' and add the app to your workspace of choice. Remember, you can only install an app to the workspace specified when you created it.
- Select 'Basic Information' from the left sidebar under the 'Settings' heading
- Set the following variables in your
.env
file:SLACK_CLIENT="slack" SLACK_CLIENT_ID="<Client ID>" SLACK_CLIENT_SECRET="<Client Secret>" SLACK_VERIFICATION_TOKEN="<Verification Token>"
- Set the following variables in your
- Register a new Github OAuth
Application, using the
following config:
Application name | Same as the name of your Slack app
Homepage URL |
https://xxx.ngrok.io
Application description | Whatever you want Authorization callback URL |https://xxx.ngrok.io/auth/github/callback
- Click 'Create' button
- The next screen should have the integration config. Set the following
variables in your
.env
file:GITHUB_CLIENT="github" GITHUB_CLIENT_ID="<Client ID>" GITHUB_CLIENT_SECRET="<Client Secret>"
You can run the development server locally:
foreman start -p 3000
Or use Docker:
- make dev
- You can now visit
https://xxx.ngrok.io
and connect the app. The first time you attempt to use the/deploy
command from your test Slack workspace, you'll be asked to authenticate with GitHub.