- Service integrations: Bot integrates with AWS, CodeShip & Gitlab.
- Build Notifications: Bot can notify the users for start, success or failures of the build from CodeShip.
- Start/Stop/Reboot AWS Instances: Bot allows user to start/stop/reboot any instances from configured AWS accounts. The bot connects to AWS using provided credentials.
- Commit deployment status: Check whether a specific commit is deployed in the latest build or not. This feature uses Gitlab API & CodeShip APIs to fetch the commit data & build data to notify the user about build status.
- Scale your AWS instances on the fly: Bot allows users to scale their EC2 instances on the fly using chatbot.
- Authority management on resources: The system allows to define managers to different instances in AWS, which enables the permission flows for the resources. E.g. If someone wants to scale the instance it will ask the manager first and once manager approves the request then and only then it will scale the instance.
- Check stats of the instances: User can query the bot to check statistics of an instance. Bot replies with nice graphs with latest statistics for the instances.
- Keep everyone updated: Admin can add stakeholders for the resources, and if someone updates that resource (e.g. start/stop of an instance) it will notfiy all the stakeholders that an operation is being carried out on that instance. Super useful to keep everyone notified about infrastructure changes in a project.
- Communicate in natural language: Bot uses Google DialogFlow as its NLP engine which makes sure that user doesn't have to remember any commands and he can converse in natural language with the bot.
- Mattermost (https://mattermost.com/download/)
- Mysql and config with Mattermost
- AWS Account
- GitLab Account
- Google Account
- Codeship Account
- Python3.7
- Create a account on Mattermost
- Go to system console and click on bot accounts then click Integrations > Bot Accounts link after click on add bot account
- create a new bot and check post:all and post:channels Enabled and save the bot token
- Put Mattermost server url, bot-username and bot-token in config.py file
- create a project in google developer console
- create a service account with dialogflow api role
- download credential file and set GOOGLE_APPLICATION_CREDENTIALS variable in environment variables
- Put dialogflow project name and client id in config.py file
- Import DialogFlow agent (Check this guide)
- The zip file to restore agent is in the source code with name DialogflowAgent.zip
- Put aws_access_key_id, aws_secret_access_key and region_name in config.py file
- To configure build notifications, go to your Project Settings and then click into the Notifications tab.
- Then Add New Notification with Webhook and Config Url with (BASE_URL/codeship/)
- Put Codeship email and password in config.py file
- Go to gitlab setting then click on access token
- Create Private Access Token (Grant permission of api)
- Put access token in config.py file
- Put database name ,username, password, port in config.py file
-
Start Mattermost server
-
Create & activate virtual environment
$ python3 -m venv ./venv $ source ./venv/bin/activate
-
install requirements
$ pip install -r requirements.txt
-
Make & run the migrations
$ python manage.py makemigrations $ python manage.py migrate
-
Collect the static files
$ python manage.py collectstatic
-
Create a super admin for the access
$ python manage.py createsuperuser
-
Run the django server
$ python manage.py runserver
-
Access the admin panel at BASE_URL/admin