Group 1 - The Three Gophers
- IP: 10.212.136.172
- Port: 80
- NTNU VPN required
- Simen Bai (simenbai@stud.ntnu.no)
- Ruben Christoffer Hegland-Antonsen (rubench@stud.ntnu.no)
- Even Bryhn Bøe (evenbbo@stud.ntnu.no)
The system is not intended to be run locally although it is possible.
- Clone repository with
git clone https://git.gvk.idi.ntnu.no/course/prog2005/prog2005-2021-workspace/simen_bai/git-good-discord-group-1.git - Add firebase and discord credentials from the example files
- Update IP of service.json
- Firestore needs a composite index on channel_id and id for the subscriptions command. This can either be added manually, or you can try the subscriptions command which will crash the system. The error message will contain a link to generate the index.
- Run docker
sudo docker compose up -d --build
There is a landing page with the same basic user information as in this section.
For some commands to work the user executing them needs the Admin role (case sensitive). It is therefore strongly recommended for a channel to have an Admin role.
The system is run on OpenStack and a VPN is required to reach the IP but not to use the bot.
- Authorize the bot for the server through the discord website
- Add Admin role
Go to the projects settings/access_tokens.
URL should be something like https://git.gvk.idi.ntnu.no/course/prog2005/prog2005-2021-workspace/simen_bai/git-good-discord-group-1/-/settings/access_tokens
Needs api scope.
There are some default setting for each channel that can be changed later on.
- The default language is english
- The default command prefix is !
Assuming default command prefix (!)
<item> is a placeholder where item indicates what should go in the placeholder
!helpLists commands!subscibe <gitlab_instance>/<repo_id>/<gitlab_username> <type1,type2>to subscribe to events- This requires that an access token has been added for the project
- type is the type of event given as list e.g. issues,merge_requests or issues
- e.g.
!subscribe git.gvk.idi.ntnu.no/1965/evenbbo1 issues,merge_requests
!unsubscribe <gitlab_instance>/<repo_id>/<gitlab_username>to unsubscribe from all events- e.g.
!unsubscribe git.gvk.idi.ntnu.no/1965/evenbbo1
- e.g.
!subscriptionsto get your subscriptions in the current channel
Commands requiring user to have the role Admin
!reloadto reload language packs. This is not usually needed but allows for changes in language packs without having to reboot the system.!language <language>to set language of channel- e.g.
!language english
- e.g.
!set prefix <prefix>to set prefix of the channel- e.g.
!set prefix # - Note: This command always requires the preifx !. This is in case the prefix is forgotten
- e.g.
!access_token <instance>/<repo_id>/<token>set access token of a project- specific to each channel
- Nothing that we know of although that does not guarantee there are none
-
Gitlab has more events such as push, comments, pipeline. This could be added, although it would mostly be similar to merge requests and issues and would therefore not demonstrate any greater competence.
-
Caching. To reduce the amount of requests sent to the database as we are limited to 50k reads per day (not an issue in the scope of this task but it could be in a large scale deployment).
The settings for each channel is read for each message sent. Settings are one thing that we only really needed to read once on startup and then the only interaction with firebase would be writing.
-
Testing. We could add more tests. There are enough tests demonstrate competency in testing and mocking, but we have not added tests to everything.
As of now it only allows for connection to the git.gvk.idi.ntnu.no gitlab instance. This is not a limitation of the program but rather of the deployment method. Since we are using OpenStack other instances can not reach the IP and therefore not post anything. Switching to a different IaaS such as GCP would fix this (could also be a PaaS solution as long as it has support for docker as our deployment method uses it).
The idea was to create a discord bot that would allow users to subscribe to gitlab events. Users can choose a gitlab user in a repository to subscribe to and when that user is mentioned in an event; a message is sent to discord to notify the user with the discord mention functionality (using @username).
Time. We had a project in Computer Vision due the 10th, and an oral exam in Computer Vision the 18th which stole some time and attention.
- Dealing with cyclic imports.
- Merge conflicts
- We learned about the quirks of Go. Especially in regard to the cyclic imports
- Working a lot on the same files resulted in some good practice with merge conflicts.
- Experience in how to work in a team on a larger project
- Good experience in reading API documentation. We chose well documented APIs (discord and gitlab) but reading through and applying the necessary changes for our use is still a valuable skill to have even if we were spared some headaches from bad documentation.
We forgot to count hours although we have been working some hours every day for the last few weeks.
An educated guess would be 170 hours in total.