Skip to content
This repository has been archived by the owner on Sep 30, 2020. It is now read-only.

How to self host

Capuccino edited this page Sep 23, 2018 · 23 revisions

We have a lot of options on running your own version of Clara for your own server.

Note: Options marked with "^" means they are in beta and haven't been tested thoroughly. But they do work. Trust me.

Deploying via Heroku

Deploy

This is the most laziest way and the easiest way to deploy Clara. Just click on the button above to get your copy of Clara without breaking a sweat. This one deploys from the 0.4.x branch and has been tested properly. This deployment option is already setup and has the required dependencies for running this bot.

You should encounter a screen like this (if you signed up for Heroku already)

image

You should see some fields which you need to fill, though most of them aren't that mandatory.

Note: You do not need to fill in those aren't marked as Required. The bot can simply work without them.

The parameters:

  • BOT_OWNER_ID (Mandatory)

    • This is your User ID, which you can get via enabling Developer Mode, right clicking onto yourself, and clicking "Copy ID". This is required for you as this would let you gain access to admin-only commands.
  • DISCORD_TOKEN (Mandatory)

    • This is your application's token. You can get this by making a new Discord Application and creating a bot user.
  • DEFAULT_PREFIX (Mandatory)

    • This is your Bot's Prefix. Avoid adding quotes of some sort.
  • INSTANCES (Optional)

    • How many instances of the bot do you want to run. Defaults to 1 if undefined.
  • ENABLE_PROMISE_WARNS (Optional)

    • Only enable this if you wanna find out what kind of cryptic Promise logs you want to get. Useful for bug testers and developers.
  • YOUTUBE_TOKEN (Mandatory)

    • This is required for Music as it would allow you to interact with the Youtube API. Grab your key from the Google Developers' Console.
  • SAUCENAO_TOKEN (Optional)

    • Required if you wanna use the Saucenao service for finding sources of Anime illustrations. Simply go to their page and go to account, make an account, and grab your key from the api section.
  • GAME_NAME (Optional)

    • The game name you want your bot to display.
  • GAME_URL (Optional)

    • The game URL for your bot's playing status (if you wanna promote your channel or just want to plain mess around with the cool Streaming status)
  • IB_TOKEN (Optional)

    • Required for ibsearch command.
  • OSU_API_TOKEN (Optional)

    • Required for checking osu!related stuff. The bot will automatically unload any osu!related commands if this is not found.
  • DEBUG (Optional)

    • If you want to find out what goes inside. useful if you're gonna help us debug Clara.
  • REDIS_URL (Automatically made by Heroku)

    • the database URL for connecting to the bot. Heroku has this covered for you. But for OpenShift deployments, you have to parse your Redis Database URLs.
  • NASA_KEY (Optional)

    • This is for getting some cool Astronomy pic of the day from NASA. Get an API key here

Deploying via OpenShift Online^

Note: Music does not work in OpenShift Online since the service is not designed to maintain UDP connections.

If you have a OpenShift.com account and want to try Clara. We provide a Docker image for you.

Note: DO NOT USE the S2I Images and just follow the instructions here! Current S2I Images does not support the current Clara version.

  • First deploy a Persistent or an Ephemeral image of Redis on your project. Setup a password if necessary.

  • Then go to the Project where you have deployed your Redis instance.

  • Go to Resources > Config Maps and make a config map using the config layout from this Tutorial.

  • Go back to overview, Click on Deploy and image, and check image name.

    • We provide two Clara Images, respectively:
      • claritymoe/clara:latest for the stable Clara.
      • claritymoe/clara:nightlyfor the Nightly Clara.
  • Deploy, and apply your config map via going back to Resources > Config Maps and selecting your config maps and clicking "add to application".

Deploying via Kubernetes

  • First Create a Pod using redis:latest.

  • Go to Create Resource, and pull a Clara image.

    • We provide two Clara Images, respectively:
      • claritymoe/clara:latest for the stable Clara.
      • claritymoe/clara:nightlyfor the Nightly Clara.
  • Apply Environment variables. Use the Config Parameters specified above.

  • Then click on Deploy.

However, if you don't feel like doing this manually, we provide Manifests that automatically makes the pods specified.

Localhost

If you don't want either of this two, you can run your own Clara locally.

What you'll need

For windows :

For Linux distributions :

You can find most of these in your distribution.

Setting up

  • First, Clone this repository:
      $ git clone https://github.com/ClarityMoe/Clara.git
  • Then, Go to your repository in the command line
      $ cd Clara
  • Finally, run NPM Install.
      $ npm i --save

Running the bot

  • PM2

    • First, install pm2 globally via npm
     $ npm i -g pm2
    • Then copy config.json.example as config.json. the following parameter names are almost identical as used in the Config parameters.
    • Start the bot
     $ cd Clara/src
     $ pm2 start ./pm2.json

Reminder Clara can also run without PM2, so if you're using another monitoring service, it won't cause any conflicts to Clara.

Here are the options in running Clara! if you need any more assistance, You can contact at [email protected] or go to our Discord Server