Skip to content

Discord bot to display latest events happening in Singapore

License

Notifications You must be signed in to change notification settings

woojiahao/meetup

Repository files navigation

Meetup

Discord bot for getting tech event information in Singapore

Deployment

You will need Docker installed on your machine and a bot token.

It is advised you use the scripts included to build your projects.

For any deployment, you must clone this repository (it is assumed this step is done before any other steps):

$ git clone https://github.com/woojiahao/meetup.git
$ cd meetup

Before any deployment, generate an env_file.yml with the create-env.sh script - feel free to leave the defaults if you are unsure and follow the prompts for the rest:

$ chmod +x create-env.sh
$ create-env.sh

The following file should be generated (follow this format if you are unable to run the script):

BOT_TOKEN=<bot_token>
POSTGRES_DB=sgmeetupdiscord
POSTGRES_USER=meetup
POSTGRES_PASSWORD=root
DATABASE_URL=postgres://meetup:root@db:5432/sgmeetupdiscord

Stable

Stable deployment will be done if you wish to deploy the bot that's been tested without errors. The deployment will use the Docker image found on Docker Hub here. This is useful if you just want to deploy and forget about it.

  1. Run docker-compose.yml

    $ docker-compose up

And that's all there is to deploying the stable build of the bot.

Testing/Development

If you wish to make your own changes to the bot, you will want to see the changes made in real time, rather than having to deploy everything to Docker Hub.

  1. Build the image from docker-compose-local.yml

    $ docker-compose -f docker-compose-local.yml build
  2. Run docker-compose-local.yml

    $ docker-compose -f docker-compose-local.yml up

Heroku

Installing the bot on Heroku is dead simple. Just make sure you have a Heroku account and you're logged into Heroku CLI.

To push changes to Heroku, simply perform a git push heroku master.

  1. Clone this repository and navigate to the project folder.

  2. If you have access to shell scripts, use the provided script to reduce setup steps, otherwise, skip this step and move on to step 3.

    $ chmod +x heroku-run.sh
    $ ./heroku-run.sh
  3. Create a Heroku application and ensure that you are connected to a Heroku remote Git repository.

    $ heroku create sg-meetup-discord
    $ git remote -v # There should be a remote named 'heroku'
  4. Add the Heroku Postgresql addon - the com.github.woojiahao.database is not used heavily, just to store some preferences.

    $ heroku addons:create heroku-postgresql:hobby-dev
  5. Configure an environment variable for the Discord bot token.

    $ heroku config:set BOT_TOKEN=<bot token>
  6. Set the stack in Heroku to use a container - this has been explained in my demo project for Heroku + Docker + Discord bot found here.

    $ heroku stack:set container
  7. Push the repository to Heroku.

    $ git push heroku master
  8. Scale the worker dyno so the bot is online.

    $ heroku ps:scale worker=1

Libraries Used

  1. KUtils
  2. khttp

About

Discord bot to display latest events happening in Singapore

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published