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.
Install Docker with the Compose plugin
We have prepared a script for this:
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.
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:
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:
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:
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):