Skip to main content

Self-hosting your API

The API is a simple Ruby on Rails web application.

It can be hosted quite easily by any PaaS, such as Scalingo.

Requirements

Environment variables

Here are the environment variables that are required to make the API work. Currently, only S3-compatible APIs are supported for file storage, but any pull-request will be welcome to add other adapters.

Environment variableDescriptionRequiredDefault value
DATABASE_URLThe database URL. Must be a postgres connection string like postgres://USER:PASSWORD@HOST:POST/DATABASE
SCALEWAY_ACCESS_KEY_IDThe S3 file storage access key
SCALEWAY_ACCESS_KEY_SECRETThe S3 file storage access key secret
SCALEWAY_BUCKET_NAMEThe S3 file storage bucket name
SCALEWAY_ENDPOINTThe S3 file storage endpoint
SCALEWAY_REGIONThe S3 file storage region

Setting up the server

# Clone the repository
git clone https://github.com/xanyah/api.git && cd api

# Install dependencies
bundle install --without development test

# Run migrations
bundle exec rails db:migrate

# Start the server
bundle exec puma -C config/puma.rb