UNHCR GTH - Energy Planning tool
Currently under development.
- We use husky for git hooks: https://typicode.github.io/husky/#/?id=install
- We use standard version and commitlint for automatic release log and proper commit message
Prerequisites:
- Make (gnu make)
- Node.js 16.x
- use nvm https://github.com/nvm-sh/nvm#installing-and-updating
- nvm install --lts; nvm use --lts
- [yarn]
- Docker
- Docker Compose 1.27.0+
An environment file should be created; you may copy paste the following code, don't forget to replace by the appropriate bucket name and HOSTNAME
tee -a .env << EOF
COUCHDB_USER=admin
COUCHDB_PASSWORD=couchdb
COUCHDB_HOST=localhost
# EPFL DNS
DNS=128.178.15.8
EOF
make install
make run-database;
make setup-database;
make run-frontend;
# http://127.0.0.1:8080
Run configurations are in .vscode
: https://code.visualstudio.com/docs/editor/debugging
make run # will build with docker-compose and run docker-compose up -d
We use enacit-ansible to automate our process
Just run the following command and it will install the latest commit from the main branch
ansible-playbook -v -i inventory/sesvc.epfl.ch.yml playbooks/deploy-app.yml
- If you change couchdb-setup/etc/config.ini file
- You'll need to do the following:
ssh sesvc.epfl.ch # wait to be connected cd /opt/sesvc; docker-compose restart couchdb;
- You'll need to do the following:
- monthly (by the 1st) releases onto the production environment http://sesvc.epfl.ch/ including only features validated.
- intermediate releases may happen occasionally for hot fixes
Releases number follow [semantic versioning conventions](https://semver.org/\).
There is two way of doing this: first one using curl; second one using couchdb-bootstrap
curl -X PUT http://localhost:5984/_users/org.couchdb.user:[email protected] \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"name": "[email protected]", "password": "plain_text_password_that_will_be_encrypted", "roles": [], "type": "user"}'
- retrieve the inserted documented
curl -X GET http://admin:couchdb@localhost:5984/_users/org.couchdb.user:[email protected] \
-H "Accept: application/json" \
-H "Content-Type: application/json"
{"_id":"org.couchdb.user:[email protected]","_rev":"1-xxxx","name":"[email protected]","roles":[],"type":"user","password_scheme":"pbkdf2","iterations":10,"derived_key":"917a923abd865bc82feadd5659a1d0d55318ca49","salt":"83f9a989d48e31b7a5e99c28df8a989c"}
- add the result json from above inside
add the above json result as new file in
couchdb-setup/bootstrap/_users/[email protected]
: 3.a you can remove the _rev field
{
"_id": "org.couchdb.user:[email protected]",
"name": "[email protected]",
"roles": [],
"type": "user",
"password_scheme": "pbkdf2",
"iterations": 10,
"derived_key": "917a923abd865bc82feadd5659a1d0d55318ca49",
"salt": "83f9a989d48e31b7a5e99c28df8a989c"
}
- add a new file inside couchdb-setup/bootstrap/_users with
{
"_id": "org.couchdb.user:[email protected]",
"name": "[email protected]",
"roles": [],
"type": "user",
"password": "plain_text_that_will_be_hash_by_couchdb",
}
- run the following command:
make setup-database
- CouchDB has hashed the password, you can get it on http://localhost:5984/\_utils/#database/\_users/\_all_docs
- find the new user and download
- save the document by deplacing
couchdb-setup/bootstrap/_users/new_username.json
- remove the
'_rev'
field and commit the file
- run make azure
make azure
- then copy the content of the json
azure/jwt_keys.json
at the proper place inside couchdb-setup/bootstrap/_config.json - verify that the json is valid