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
- Ruby
>= 3.4.1
- A Postgresql database
>= 17.0
- Either Vips or Minimagick to handle Active Storage images transformations
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 variable | Description | Required | Default value |
---|---|---|---|
DATABASE_URL | The database URL. Must be a postgres connection string like postgres://USER:PASSWORD@HOST:POST/DATABASE | ✅ | |
SCALEWAY_ACCESS_KEY_ID | The S3 file storage access key | ✅ | |
SCALEWAY_ACCESS_KEY_SECRET | The S3 file storage access key secret | ✅ | |
SCALEWAY_BUCKET_NAME | The S3 file storage bucket name | ✅ | |
SCALEWAY_ENDPOINT | The S3 file storage endpoint | ✅ | |
SCALEWAY_REGION | The 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