diff --git a/docker-compose.yml b/docker-compose.yml index cebbbbb7a65d2cfdeb796490cb65c8cfb939945a..1dfd3d0fb4c4753495af545554e191970768d242 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,14 +1,26 @@ version: '3.7' services: stack: - image: cozy/cozy-app-dev:1.5.4 + image: registry.forge.grandlyon.com/web-et-numerique/llle_project/cozy-stack:1.5.7 + container_name: cozy-stack + depends_on: + - cozy-db ports: - 8080:8080 - - 5984:5984 - 8025:8025 volumes: - ./docker/cozy-app-dev-with-app.sh:/usr/bin/cozy-app-dev.sh - ./build:/data/cozy-app/ecolyo - - ./data/db:/usr/local/couchdb/data + # - ./data/db:/usr/local/couchdb/data - ./data/storage:/data/cozy-storage - - ./docker/disableCSP.yaml:/etc/cozy/cozy.yaml + - ./docker/cozy.yaml:/etc/cozy/cozy.yaml + + cozy-db: + image: couchdb:3.2.2 + container_name: cozy-db + volumes: + - ./data/db:/opt/couchdb/data + - ./docker/local.ini:/opt/couchdb/etc/local.ini + restart: unless-stopped + ports: + - 5984:5984 diff --git a/docker/cozy-app-dev-with-app.sh b/docker/cozy-app-dev-with-app.sh index 3847650d3f0034fe2a57b16f38d23a88b1ee873d..e53fc8881b7018f837bf9de7c815b75298fe17d8 100755 --- a/docker/cozy-app-dev-with-app.sh +++ b/docker/cozy-app-dev-with-app.sh @@ -8,7 +8,7 @@ set -m [ -z "${COZY_STACK_PORT}" ] && COZY_STACK_PORT="8080" [ -z "${COZY_STACK_PASS}" ] && COZY_STACK_PASS="cozy" [ -z "${COZY_STACK_ADMIN_PORT}" ] && COZY_STACK_ADMIN_PORT="6060" -[ -z "${COUCHDB_URL}" ] && COUCHDB_URL="http://localhost:5984/" +[ -z "${COUCHDB_URL}" ] && COUCHDB_URL="http://admin:password@cozy-db:5984/" [ -n "${COZY_KONNECTORS_CMD}" ] && COZY_KONNECTORS_CMD_OPTION="--konnectors-cmd $COZY_KONNECTORS_CMD" if [ -d "${COZY_STACK_PATH}" ] && [ -f "${COZY_STACK_PATH}/cozy-stack" ]; then @@ -138,7 +138,8 @@ do_check_couchdb() { printf "checking couchdb on %s... " "${COUCHDB_URL}" couch_test=$(curl -s -XGET "${COUCHDB_URL}" || echo "") - couch_vers=$(grep "\"version\":\s*\"2" <<< "${couch_test}" || echo "") + printf "checking couchdb on %s... " "${couch_test}" + couch_vers=$(grep "\"version\":\s*\"3" <<< "${couch_test}" || echo "") if [ -z "${couch_test}" ]; then echo "failed" @@ -146,8 +147,9 @@ do_check_couchdb() { exit 1 elif [ -z "${couch_vers}" ]; then echo "failed" + echo "${couch_vers}" echo_err "couchdb v1 is running on ${COUCHDB_URL}" - echo_err "you need couchdb version >= 2" + echo_err "you need couchdb version >= 3" exit 1 fi diff --git a/docker/disableCSP.yaml b/docker/cozy.yaml similarity index 99% rename from docker/disableCSP.yaml rename to docker/cozy.yaml index 1ed8eaa9b39b9837af64a75f7503ef3d2d77b0c3..525c2f3142f3f876108665b2286b42c04ba0a977 100644 --- a/docker/disableCSP.yaml +++ b/docker/cozy.yaml @@ -4,6 +4,5 @@ # You will ALWAYS have CSPs working on a real Cozy # so your final application must work with them on disable_csp: true - # You can find a complete example of the cozy-stack config file here: # https://github.com/cozy/cozy-stack/blob/master/cozy.example.yaml diff --git a/docker/local.ini b/docker/local.ini new file mode 100644 index 0000000000000000000000000000000000000000..c9b3888799b787df0a38db8c8316adfde3070076 --- /dev/null +++ b/docker/local.ini @@ -0,0 +1,95 @@ +; CouchDB Configuration Settings + +; Custom settings should be made in this file. They will override settings +; in default.ini, but unlike changes made to default.ini, this file won't be +; overwritten on server upgrade. + +[couchdb] +;max_document_size = 4294967296 ; bytes +;os_process_timeout = 5000 + +[couch_peruser] +; If enabled, couch_peruser ensures that a private per-user database +; exists for each document in _users. These databases are writable only +; by the corresponding user. Databases are in the following form: +; userdb-{hex encoded username} +;enable = true +; If set to true and a user is deleted, the respective database gets +; deleted as well. +;delete_dbs = true +; Set a default q value for peruser-created databases that is different from +; cluster / q +;q = 1 + +[chttpd] +;port = 5984 +;bind_address = 127.0.0.1 +; Options for the MochiWeb HTTP server. +;server_options = [{backlog, 128}, {acceptor_pool_size, 16}] +; For more socket options, consult Erlang's module 'inet' man page. +;socket_options = [{sndbuf, 262144}, {nodelay, true}] + +[httpd] +; NOTE that this only configures the "backend" node-local port, not the +; "frontend" clustered port. You probably don't want to change anything in +; this section. +; Uncomment next line to trigger basic-auth popup on unauthorized requests. +;WWW-Authenticate = Basic realm="administrator" + +; Uncomment next line to set the configuration modification whitelist. Only +; whitelisted values may be changed via the /_config URLs. To allow the admin +; to change this value over HTTP, remember to include {httpd,config_whitelist} +; itself. Excluding it from the list would require editing this file to update +; the whitelist. +;config_whitelist = [{httpd,config_whitelist}, {log,level}, {etc,etc}] + +[chttpd_auth] +; If you set this to true, you should also uncomment the WWW-Authenticate line +; above. If you don't configure a WWW-Authenticate header, CouchDB will send +; Basic realm="server" in order to prevent you getting logged out. +; require_valid_user = false + +[ssl] +;enable = true +;cert_file = /full/path/to/server_cert.pem +;key_file = /full/path/to/server_key.pem +;password = somepassword +; set to true to validate peer certificates +;verify_ssl_certificates = false +; Set to true to fail if the client does not send a certificate. Only used if verify_ssl_certificates is true. +;fail_if_no_peer_cert = false +; Path to file containing PEM encoded CA certificates (trusted +; certificates used for verifying a peer certificate). May be omitted if +; you do not want to verify the peer. +;cacert_file = /full/path/to/cacertf +; The verification fun (optional) if not specified, the default +; verification fun will be used. +;verify_fun = {Module, VerifyFun} +; maximum peer certificate depth +;ssl_certificate_max_depth = 1 +; +; Reject renegotiations that do not live up to RFC 5746. +;secure_renegotiate = true +; The cipher suites that should be supported. +; Can be specified in erlang format "{ecdhe_ecdsa,aes_128_cbc,sha256}" +; or in OpenSSL format "ECDHE-ECDSA-AES128-SHA256". +;ciphers = ["ECDHE-ECDSA-AES128-SHA256", "ECDHE-ECDSA-AES128-SHA"] +; The SSL/TLS versions to support +;tls_versions = [tlsv1, 'tlsv1.1', 'tlsv1.2'] + +; To enable Virtual Hosts in CouchDB, add a vhost = path directive. All requests to +; the Virual Host will be redirected to the path. In the example below all requests +; to http://example.com/ are redirected to /database. +; If you run CouchDB on a specific port, include the port number in the vhost: +; example.com:5984 = /database +[vhosts] +;example.com = /database/ + +; To create an admin account uncomment the '[admins]' section below and add a +; line in the format 'username = password'. When you next start CouchDB, it +; will change the password to a hash (so that your passwords don't linger +; around in plain-text files). You can add more admin accounts with more +; 'username = password' lines. Don't forget to restart CouchDB after +; changing this. +[admins] +admin = password