Skip to main content
Version: 1.2.3

Unicis Platform Community Edition (Self-Hosted)

Learn how to get started with Unicis Platform Community Edition (Self-Hosted).

This section will guide you through the process of self-hosting your instance of the Unicis Platform Community Edition (Self-Hosted). If you're interested in hosting your own instance, you'll need to install several additional dependencies. Follow our prerequisite guide below to install all the necessary dependencies and gather the required information.

Prerequisites

To install Unicis Platform on a server, your sever must meet the following requirements:

System requirements

Install Node.js, npm. pnpm

Downloading and installing Node.js and npm

npm install -g npm

Setup

  • Fork the reposity
  • Clone the repositoy:
git clone https://github.com/<your_github_username>/unicis-platform-ce.git

Go to the poject folder

cd unicis-platform-ce

Install

Install dependencies

npm install

Configure the environment

Set up .env environment file

cp .env.example .env

Create a database (optional)

note

To make the process of installing dependencies easier, we offer a docker-compose.yml with a Postgres container. If you already have running Postgress database please add the environment varialble in the .env file.

docker-compose up -d

Set up database schema

caution

If you had data before, this would delete it and set up a new schema.

npx prisma db push

Start the server

In a development environment:

npm run dev

Docker

info

If you're using the unicis-platform Docker image with a PostgreSQL database in a container, please use the name of that container as the database host.

CapRover

You will need to have installed CapRover on your server.

Create a Captain definition file.

/unicis-platform-ce/captain-definition
{
"schemaVersion": 2,
"dockerfilePath" :"./Dockerfile"
}

User the following Docker file sample.

/unicis-platform-ce/Dockerfile
# Use the official Node.js image as the base image
FROM node:18.18.2

# Set the working directory in the container
WORKDIR /app

# Copy package.json and package-lock.json to the working directory
COPY package*.json ./

# Install dependencies
RUN npm install --force

# Set up database schema
# RUN npx prisma db push

# Copy the entire application to the working directory
COPY . .

# Expose the port on which your Next.js app will run
EXPOSE 4002

# Set the DATABASE_URL environment variable
# ENV DATABASE_URL="//<USER-HERE>:<PASSWORD-HERE>@localhost:5432/<DATABASE NAME HERE>"
# DEV DB -> ENV DATABASE_URL=//<USER-HERE>:<PASSWORD-HERE>@localhost:5432/<DATABASE NAME HERE>

ARG NEXTAUTH_URL=${NEXTAUTH_URL}
ENV NEXTAUTH_URL=${NEXTAUTH_URL}
ARG NEXTAUTH_SECRET=${NEXTAUTH_SECRET}
ENV NEXTAUTH_SECRET=${NEXTAUTH_SECRET}
ARG SMTP_HOST=${SMTP_HOST}
ENV SMTP_HOST=${SMTP_HOST}
ARG SMTP_PORT=${SMTP_PORT}
ENV SMTP_PORT=${SMTP_PORT}
ARG SMTP_USER=${SMTP_USER}
ENV SMTP_USER=${SMTP_USER}
ARG SMTP_PASSWORD=${SMTP_PASSWORD}
ENV SMTP_PASSWORD=${SMTP_PASSWORD}
ARG SMTP_FROM=${SMTP_FROM}
ENV SMTP_FROM=${SMTP_FROM}
ARG DATABASE_URL=${DATABASE_URL}
ENV DATABASE_URL=${DATABASE_URL}
ARG APP_URL=${APP_URL}
ENV APP_URL=${APP_URL}
ARG SVIX_URL=${SVIX_URL}
ENV SVIX_URL=${SVIX_URL}
ARG SVIX_API_KEY=${SVIX_API_KEY}
ENV SVIX_API_KEY=${SVIX_API_KEY}

# Users will need to confirm their email before accessing the app feature
ARG CONFIRM_EMAIL=${CONFIRM_EMAIL}
ENV CONFIRM_EMAIL=${CONFIRM_EMAIL}

# Matamo
ARG NEXT_PUBLIC_MATOMO_URL=${NEXT_PUBLIC_MATOMO_URL}
ENV NEXT_PUBLIC_MATOMO_URL=${NEXT_PUBLIC_MATOMO_URL}
ARG NEXT_PUBLIC_MATOMO_SITE_ID=${NEXT_PUBLIC_MATOMO_SITE_ID}
ENV NEXT_PUBLIC_MATOMO_SITE_ID=${NEXT_PUBLIC_MATOMO_SITE_ID}


# Build the Next.js app
RUN npm run build

# Start the Next.js app
CMD ["npm", "start"]
info

If you're using the unicis-platform CapRover image with a PostgreSQL database in a container, please set up your database manually and link it to caprover envirionemnt srv-captain--db-unicis.

Add the environment variable in your CapRover application configuration.

CapRover set up PostgreSQL database

Please use the following Database Connection steps from CapRover.

In CapRover:

  1. click on Apps -> One-Click Apps/Database
  2. Search: PostgreSQL
  3. Enter your App name, version username, passowrd and database name from below example
  4. Click Deploy

Specify the varibales in the application configuration as bellow.

POSTGRES_USER=platform
POSTGRES_PASSWORD=[password]]
POSTGRES_DB=unicis_platform
POSTGRES_INITDB_ARGS=

Port Mapping, Server port 5432 and container port 5432.

Setup and access environment

/unicis-platform-ce/.env.example
# Only required for localhost
NEXTAUTH_URL=http://localhost:4002

# You can use openssl to generate a random 32 character key: openssl rand -base64 32
NEXTAUTH_SECRET=[openssl generated random key without brackets]

# SMTP / Email settings
SMTP_HOST=
SMTP_PORT=
SMTP_USER=
SMTP_PASSWORD=
SMTP_FROM=

# If you are using Docker, you can retrieve the values from: docker-compose.yml
DATABASE_URL=postgresql://<USER-HERE>:<PASSWORD-HERE>@localhost:5432/<DATABASE NAME HERE>

APP_URL=http://localhost:4002

SVIX_URL=https://api.eu.svix.com
SVIX_API_KEY=

GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=

GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=

RETRACED_URL=
RETRACED_API_KEY=
RETRACED_PROJECT_ID=

# Hide landing page and redirect to login page
HIDE_LANDING_PAGE=false

# SSO groups can be prefixed with this identifier in order to avoid conflicts with other groups.
# For example unicis-admin would be resolved to admin, boxyhq-member would be resolved to member, etc.
GROUP_PREFIX=unicis-

# Users will need to confirm their email before accessing the app feature
CONFIRM_EMAIL=false

# Disable non-business email signup
DISABLE_NON_BUSINESS_EMAIL_SIGNUP=false

# Mixpanel
NEXT_PUBLIC_MIXPANEL_TOKEN=

# Enable Auth providers (comma separated)
# Supported providers: github, google, saml, email, credentials
AUTH_PROVIDERS=

# OpenTelemetry
OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=
OTEL_EXPORTER_OTLP_METRICS_HEADERS=
OTEL_EXPORTER_OTLP_METRICS_PROTOCOL=grpc
OTEL_EXPORTER_DEBUG=true
OTEL_PREFIX=boxyhq.saas

NEXT_PUBLIC_TERMS_URL='/terms'
NEXT_PUBLIC_PRIVACY_URL='/privacy'

NEXT_PUBLIC_DARK_MODE=false

# Team feature
FEATURE_TEAM_SSO=true
FEATURE_TEAM_DSYNC=true
FEATURE_TEAM_AUDIT_LOG=true
FEATURE_TEAM_WEBHOOK=true
FEATURE_TEAM_API_KEY=true

# Google reCAPTCHA
RECAPTCHA_SITE_KEY=
RECAPTCHA_SECRET_KEY=

Accessing the Unicis Platform

Open your browser

http://localhost:4002