Local 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:
β Caution
Erxes code takes approximately 12GB storage space, make sure you have enough space in your device before going forward.
Prerequisites
- Git
- Node.js: only LTS versions are supported v18.17.1 or higher. Other versions of Node.js may not be compatible with the latest release of erxes. The 18.17.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 Latest version.
Installing erxes
- Create an empty folder.
mkdir example
- In your empty folder, where the new erxes project will be created, and it defines the database and erxes plugins to use.
cd example
- Run following command in the folder.
git clone https://github.com/erxes/erxes.git
Installing dependencies using docker
- In the folder, create dock directory using following command.
mkdir dock
- Go to the dock folder using following command.
cd dock
βοΈ Note
Run sudo nano or sudo vim command to create .yml file.
- 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
π‘ Tip
Please find the useful commands when you're working on Docker
- Run the following command in the folder where above file exists.
sudo docker-compose up -d
- Go back to erxes folder using following command.
cd ../erxes
- Switch a dev branch by using following command.
git checkout dev
- In erxes folder, Install node modules by using following command.
yarn install
- Install
pm2
by using following command.
sudo npm install -g pm2
Running erxes
β Caution
Run erxes in erxes/cli directory
- Run following command to change the folder.
cd cli
- Install node modules in the erxes/cli directory.
yarn install
- Copy
configs.json.sample
, then convert it toconfigs.json.
cp configs.json.sample configs.json
- 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.
π‘ Tip
Frequently used pm2
commands on erxes:
- pm2 list - Display all processes status
- pm2 kill - Will remove all processes from pm2 list
- pm2 logs -f - Display all processes logs in streaming (gateway, plugin-name etc.)
- pm2 restart all - Restart all processes