Compiling From Source
Introduction
To install Commento from source, first set up your environment first. Once you've done that, you can go ahead and build the project. The rest of this tutorial assumes you have all the necessary tools installed.
Compiling Commento
Compiling Commento is as simple as cloning the repository and running make
.
$ git clone https://gitlab.com/commento/commento.git
$ cd commento
$ make prod
This will automatically fetch dependencies (Go and Yarn) and compile the project. The first make
might be slow; future builds will be much faster as you wouldn't have to pull all the dependencies. After the command completes, your binary would be available at ./build/prod/commento
along with other files.
If you're not running Commento in a production environment, you may want to use make devel
instead of make prod
for more descriptive frontend errors. Substitute ./build/prod
with ./build/devel
appropriately.
Launching Commento
You need to set up some non-optional configuration before starting Commento. In this example, let's assume our Commento instance will be running on the server and will be available at commento.example.com
.
Before you launch Commento, you will also need a usable PostgreSQL server. Let's say the server is available at postgres.example.com
on port 5432
with the credentials username:password
. Create a database named commento
.
Set up the environment variables to start the Commento server on commento.example.com
on port 8080
:
$ export COMMENTO_ORIGIN=http://commento.example.com:8080
$ export COMMENTO_PORT=8080
$ export COMMENTO_POSTGRES=postgres://username:password@postgres.example.com:5432/commento?sslmode=disable
$ export COMMENTO_CDN_PREFIX=$COMMENTO_ORIGIN
Set COMMENTO_CDN_PREFIX
to the appropriate URL if you are serving static content from a CDN. Otherwise, set it to the same value as COMMENTO_ORIGIN
.
You can read the documentation on configuring Commento to learn more about the different options availble. For now, this minimal configuration is sufficient.
To launch the executable:
$ ./build/prod/commento
Now you can open http://commento.example.com
on your browser and you should be greeted with the login page. Carry on to the next step to create an account and register your website.
You may want to run Commento on boot to start the server automatically with the appopriate configuration. You can do this with your favourite init system; examples files are available for SystemD (Linux) and rc.d (BSD).