Skip to content

Instantly share code, notes, and snippets.

@tuanlc
Last active November 8, 2020 11:30
Show Gist options
  • Save tuanlc/217f000285404c22fe84f61c5a507daf to your computer and use it in GitHub Desktop.
Save tuanlc/217f000285404c22fe84f61c5a507daf to your computer and use it in GitHub Desktop.
Install OpenPaas instruction

I. Prepare.

​ If you get stuck at any step, have a quick look at F.A.Q part.

I. Prepare.

​ Follow documentation here to install docker.

Follow Manage Docker as a non-root user part to run docker without root requirement.

Node js

  • Install nvm: following here
  • Install node 10:
    nvm install 10
    nvm use 10
    nvm alias default 10

Additional packages

The following packages are for Ubuntu. If you are using other distributions of Linux, find the corresponding packages.

    sudo apt-get install build-essential python-setuptools graphicsmagick graphicsmagick-imagemagick-compat libcairo2-dev libpango1.0-dev libgif-dev

Install the npm dependency

npm install -g mocha grunt-cli bower karma-cli

II. Install

Clone OpenPaaS project

git clone https://ci.linagora.com/linagora/lgs/openpaas/esn.git

Create/ start/ stop service

​ Create and run docker services (for the first time): ​

docker run -d --name esn-elas -p 9200:9200 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:6.3.2
docker run -d --name esn-mongo -p 27017:27017 mongo:3.2.0
docker run -d --name esn-redis -p 6379:6379 redis:latest
docker run -d --name esn-rabbit -p 5672:5672 rabbitmq:3.6.5-management
docker run --name esn-sabre -d -p 8001:80 -e "SABRE_MONGO_HOST=172.17.0.1" -e "ESN_MONGO_HOST=172.17.0.1" -e "ESN_HOST=172.17.0.1" -e "AMQP_HOST=172.17.0.1"  linagora/esn-sabre

Stop services:

docker stop esn-elas esn-mongo esn-redis esn-rabbit esn-sabre

​ Start services:

​docker start esn-elas esn-mongo esn-redis esn-rabbit esn-sabre

Go to the ESN project directory and install project dependencies

Note: You need to run the following commands as a normal user (No sudo and root permissions).

   cd esn
   npm install
   bower install

Configuration

  • DB
$ node ./bin/cli db --host localhost --port 27017 --database esn
  • elasticsearch

It will create the indexes on the elasticsearch instance defined from CLI options.

$ node ./bin/cli elasticsearch -t users -i user.idx
  • t (--type): Defines the type of index. When not set, it will create all the required indexes.

  • i (--index): Defines the index to create. When not set, it will be built from type(Eg: if the type is users then the index is users.idx.

  • populate

It will populate the MongoDB database with initial required data to use OpenPaaS.

$ node ./bin/cli populate

Once populated, you should be able to log into the OpenPaaS instance using user [email protected] and password secret.

Start OpenPaas

  • Start OpenPaaS in dev mode:

$ grunt dev

Open http://localhost:8080 with your browser and login with [email protected]/secret

James

Run docker service

# Before you start:
# - Change /home/sangnd/workspace/rse to the path of ESN source code
# - Copy content of docker/config/jwt/public to docker/config/james/jwt_publickey
# - Change the RabbitMQ IP to your own RabbitMQ server. The current value is
#   172.17.0.1 which mean that RabbitMQ is accessible via Docker host IP
#
# Pull latest images:
#   docker-compose -f docker-compose-james.yml pull
#
# Clean everything of the last launching:
#   docker-compose -f docker-compose-james.yml down -v
#
# Start:
#   docker-compose -f docker-compose-james.yml up
version: '2'

services:

  james:
    entrypoint: bash -c "java -Dlogback.configurationFile=/root/conf/logback.xml -Dworking.directory=/root/ -jar james-server.jar"
    image: linagora/james-memory:openpaas-1.7.10-rc2
    container_name: esn_james
    hostname: open-paas.org
    ports:
      - "8000:8000"
      - "1080:80"
      - "1025:25"
      - "1110:110"
      - "1143:143"
      - "1465:465"
      - "1587:587"
      - "1993:993"
    extra_hosts:
      - "rabbitmq:172.17.0.1"
    volumes:
      - /home/tlcong/workspace/linagora/esn/docker/config/james:/root/conf:ro

F.A.Q.

Got EACCESS error when running npm install

Try to remove ~/.npm and rerun npm install

  rm -r ~/.npm
  npm install

Got error relating to node-canvas

Following this documentation

Example with ubuntu, try to run the following command:

  sudo apt-get install libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev build-essential g++

During further manipulations you encounter errors with node modules

Try to reinstall them

rm -rf node_modules/
npm install

The docker containers port already taken by other services

You need to find out and stop/remove the services which are using the ports.

  sudo netstat -pna | grep port
  sudo service service_name stop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment