Skip to content

Latest commit

 

History

History
129 lines (87 loc) · 5.44 KB

File metadata and controls

129 lines (87 loc) · 5.44 KB
id deploy
title Deploy to Production
description Deploy your Manifest backend to production in no time. Server, Databases and Storage options. Deploy on popular cloud providers and use Docker image.

Deploy Manifest

Introduction

Manifest is made to be self-hosted: backends can be deployed with ease wherever you want using different methods.

We recommend using Docker to simplify deployments but you also can install Manifest manually on a VM or on a bare-metal server.

System requirements

The minimum system requirements to run a small Manifest backend are 1vCPU and 512 MB RAM. It usually corresponds to one of the cheapest options on cloud providers.

The server needs at least Node.js v18 or more and a process manager like pm2.

Database

Manifest works by default in local with SQLite but we recommend to switch to PostgreSQL for production deployments.

All popular hosting providers have their managed PostgreSQL solutions and there are many DB-as-a-Service providers like Neon that offer generous free-tier to get started. Here is a list of popular services:

Provider Service Name
Amazon Amazon Aurora PostgreSQL
Google Cloud Cloud SQL for PostgreSQL
Microsoft Azure Azure Database for PostgreSQL
Neon Neon Database
Crunchy Data Crunchy Bridge
Aiven Aiven for PostgreSQL
DigitalOcean DigitalOcean Managed PostgreSQL
Heroku Heroku Postgres
StackGres StackGres
Render.com Render PostgreSQL Database

:::tip

While you could technically create a Docker volume to ensure data persistence for your SQLite database, we found it easier to use any managed PostgreSQL service even if you never used PostgreSQL.

:::

Storage

Manifest supports local storage and S3 storage.

With local storage, files are saved on disk but will be lost when the container restarts if you are using Docker.

With S3 storage, files are stored externally, ensuring they are persistent and accessible.

Follow the S3 Storage documentation to set it up.

Environment variables

You need to create a .env file at app root level with at least the following variables:

TOKEN_SECRET_KEY=%ReplaceByYourKey%
NODE_ENV=production
BASE_URL=https://my-backend.com

See more environment variables you may need.

Start script for production

The npm run start script should only be used for development as it watches file changes.

Go back to your codebase and open the package.json file and add a new start:prod script on the scripts list with the value node node_modules/manifest/dist/manifest/src/main.js as following:

"scripts": {
    "start:prod": "node node_modules/manifest/dist/manifest/src/main.js"
    [...]
}

After that you will be able to run Manifest for production with npm run start:prod without watching file changes.

Docker

Docker is a popular choice among developers. It uses containerization to ensure that the app will work well in any environment.

# Use the official Node.js image as a base
FROM node:22-slim

# Copy package.json and package-lock.json (if available)
COPY package*.json ./

# Install dependencies
RUN npm install && npm cache clean --force && rm -rf /root/.npm && rm -rf /tmp/*

# Copy the rest of your application code
COPY . .

# Set the NODE_ENV environment variable
ENV NODE_ENV=production

# Expose the port the app runs on (adjust as needed)
EXPOSE 1111

# Start the application
CMD ["npm", "run", "start:prod"]

Guides for popular app platform services

Here are some quick guides to launch your app in a few minutes: