Skip to content

Latest commit

 

History

History
52 lines (43 loc) · 3.5 KB

LINUX.md

File metadata and controls

52 lines (43 loc) · 3.5 KB

How to

The following procedure shows how to install this project on a Linux web server running Ubuntu 14.04. The following instructions work behind a firewall so long as the web server has access to your GitLab and Mattermost instances.

To install this project using a Linux-based web server, you will need a Linux/Ubuntu 14.04 web server supporting Python 2.7 or a compatible version. Other compatible operating systems and Python versions should also work.

Here's how to start:

  1. Set up this project to run on your web server

  2. Set up a Linux Ubuntu 14.04 server either on your own machine or on a hosted service, like AWS.

  3. SSH into the machine, or just open your terminal if you're installing locally

  4. Confirm Python 2.7 or a compatible version is installed by running:

    • python --version If it's not installed you can find it here
  5. Install pip and other essentials

    • sudo apt-get install python-pip python-dev build-essential
  6. Clone this GitHub repo with

    • git clone https://github.com/numberly/mattermost-integration-giphy.git
    • cd mattermost-integration-giphy
  7. Install integration requirements

    • sudo python setup.py install
  8. Set up your Mattermost slash command

  9. Log in to your Mattermost account. Click the three dot menu at the top of the left-hand side and go to Integrations > Slash Commands

  10. Under Add a new command, enter gif into Command Trigger Word

  11. Paste your Web Server domain into Callback URLs, making sure to add http:// to the beginning and /new_post to the end so it looks similar to http://<your-web-server-domain>:<MATTERMOST_GIPHY_PORT>/new_post and click Add

  12. Select POST method

  13. (optional) Choose a username and icon url (more details here)

  14. (optional) Check the autocomplete checkbox, add [KEYWORD] as the hint, Returns a GIF from Giphy based on the keyword as the description and Get a GIF from Giphy as the descriptive label

  15. Copy the Token from your newly created slash command that appears under the Existing commands section

  16. Run the server with the correct configuration

  17. Back on SSH or your terminal, add the following lines to your ~/.bash_profile

    • export MATTERMOST_GIPHY_TOKEN=<your-token-here> This is the token you copied in the last section
    • export MATTERMOST_GIPHY_HOST=<your-host> or export HOST=<your-host> The host you want the integration (defaults to 0.0.0.0)
    • export MATTERMOST_GIPHY_PORT=<your-port-number> or export PORT=<you-port-number> The port number you want the integration to listen on (defaults to 5000)
  18. Source your bash profile

    • source ~/.bash_profile
  19. Run the server

    • python run.py

That's it! You should be able to type gif: hello or /gif hello into any channel and see a GIF from Giphy's translate service.

Production setup

If you'd like to use this integration in a production envrionment, it is strongly recommended that you get a production Giphy API key from here. Once you have that you can configure the integration to use it:

  1. Stop the process currently running the integration
  2. Add the following lines to your ~/.bash_profile or ~/.bashrc
    • export GIPHY_API_KEY=<your-api-key-here> With your Giphy API key
  3. Source your bash profile
    • source ~/.bash_profile or source ~/.bashrc
  4. Run the server again
    • python run.py