anatomy: node.js - slack/bolt based slack application purpose: get information about the atlassian marketplace
- node dependencies
- core features
npm install @slack/bolt
npm install winston
- optional features
npm install pg
npm install got
npm install url
- core features
- slack permissions
- add botscope
chat:write
to allow messages as @askami - add botscope
chat:write.public
to allow messages as @askami w/o membership - add botscope
commands
to enable slash command
- add botscope
- add slack channel for observing usage
- create private channel (e.g.
askami-observability
) - add askami app to the channel
- create private channel (e.g.
- create
askami.env
file- core features
SLACK_SIGNING_SECRET=<obtain-from-slack-app-configuration-page>
SLACK_BOT_TOKEN=<obtain-from-slack-app-configuration-page>
MARKETPLACE_SERVICE_PROTOCOL=https
MARKETPLACE_SERVICE_HOST=marketplace.atlassian.com
LOGGER_LEVEL=<level>
(error, warn, info, debug)PORT=3001
OBSERVABILITY_CHANNEL=<slack-channel-for-usage-monitoring> (created above)
- optional features
AMCACHE_HOST=<obtain-from-service-provider>
AMCACHE_PORT=<obtain-from-service-provider>
AMCACHE_DB=<obtain-from-service-provider>
AMCACHE_USR=<obtain-from-service-provider>
AMCACHE_PSW=<obtain-from-service-provider>
- core features
- development: docker image
- build
docker build -t ghcr.io/timit/askami .
- run
docker run -d -p 3000:3000 --env-file /<path>/askami.env -v <path>:/var/log --rm ghcr.io/timit/askami
- attach
docker exec -it <container-id> /bin/sh
- view logs
docker logs --follow <container-id>
- build
- distribution: docker image (from development machine)
- create github personal-access-token for pushing to the container registry
- provide note/name: askami-push
- (optionally) provide username: askami-push
- grant
read:packages
andwrite:packages
permissions - provide an expiration date
- (recommended) store credential in your password store
- login
docker login ghcr.io
(prompts for deploy-token username/password) - build
- when building from
linux/amd
architecturedocker build -t ghcr.io/timit/askami .
- when building from other architecture (i.e mac arm)
docker buildx build --platform linux/amd64 -t ghcr.io/timit/askami .
- when building from
- push
docker push ghcr.io/timit/askami
- create github personal-access-token for pushing to the container registry
- deployment: docker image
- create github personal-access-token for pulling from the container registry
- provide note/name: askami-pull
- (optionally) provide username: askami-pull
- grant
read:packages
permissions - provide an expiration date
- (recommended) store credential in your password store
- attach to askami server
ssh -i /<path>/askami.pem username@machine-name.domain.com
- stop container
sudo docker stop <container-id>
- login
sudo docker login ghcr.io
(provide username/token created during distribution steps) - pull
sudo docker pull ghcr.io/timit/askami
- add config file for docker container initialization
/etc/askami.env
(standard service config location per https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html) - start container
sudo docker run -d -p 3000:3000 --env-file /etc/askami.env -v <path>:/var/log --rm ghcr.io/timit/askami
- create github personal-access-token for pulling from the container registry
- monitoring: docker container
- obtain container-id
sudo docker ps -al
- attach
sudo docker exec -it <container-id> /bin/sh
- obtain container-id
- tidy up
docker system prune --all
docker buildx prune --all