To get started, use the following steps.
If you want to work on Spectromate, you will need to install the following software and actions completed.
-
Docker v20.10.0 or greater.
-
Go 1.21 or greater.
-
Ngrok v3.2.2 or greater.
-
A Slack App available that has access to your target workspace.
The following instructions assume a directory in your home directory outside of the standard GOPATH.
-
Clone the repository by using the following command.
$ mkdir -p $HOME/projects/spectromate/; cd $HOME/projects/spectromate/ $ git clone [email protected]:spectrocloud/spectromate.git
-
Issue the command
make init
. This command will download all the required project dependencies.make init
-
The following command is used to set up the local development support dependencies, such as Redis and Ngork.
make start
-
Copy the URL Ngrok exposed in the output.
$ make start Starting the application and ngrok... [+] Running 3/3 ✔ Network docs-slack-bot_default Created 0.0s ✔ Container docs-slack-bot-redis-1 Started 0.3s ✔ Container docs-slack-bot-redis-cli-1 Started 0.5s Ngrok URL: https://76ac-184-179-188-29.ngrok-free.app
-
Create a
env
file at the root of the project.touch .env
-
Populate the .env file with your respective credentials.
export SLACK_SIGNING_SECRET=.... export MENDABLE_API_KEY=....
-
Start the local server.
make server
-
Source the
.env
file.source .env
-
Navigate to your Slack app and open up your app's details page.
-
You will access both elements highlighted in the image. Start with the first element, by clicking on the left Main Menu and selecting Slash Command.
-
Create a new slash command titled
docs
and provide your Ngrok URL to the command. Append/api/v1/slack
to the end of URL. -
Save your changes and navigate back to the main details page.
-
From the left Main Menu, select Interactivity & Shortcuts.
-
Toggle the Interactvity button to On.
-
Use your Ngrok URL and paste the URL into the text input box. Append
/api/v1/slack/actions
to the end of the URL and save your changes. -
Navigate to a Slack channel and issue the Slack command
/docs help
.
You should receive an output similar to the following.
You now have a functional test application connected to your local workstation.
- Stop the local server by pressing the
Ctrl
+C
.
Make your changes and start the server with the make server
command to test the new behavior.
make server
Starting the server...
go run main.go
2023/04/20 19:44:15 maxprocs: Leaving GOMAXPROCS=8: CPU quota undefined
{"level":"info","time":1682045055,"message":"Server is configured for port 3000 and listing on 0.0.0.0:3000"}
{"level":"info","time":1682045055,"message":"Redis is configured for localhost:6379"}
{"level":"info","time":1682045055,"message":"Trace level set to: INFO"}
{"level":"info","time":1682045055,"message":"Starting server..."}
Add test cases to new functions and new commands. Invoke the Go tests from the root namespace. The pipeline will invoke the Go tests as well.
go test -race ./...