Skip to content

Production setup

This guide details how to set up a modified version of Mercury Core for production hosting.

For a guide on setting up Mercury Core for local development, see Development setup.

You should already have the necessary dependencies and command line tools installed. If not, see Installation for an installation guide.

You will need:

  • A correctly configured or modified version of Mercury Core
  • Latest version of Bun installed (expected as bun)
  • Latest version of Go installed (expected as go, installation guide)
  • Latest version of SurrealDB installed (expected as surreal, installation guide)
  • Latest version of Caddy installed (expected as caddy)
  • A server to host it all on
  • A terminal, either directly on the server or through remote access such as RDP, VNC, or SSH

If you wish to use containers instead of SurrealDB and Go, install the latest version of a container manager such as Docker (expected as docker, installation guide) or an alternative container manager like Podman (installation guide).

  1. Copy the modified version of Mercury Core to your server and navigate to the root directory of the repository.

  2. If not using containers, navigate to the Economy directory, and run go build to compile the Economy service.

  3. Navigate to the Site directory.

  4. Copy the Site/.env.example file to Site/.env and modify it to set up the environment variables.

  5. Run bun prod to install dependencies and begin building.

  6. Run caddy start to start the Caddy reverse proxy server.

    • You can also run caddy reload to reload the configuration file without restarting the server.
    • If you're using Caddy with multiple configuration files, import the Caddyfile in the repository's root directory into a Caddyfile somewhere else, and run caddy start and caddy reload from there.
  7. If using containers, run docker compose up -d to start the Database and Economy services.

  8. Run bun ./build (not to be confused with bun build) to start Mercury Core. This will start the Database and Economy services automatically if they are not already running.