This microservice is used as plugin with swiftops to access the following services from the slack channel:
-
Fetch git change log data for given git repository. More info
-
Get JMeter performance reports. More info
-
Get Junit reports. More info
-
Execute Jenkins job that is registered in Mongo database. More info
-
Sahi failed result summary. More info
-
Get scanned sonar result metrics from the sonarqube server. More info
git clone https://github.com/swiftops/slack-service.git
- Python 3.6.0 or above version.
- Docker should be installed on your machine. Refer Install Docker documentation.
- Create app on slack server. Refer Creating apps
- Root service is up and running.
- Generate token and user list url.Refer documentation
- Specify the Root service url, Mongo database credentials, Slack credentials, E-mail credentials and Jenkins credentials in config.ini.
Once you are done with pre-requisite execute below command to start slack microservice.
- With custom Mongo database. Create a schema named as botengine and import the default collection i.e master.json provided in this repository.Run the below command to restore the master collection.
mongoimport --db botengine --collection master --file master.json --jsonArray
Start the service.
docker build -t <image-name> .
docker run -p 8080:8080 --name <container_name> -d <image-name>
OR
- With default/dummy Mongo database. This will start a slack service and mongo server with default schema & collection.
docker-compose up --build
a. Install slack app in your workspace
b. Invite slack app to a channel in your workspace
c. Specify interactive components url in the slack app
d. Add slash command and specify slack service url.
e. Now your slack service is configured and ready for use.
f. Type "/<slash_command> help" (e.g /swiftopsbot help) in the slack channel, where <slash_command> is the name specified in the step(d). This will show the list of services that can be used.
g. Type any of the above-listed service name with slash command to use it. E.g /swiftopsbot release
To auto-deploy, your docker container based service on the server used below steps
- You need to configure Gitlab Runner to execute Gitlab CI/CD Pipeline. See Gitlab Config
<Configure .gitlab-ci.yml and deploy.sh as per your need and remove this line>
- Specify the host ip on which container is to be deployed inside deploy.sh
As soon as you configure runner auto deployment will start as you committed the code in the repository.
refer .gitlab-ci.yml file.