Skip to content

Deploy your own Pod provider

This tutorial will show you how to deploy your own ActivityPods provider to production. If you want to deploy it locally, please have a look at the first part of the tutorial Create your first social app.

We provide a Docker configuration with everything that is needed:

  • The backend of the Pod provider
  • The frontend of the Pod provider
  • Traefik to orchestrate domain names and SSL certificates
  • Apache Jena Fuseki to store semantic data
  • Redis used for cache, jobs queue and by the OIDC provider
  • Arena to watch the jobs queue

Installation steps

A Linux server with 4Gb of RAM is required for Fuseki to work properly, otherwise there is a high risk that it runs out of memory and gets killed. For large Pod providers, we recommend 8Gb of RAM.

Point your domains to your server IP

You will need two domains, one for the backend, the other for the frontend. You can use sub-domains two. Go to your domain provider and point these sub-domains to your server IP (with a A-type registration).

Clone the deployment repository

Connect to your server in SSH and clone the deployment repository.

Terminal window
git clone https://github.com/activitypods/deployment.git activitypods
cd activitypods

Install Docker with the Compose plugin

We have prepared a script for this:

Terminal window
./install-docker.sh

If that doesn’t work with your server config, you can follow Docker installation instructions.

Set the global environment variables

Copy the .env file to a .env.local file (cp .env .env.local) and set your server settings. This file (that is not commited by Git) will be used when loading the docker-compose.yml file and it contains global, cross-containers settings.

BACKEND_DOMAIN_NAME=mypod.store
FRONTEND_DOMAIN_NAME=app.mypod.store
LETSENCRYPT_EMAIL=
FUSEKI_PASSWORD=

Set the backend environment variables

Copy the .env.backend file to a .env.backend.local file (cp .env.backend .env.backend.local). All the environment variables in this file (that is not commited by Git) are used directly by the backend. You should only take care of the first part of the file:

SEMAPPS_INSTANCE_NAME=MyPod.store
SEMAPPS_INSTANCE_DESCRIPTION="A Pod provider open to all!"
SEMAPPS_DEFAULT_LOCALE=en # Available locales: en, fr
# Frontend config
SEMAPPS_MAPBOX_ACCESS_TOKEN=
SEMAPPS_COLOR_PRIMARY="#c9e265"
SEMAPPS_COLOR_SECONDARY="#314a62"
# Email provider settings
SEMAPPS_FROM_EMAIL=contact@mypod.store
SEMAPPS_FROM_NAME=${SEMAPPS_INSTANCE_NAME}
SEMAPPS_SMTP_HOST=
SEMAPPS_SMTP_PORT=587
SEMAPPS_SMTP_SECURE=false
SEMAPPS_SMTP_USER=
SEMAPPS_SMTP_PASS=
# OIDC Provider
SEMAPPS_COOKIE_SECRET=COOKIE-SECRET

A MapBox access token is required for the autocomplete feature of location field on the Pod provider frontend. Fortunately MapBox has a generous free tier with 100,000 requests per month, so you should not need to pay anything. But you still need to get the token.

Deploy to production

You can now launch the Docker containers with this command:

Terminal window
make start

If there is a problem, you can see the backend logs with the make logs command. Errors will be displayed here. You can also call make attach, which will give you access to ActivityPods’ Moleculer CLI (Moleculer is the microservice framework that all ActivityPods services run on.)

Explore your server

The frontend should now be available at the domain you chose. You can try to create an user.

Fuseki provides also a frontend to see the datasets. It is available on port 3030 of your server. The login is “admin” and the password is the one you chose on the global environment variables.

You can also see the jobs queue by connecting to Arena on port 4567 of your server.

Maintainance

It is required to regularly compact the datasets generated by Fuseki, otherwise they may grow very large. Unfortunately, due to the extension we developed to handle WAC permissions, it is required to stop Fuseki, compact it and launch it again.

We provide a script to do this which can be run like this:

Terminal window
./compact-datasets.sh

To call it every Thursday night at 4am, you can set a cron job by calling crontab -e and entering a new line like this (make sure you set the absolute path to the compact-datasets.sh script):

0 4 * * TUE /ABSOLUTE_PATH_TO/compact-datasets.sh >> ~/cron.log 2>&1