Open herald logo
Thumbnail
Pavece Dev
8 min read

Hosting open herald

In this article I want to show you how easy is to host OpenHerald.

Hosting open herald

OpenHerald is not intended for professional use or as a replacement for similar platforms. However, if this system meets your needs, you are welcome to host it freely.

Recommendations

While you can host OpenHerald without any development knowledge, it may be challenging if you're unfamiliar with the basics. I recommend proceeding only if you have some understanding of Git repositories, basic database setup, and environment variables.

In this article, I will guide you through hosting this app on Vercel, which I believe is the easiest way to do it. But you can host in anywhere (AWS, DigitalOcean, Azure, VPS, ...)

Forking / Cloning the repo

If you don't need updates and prefer to keep your project private, you can clone the repository and re-upload it to GitHub as a private repository. There are also solutions that allow you to maintain a private repository while still receiving updates—search for "GitHub private fork" if that's what you're looking for.

If you're not concerned about the code being public, you can simply fork the repository. The key point is that you need to have the OpenHerald code inside a GitHub-hosted repository that you own.

Setting up the databases

OpenHerald uses 2 databases: Redis and PostgreSQL. You need to provision both databases somewhere to allow access from the application server.

First you can provision Postgres, for that you can use Neon. Follow their documentation in order to set up the database. The goal is to get a connection link like this "postgresql://user:pass@domain.com/dbName" but with correct credentials.

Then you can provision Redis, you can use Upstash for this. Follow their documentation in order to set up the database. The connection string sholud look like this "redis://user:pass@domain.com:6379". Make sure to use rediss instead of redis if using TLS.

Then set the env variables DATABASE_URL and REDIS_URL to the corresponding values.

Setting up the google OAuth credentials

Go to Google cloud console and get your OAuth credentials. Please follow any Google made tutorial to get these.

Then set the AUTH_GOOGLE_ID and AUTH_GOOGLE_SECRET to the values you get in the google cloud console.

Getting Cloudinary API keys

OpenHerald uses Cloudinary to store images. Go there and create a new account. Get the api key, secret and cloud name. Then set CLOUDINARY_API_KEY, CLOUDINARY_SECRET and CLOUDINARY_CLOUD_NAME to the respective values.

Generating an auth secret

You need to create a random string to use as secret for the auth system.

You can use random values or generate one using openssl, you can do it with the command: openssl rand -base64 32

Then set AUTH_SECRET to the generated secret.

Generate database migration and seed

Make sure that you have DATABASE_URL set to the correct Postgres connection string. And you have node installed

On the console run: npx prisma migrate dev --name "Initial"

Once completed run: npm run seed:partial

Upload to Vercel

Create a Vercel account and link your GitHub account. Then create a new project and choose the repository containing OpenHerald's code. Make sure to replace the build command with npx prisma generate && npm run build

Fill every environment variable in, you can easily do this by pasting the full .env file inside the env variables form in Vercel (if you have every value set in the .env file).

Then click deploy

Create super admin

Once deployed you can visit the link and create the super admin user. Go to yourdomain.com**/auth/register** and create a new user. This user will be registered as super admin. From now on every new user will require a single use link, you can generate those in the user manager.

Hope this guide was useful for you !