This documentation describe how to start the backend in docker container and the frontend in a native way.
Setup the docker_compose stack
Services available in the docker compose stack are:
- object store (minio for now)
- caliopen's api (api)
- caliopen's frontend (frontend)
- caliopen's lmtp service (broker)
You can start storage services using these commands:
cd devtools docker-compose pull docker-compose up -d redis cassandra elasticsearch
(wait few seconds for cassandra to warm-up)
Using caliopen cli tool: * You must setup storage and some basic configuration (TTL for notifications):
cd devtools docker-compose run cli setup
- You should create an admin user with the same username as in
docker-compose run cli create_user -e admin -p 123456
- Then, you could create an user and import email
docker-compose run cli create_user -e dev -p 123456 docker-compose run cli import -e email@example.com -f mbox -p firstname.lastname@example.org
NB : data are persisted after containers are stopped, even after being destroyed.
Finally start the stack
docker-compose up -d frontend broker api apiv1
NB : for now, outgoing emails are caught by a local smtp server for testing purpose.
You will have a Caliopen instance filled with data, accessible from your browser on localhost:4000.
You could check outgoing emails by pointing your browser at localhost:8888.
Remote identities poller and workers
To automatically fetch emails from remote IMAP accounts you need to : 1. launch identityworker 2. create a remote identity for user dev 3. launch identitypoller
1. launch imap_worker
docker-compose up -d identity_worker
2. create a remote identity for user dev:
- Create at least one remote identity for user dev. Enter email account (-l), password (-p), server address (-s) and user_name for dev account (-u) :
docker-compose run --no-deps --entrypoint imapctl identity_worker addremote -l 'email@example.com' -p 'your_secret_password' -s 'imap.gmail.com:993' -u 'dev'
3. launch ids_poller
docker-compose up -d identity_poller
ids_poller will retrieve remote identities from cassandra and schedule fetching jobs accordingly on a regularly basis.
You can add more remote identities later, they will be retrieve by ids_poller as well.
Start frontend natively
- You need node v8 or later
- You need yarn to manage dependencies.
- Enventually stop the frontend container
docker-compose stop frontend
Then develop locally using your normal practices:
cd src/frontend/web_application yarn install npm start
It's a bit long to compile. The first time you will see some errors about a missing file, it will be fixed at the end of the compilation.
Rebuild a container
In case the image of a service (api or apiv1 ...) is not up-to-date, you mmight need to rebuild a container.
Replace "api" by the service you want to rebuild
docker-compose build api docker-compose stop api docker-compose up -d api
To reset containers and data:
docker-compose stop # remove containers : docker-compose rm # remove volumes created by containers : docker volume rm devtools_db devtools_index devtools_store
elasticsearch won't start:
According to this issue, you might solve it with this command on the host:
sysctl -w vm.max_map_count=262144 # make it permanent: echo "vm.max_map_count = 262144" > sudo tee /etc/sysctl.d/vm.caliopen.conf
frontend does not build
The following error may appears:
Module build failed: Error: ENOENT: no such file or directory, scandir '/.../CaliOpen/Caliopen/src/frontend/web_application/node_modules/node-sass/vendor
It is related to node-sass
installation. To fix the easiest way is to remove
node_modules then reinstall with yarn:
(cd src/frontend/web_application/ && rm -r node_modules && yarn)
or rebuild node-sass:
npm rebuild node-sass