Self-Hosting

Learn how to deploy erxes on your own server with detailed instructions for Ubuntu/CentOS, including server requirements and configuration.

System Requirements

  • RAM: Ensure your environment has at least 2GB of RAM. Insufficient memory can cause processes to crash.
  • Disk Space: Ensure you have at least 10GB of free disk space.
  • Operating System: Ubuntu or CentOS

Prerequisites

Steps

    1

    Create an erxes user on the instance

    Assuming you have connected to your instance and ready to execute following steps. First you need to create erxes user because all erxes related installation scripts are made for erxes user. Why? You don't want to use root user to administer your server. So everything will be done by a user called, erxes. To accomplish this, run the following command:

    When prompted, enter unique & strong password. (Finish adding the user simply by pressing the enter or return key through the questions) Grant sudo and docker rights to erxes user by following command:

    2

    Create a directory for erxes

    3

    Place yourself in erxes directory

    4

    Initiate docker swarm mode

    Now you need to initiate docker swarm mode in order to do that use following command.

      1

      Initiate docker swarm mode

      Note

      If you get a permission denied warning when you run this command, you haven't run the usermod -aG docker erxes command.

      Note

      In erxes directory we have docker-compose.yml file even with that we do not use docker-compose up, docker-compose down, docker-compose restart commands further

    5

    Setup and start the databases

      1

      Setup mongo key and certificate for replica set

      2

      Create mongodata directory

      3

      Create redisdata directory

      4

      Generate docker-compose-dbs.yml file

      5

      Copy the generated docker-compose-dbs.yml file to the erxes directory

      6

      Start the databases

      7

      Check the status of the databases

      To check database services up use following command it will shows you all the running docker services id, name and state etc.

      8

      Make mongo have a replica set

      Now we need to make our mongo have a replica set. First we need to enter the mongo container then enter the mongo instance then execute the 3 following commands.

      Note

      You may want to hit return or enter button a few times, if we have done it correctly mongo shell will changes into "RS0: primary"

      To quit mongo instance and container run exit command twice.

    6

    Generate docker-compose.yml file

    Now we need to generate docker-compose.yml file.

    7

    Copy the generated docker-compose.yml file to the erxes directory

    Note

    If you are using plugin and you need to add environment variables to the docker-compose.yml file, you can add them in the docker-compose.yml file.

    8

    Start the erxes

    9

    Check the status of the erxes

    10

    Check the status of the erxes

    To check erxes services up use following command it will shows you all the running docker services id, name and state etc.

    11

    Configure the nginx

    Now we need to configure the erxes.

      1

      Create a new nginx configuration file

      2

      Copy the nginx configuration file below

      Note

      Replace example.com with your domain name.

      3

      Test the nginx configuration

      After that we need to test the nginx config. To do that use following command.

      4

      Restart the nginx

      If nginx test shows successful message we need to restart Nginx. To do that use the following command.

      5

      Setup SSL certificate

      erxes only works in secure connection to generate free ssl certificate we use Certbot. To configure that use the following command.

      Note

      You have to point your domain's A record to your erxes host machine in order to get certificate without that certbot will not generate certificate order.

    12

    Open the browser and enjoy our product

    After entering this command, provide your email and subscription information, and accept the terms. Following that, you will be prompted about the 'redirect' option. We highly recommend enabling this option for security reasons. Once these steps are completed, open your browser and enjoy our product.

Removing erxes

    1

    Check the status of the erxes

    First, it is unfortunate, but every server needs to be kept tidy. The following commands will help remove the Docker stack and any dangling containers in the swarm.

    2

    Remove the erxes docker stack

    To remove the erxes docker stack, use the following command.

    3

    To remove all dangling containers use the following commands.

    List and remove all dangling images.

    List and remove all dangling containers.

    List and remove all dangling volumes

    List and remove all dangling networks

Edit this page