Skip to content

Installation

Animenosekai edited this page Jan 3, 2021 · 4 revisions

Installation

This page explains the step-by-step methods on how to install your own ErinaServer!

Basic

  • Step 1: Fork this GitHub Repo.
  • Step 2: Set your host and port for ErinaServer in the config.json file in the "Erina/_config" directory. The port needs to be an integer and the host a string.
  • Step 3: Run ErinaLauncher.py (you'll most likely need to type python ErinaLauncher.py
  • Step 4: Once you see "Running ErinaServer..." on your console, go to your browser and to https://<yourhost>/erina/admin/
  • Step 5: You will be redirected to the login page, you should only see the option to set a password. (because no password is set so you can't login)
  • Step 6: Set your password by entering the temp code displayed on your console and your password.
  • Step 7: You should now be logged in and redirected to ErinaAdmin
  • Step 8: Configure Erina under the "Config" section of ErinaAdmin.

Needed

You need to be able to connect via https to use ErinaAdmin (to prevent password and token leaks)

According to Vermin: Minimum required versions: 3.6

Custom Endpoints

You can add custom endpoints to the Custom.py file in the ErinaServer directory.

Features

Use the ErinaServer object/class like a Flask application object.
The ErinaSockets object is an instance of flask_sockets.Sockets which you can use to add WebSockets endpoints.
The ErinaRateLimit decorator is a decorator used to add a Rate Limiting to the endpoint. You can pass to it arguments:

  • rate: the rate in seconds.
  • fromIP: if ErinaServer needs to rate limit by IP address or globally

The ErinaStats decorator is a decorator used to keep stats about the endpoint which you can see at the end of the Stats page of your ErinaAdmin. You need to pass it a name (the name of the endpoint)

An example of custom endpoint already exist in the Custom.py file (which you can delete if you want)

The Custom.py file will be backed up during updates.

(in general, files not overwritten by an update should be kept during updates)

Heroku

If you want to host your ErinaServer on Heroku, a Procfile, requirements.txt and runtime.txt are already in the root of the repo.

Also, the default configuration are set to "0.0.0.0" for the host and {{PORT}} for the port so you should be able to deploy Erina without any code change.

Due to Heroku's limitations, make sure to backup your data frequently (for example by adding the git headers to your clone of the repo on your server and pull and pushing the changes frequently) because Heroku restarts the server at least once a day which will delete all of the caches and the updates. Moreover, the restart may break file dependent operations like Twitter mentions, Direct Messaging, clean restart.

If you really need to restart, try restarting only the process first by restarting from your ErinaAdmin Config page.

Previous: API
Next: ErinaAdmin

Useful links

Clone this wiki locally