Build & Deploy your GitHub or BitBucket Repo from Slack

By Alex Leventer
Sep 22, 2015

I’m Alex, The Product and Marketing guy here at Distelli. When I began working at Distelli 9 months ago, I quickly realized that it’s difficult to promote a deeply technical SaaS product (built by engineers, for engineers) without being an engineer myself.

So I did the only logical thing: I taught myself how to write code. While I’m not as proficient as Brian, Boris, or Michael on my team, I can hold my own when it comes to firing up Node apps, integrating with API’s, and shipping something valuable.

My latest application, Distelli-Slash, allows developers to do everything they can do within Distelli entirely from Slack using “slash commands”. Distelli-Slash is my first piece of customer-facing code and I’m happy to share it with you today. Here’s how it works:

You can list all your Distelli applications and environments: List Apps and Envs Applications are groupings centered around your GitHub or BitBucket repository. Environments are groupings of servers with similar configurations.

Create new applications or environments: Creating apps and environments

List the releases associated with your Distelli applications: List Releases Releases are created upon the successful build of an application - usually after doing a git push or hg push of your repository

And deploy any release of your application: Alt text

I’ll be maintaining and updating this project and if you have additional features you’d like to see send me email or open a pull request.

##Setting Up Distelli-Slash

To view the full source for Distelli-Slash, you can check-out the public GitHub repository by right here.

If you’d rather just see what you’re capable of doing via Slack, click here.

###Before you Begin: Before you begin this tutorial, make sure you’ve created a Distelli account and forked the Distelli-Slash GitHub repository found here.

###Creating a Distelli Application: Log into your Distelli account and create a new Distelli application by selecting the “New App” button on the top right of the screen: Apps Dashboard 1. Name your application “Distelli-Slash” and connect it to the GitHub repository you forked before starting this tutorial: Creating an Application 2. Connect the “master” branch, and select “All Done” when prompted if you’d like to create any additional environments: Creating Environments 3. Because a Distelli-Manifest.yml file is already included in your forked repository, in order to start the build, all you need to do is change the 1st line of your distelli-manifest.yml file to use your Distelli username: Editting your Manifest 4. Once you’re modified your distelli-manifest.yml file to use your own username, commit and push your changes: Pushing your Changes 5. Now go back to browser and select “I’ve Pushed My Repo” and then select the “Distelli Javascript” image and finally looks good. Start Build!”: Starting a Build We’ve just started our first build and configured auto-build so when you do a git push in the future, your repository will automatically build. You’ll be automatically taken to the builds overview screen where we can inspect our first build: Inspecting a Build On successful build, a release of your application is automatically created. But before we deploy this application, let’s make a couple other changes.

###Configuring your Secrets.js File Now we’ll need to configure our secrets.js file with our Distelli API token and Slack username.

  1. Create a Distelli API token at

  2. Select “Create API Token” and describe your token: Alt text

  3. Open your secrets.js file, paste your Slack username, with your API token to the right like the example below: Alt text Add additional username’s and API tokens for each member of your team. By doing this, each team member will show as the deployer when they make a deployment via Slack. Commit and push your changes when you’re done.

###Adding a Server to the Distelli-Slash-Prod Environment Once you’ve configured and successfully built your app, you’ll need to deploy it to a server in order to make use of the Slack-Slash command.

  1. Navigate to the servers section of Distelli at Replace username with your Distelli username.
  2. Select the “New Server” button on the top right of the screen: Alt text
  3. For this tutorial, we’re going to deploy to a DigitalOcean Droplet. Select “Add Existing Server”, you should see the following screen: Alt text
  4. Now you’ll need to SSH into your server and paste the agent install command listed on the screen. Your terminal should look similar to the following when you’re complete: Alt text
  5. Once you’ll installed the agent, go back to the browser and hit the “Install Complete” button. Then, select the server you just added: Alt text
  6. Select “distelli-slash-prod” to add your server to the Distelli-Slash Production environment you created early in this tutorial:Alt text Once you’ve selected “distelli-slash-prod” environment, hit the “Add Environments!” button.

###Deploying the Slack-Slash App Now that we’ve added a server to the distelli-slash-prod environment, we’re ready to deploy Distelli-Slash.

  1. Navigate back to the distelli-slash-prod environment page at Replace username with your Distelli username: Alt text
  2. To deploy the latest release of your application, simply select the green rocket icon on the top right of the page: Alt text
  3. You’ll be shown an overview page where you can select stagger settings. As we are only deploying to a single server, stagger settings won’t be needed. Hit the green deploy button: Alt text
  4. You’ll be taken the deployment page where we can view real-time streaming application logs: Alt text

###Creating a Slack Slash Command 1. Navigate to Replace your-team with your own team name. Enter /distelli as the command name and select “Add Slash Command Integration”: Alt text In the URL field, specify the IP address of the server you’re deploying Distelli-Slash with :3000 appended to the end to specify port 3000: Alt text After you’ve entered your Slack URL, save your Slack Token for use later and select the “Save Integration” button.

###Configuring Environment Variables We’ll need to configure some environment variables on the distelli-slash-prod environment. 1. Navigate to Replace username with your Distelli username: Alt text

  1. Click to set environments variables on the right hand-side of the page. You’ll need to set three environment variables: USERNAME, SLACKTOKEN and SLACKTEAM. Your USERNAME should be set to your Distelli username, your SLACKTOKEN should be set to the token found in the previous step and your SLACKTEAM can be found by visiting It should look something like this when you’re done: Alt text

You’ve officially done setting up your Distelli Slash command, below is a full list of everything you can do: 1. /distelli List Apps: List all apps associated with your Distelli account. Use the command List Apps After [AppName] to see the next page of results.

  1. /distelli List Envs: List all envs associated with your Distelli account. Use the command List Envs After [EnvName] to see the next page of results.

  2. /distelli List Envs for [AppName]: List all envs associated with a Distelli app.

  3. /distelli List Builds: List all builds associated with your Distelli account. Use the command List Builds After [BuildNum] to see the next page of results.

  4. /distelli List Servers: List all servers associated with your Distelli account. Use the command List Servers After [ServerName] to see the next page of results.

  5. /distelli List Servers for Env [EnvName]: List all servers associated with an app enviroment.

  6. /distelli List Releases for App [AppName]: List all releases associated with an app.

  7. /distelli Create App [App Name]: Create a Distelli application.

  8. /distelli Create Env [Env Name] for app [AppName]: Create a Distelli environment.

  9. /distelli Restart Env [Env Name]: Restart an existing environment.

  10. /distelli Latest release for app [appName]: Get information on the latest release associated with an app.

  11. /distelli Deploy latest to env [envName]: Deploy the latest release to an environment.

  12. /distelli Deploy [vXX] to env [envName]: Deploy a specific releases to an environment.

Shoot me an email (alex at if you need a hand with setup!