Skip to content

Self Hosting

Jacob Pretorius edited this page Mar 18, 2024 · 4 revisions

How to host your own

If you're running into limits with the free version, or you know your project gets lots of traffic so you're planning ahead, it is always best to host your own infrastructure.

Setup instructions

We publish a Docker container which runs the API using GitHub packages which you can find at https://github.com/ohonesix/api.universalnft.dev/pkgs/container/universalnftdev

The API is built with .NET 8, so you can build and publish it to run directly in any operating system if you wish. However, for this guide we will be using Docker as that's how we run our public infra.

For this example we're using Debian, but almost any modern distro / OS should work.

How to run the project using Docker

  1. Make sure you have Docker installed and working (we won't cover this, many tutorials available online)
  2. Create a new directory for your project and its .env file somewhere on your server
  3. Look at the default values and determine what needs to change for your environment
  4. Create a .env file with your changes, for example to configure a custom Rippled server and API Server External Domain you would have sudo nano .env
XRPLSettings__XRPLServerAddress=http://rippled.example.com:4006/
ServerSettings__ServerExternalDomain=https://mysiteapi.example.com
  1. Pull the image sudo docker pull ghcr.io/ohonesix/universalnftdev:latest

If you see an error relating to the platform, try specify it with using this command instead

sudo docker pull --platform linux/amd64 ghcr.io/ohonesix/universalnftdev:latest

  1. Run the container sudo docker run --env-file .env -d -p 5103:5103 --name universalnftdevapi ghcr.io/ohonesix/universalnftdev:latest
  2. Go to your http://localhost:5103 or whichever port you decided to run it on
  3. If you want to expose it publicly you may prefer to put it behind a reverse proxy like Nginx, but again, many guides for that available just route traffic to your service port and you should be good to go.

Updates

If a new version is available and you're not using something like Portainer to automatically update, you can follow these quick steps

  1. Stop the running container sudo docker stop universalnftdevapi
  2. Delete the existing container sudo docker container rm universalnftdevapi
  3. Go back to where you created the .env file the first time, e.g. cd universalnftdev/
  4. Pull the image again sudo docker pull ghcr.io/ohonesix/universalnftdev:latest
  5. Start it again sudo docker run --env-file .env -d -p 5103:5103 --name universalnftdevapi ghcr.io/ohonesix/universalnftdev:latest

Clone this wiki locally