Installation on Ubuntu

The following documentation will guide you through the installation of an erxes project using Docker on Ubuntu.

Docker is an open platform that allows to develop, ship and run applications by using containers (i.e. packages containing all the parts an application needs to function, such as libraries and dependencies).

Preparing the installation


erxes installation requires at least four software prerequisites to be already installed on your computer:

Prerequisites

  • Git
  • Node.js: only LTS versions are supported (v14 and v16). Other versions of Node.js may not be compatible with the latest release of erxes. The 14.x version is most recommended by erxes. The easier way to install nvm is here.
  • npm and yarn (latest version) to run the erxes.
  • Docker (v20.10.14 and higher) The 20.10.14 version is most recommended by erxes. Docker compose (v2.5.0 and higher)

Installing erxes


  1. Create an empty folder.
mkdir example
  1. In your empty folder, where the new erxes project will be created, and it defines the database and erxes plugins to use.
cd example
  1. Run following command in the folder.
git clone https://github.com/erxes/erxes.git

Installing dependencies using docker

  1. In the folder, create dock directory using following command.
mkdir dock
  1. Go to the dock folder using following command.
cd dock
  1. Create a docker-compose.yml file, then copy the following script in the newly created file.
version: '3.6'
services:
  mongo:
    hostname: mongo
    image: mongo:4.0.10
    # container_name: mongo
    ports:
      - "27017:27017"
    networks:
      - erxes-net
    healthcheck:
      test: test $$(echo "rs.initiate().ok || rs.status().ok" | mongo --quiet) -eq 1
      interval: 2s
      timeout: 2s
      retries: 200
    command: ["--replSet", "rs0", "--bind_ip_all"]
    extra_hosts:
      - "mongo:127.0.0.1"
    volumes:
      - ./data/db:/data/db

  redis:
    image: 'redis'
    # container_name: redis
    # command: redis-server --requirepass pass
    ports:
      - "6379:6379"
    networks:
      - erxes-net

  rabbitmq:
    image: rabbitmq:3.7.17-management
    # container_name: rabbitmq
    restart: unless-stopped
    hostname: rabbitmq
    ports:
      - "15672:15672"
      - "5672:5672"
    networks:
      - erxes-net
    # RabbitMQ data will be saved into ./rabbitmq-data folder.
    volumes:
      - ./rabbitmq-data:/var/lib/rabbitmq

networks:
  erxes-net:
    driver: bridge
  1. Run the following command in the folder where above file exists.
sudo docker-compose up -d
  1. Go back to erxes folder using following command.
cd ../erxes
  1. Switch a dev branch by using following command.
git checkout dev
  1. In erxes folder, Install node modules by using following command.
yarn install
  1. Install pm2 by using following command.
sudo npm install -g pm2

Running erxes


  1. Run following command to change the folder.
cd cli
  1. Install node modules in the erxes/cli directory.
yarn install
  1. Copy configs.json.sample, then convert it to configs.json.
cp configs.json.sample configs.json
  1. Run following command to start your erxes project.
./bin/erxes.js dev

If your browser don't automatically jump to localhost:3000, you should check logs by using these commands.

If you see this screen, you have successfully install erxes XOS. Congratulations πŸŽ‰πŸŽ‰πŸŽ‰

Was this page helpful?