3.2 KiB
3.2 KiB
61. Cozy integration set up
Date: 2025-04-21
Status
Accepted
Context
- How to run Cozy locally?
Steps
Install cozy-stack CLI
- Install CouchDB
docker run -d \
--name cozy-stack-couch \
-p 5984:5984 \
-e COUCHDB_USER=admin -e COUCHDB_PASSWORD=password \
-v $HOME/.cozy-stack-couch:/opt/couchdb/data \
couchdb:3.3
curl -X PUT http://admin:password@127.0.0.1:5984/{_users,_replicator}
- Install cozy-stack CLI
- Install Go and add to path
- Clone cozy-stack
git clone git@github.com:cozy/cozy-stack.git
cd cozy-stack
make
- Create cozy configuration file
mkdir -p ~/.cozy
cp cozy.example.yaml $HOME/.cozy/cozy.yml
- Find CouchDB config inside
cozy.ymland edit as follow:
couchdb:
url: <http://admin:password@localhost:5984/>
- Run cozy-stack
- Start cozy-stack
cozy-stack serve
- Create an instance
cozy-stack instances add tmail.localhost:8080 --passphrase cozy --apps home,store,drive,photos,settings,contacts,notes,passwords --email tmail@cozy.localhost --locale en --public-name Tmail --context-name dev
- The created instance will be available at http://tmail.localhost:8080/
- The password is
cozy
Run Cozy locally
- On the cozy-twakemail side
- Clone
https://github.com/cozy/cozy-twakemail yarn installyarn buildcozy-stack serve --appdir tmail:build/ --disable-csp- Open another terminal while cozy-stack is running
cozy-stack apps install dataproxy --domain tmail.localhost:8080cozy-stack feature flags --domain tmail.localhost:8080 '{"cozy.search.enabled": true}'cozy-stack feature flags --domain tmail.localhost:8080 '{"mail.embedded-app-url": "http://localhost:2023"}'
- On the tmail side
- Apply patchs/cozy-dev-config.patch
- Edit session url in jmap-dart-client to /jmap/session
- isInsideCozy will be
falseif run on localhost, so in cozy_config_web.dart, return true on isInsideCozy - in
env.file, COZY_INTEGRATION=true and COZY_EXTERNAL_BRIDGE_VERSION=x.x.x (where x.x.x is the version of cozy-external-bridge) flutter run -d chrome --web-port 2023 --web-browser-flag "--disable-web-security" --profile
- Access Cozy
- tmail cozy: http://tmail.localhost:8080/
- The password is
cozy
Run Cozy locally with modified Cozy libs
If there is a need of modifying Cozy libs
- On cozy-libs side
- Clone
https://github.com/cozy/cozy-libs yarn installyarn buildFor example, if you want to use locally modifiedcozy-external-bridgecd packages/cozy-external-bridgeyarn linkyarn build
- On cozy-twakemail side
- Look for rlink.sh file in /scripts, move the file to ~/Downloads
mv ~/Downloads/rlink.sh ~/bin/rlinkchmod +x ~/bin/rlink- Reset the terminal
- Repeat part 1 of
Run Cozy locally - While cozy-stack is running, open another terminal in the same directory
rlink {library-you-modified-and-linked}for examplerlink cozy-external-bridge- While rlink is running, run
yarn build
- On tmail side
- Repeat part 2 of
Run Cozy locally
Note: You can leave the cozy-stack and rlink running if you plan to further modify Cozy libs. After each modification, run yarn build in cozy-libs packages side then run yarn build in cozy-twakemail side, then refresh the browser.