vsellier / easy-cozy

Easy cozy-cloud deployment
26 stars 7 forks source link

"Bad passphrase" while creating the instance #13

Open Eirikr70 opened 2 years ago

Eirikr70 commented 2 years ago

So, here is my problem: I have installed the container behind an nginx reverse proxy through the following docker-compose.yml

version: '3.0'

services:
  db:
    image: treehouses/rpi-couchdb:2.3.0
    container_name: db
    volumes:
      - ${DATABASE_DIRECTORY}:/opt/couchdb/data
    logging:
      driver: "json-file"
      options:
        max-size: "1M"
        max-file: "10"
    restart: unless-stopped

  cozy:
    image: vsellier/easy-cozy:${COZY_STACK_VERSION}
    container_name: cozy
    environment:
      COZY_ADMIN_PASSWORD: ${COZY_ADMIN_PASSWORD}
      COZY_TLD: ${COZY_TLD}
    volumes:
      - ${STORAGE_DIRECTORY}:/usr/local/cozy-stack/storage
    ports:
      - 8082:8080
    depends_on:
      - db
    logging:
      driver: "json-file"
      options:
        max-size: "1M"
        max-file: "10"
    restart: unless-stopped

And the following .env file

# Force the cozy stack version
# see https://cloud.docker.com/swarm/vsellier/repository/docker/vsellier/easy-cozy/tags for all available versions
# Examples : 
COZY_STACK_VERSION=latest
# COZY_STACK_VERSION=2018M2S5

# The place to store the database content
DATABASE_DIRECTORY=/home/eric/easy-cozy/db

# The place to store the cozy's raw files
STORAGE_DIRECTORY=/home/eric/easy-cozy/storage

# The place to store the let's encrypt stuff
# ACME_DIRECTORY=/var/lib/acme

# The base domain used for the cozy cloud instances
COZY_TLD=cozy.xxx.fr

# The contact email used for let's encrypt
EMAIL=eric@xxx.fr

# The admin passphrase
COZY_ADMIN_PASSPHRASE='xxx'

I can initialize the database, I can see the site both through localip:8082 and cozy.mydomain.fr. But ... When I try to create the instance I get "Bad passphrase" eric@vault:~/easy-cozy $ sudo ./create-instance.sh eric

Creating instance eric.cozy.xxx.fr ...
Failed to create instance for domain eric.cozy.xxx.fr
Error: Forbidden: bad passphrase
Could not generate access to domain eric.cozy.xxx.fr
Forbidden: bad passphrase
No token found.

I have tried a huge number of turnarounds (such as creating a variable COZY_ADMIN_PASSWORD in addition to COZY_ADMIN_PASSPHRASE) but there is no way to create the instance. I have the feeling that I am close to completing the install, but I can't get past this obstacle. Got any clue ?

Eirikr70 commented 2 years ago

I should precise I have the following warnings in the logs

cozy    | Error: Could not reach Couchdb 2 database: Get "http://db:5984//_up": dial tcp 192.168.192.2:5984: connect: connection refused
cozy    | Admin passphrase already exists, skipping initialization
cozy    | time="2022-04-03T14:48:41Z" level=warning msg="Could not reach Couchdb 2 database: Get \"http://db:5984//_up\": dial tcp 192.168.192.2:5984: connect: connection refused, retrying in 1s"
Eirikr70 commented 2 years ago

Been going forward : I have been through the whole process by entering the docker container in order to create the instance and install the apps. The instance creation issues an error but seems to create the instance

Failed to create instance for domain eric.cozy.xxx.fr
Error: unknown_error: undefined

But it results in an empty /tmp file. Then I can install the apps, but what is inserted into the /tmp file is store (1.9.11) has been installed on eric.cozy.xxx.fr So there is no way I can get the token. Is there any other way such as read it in a file in the container ? I precise that the web page indicates : "You need to activate your Cozy" so I suppose it is successfully created ...

Eirikr70 commented 2 years ago

Been through the whole process. Got the app, but something has gone wrong in the install process and it doesn't work : can't upload any doc, nor install any konnector, neither through CLI nor through GUI. Trying to go further though

Eirikr70 commented 2 years ago

Pfew ! Been working on it the whole week end with no success ! Got this log

cozy    | time="2022-04-03T17:54:18Z" level=info msg="Cannot create view cozy27f33b3d7600d87d54ee0de56a2d9540 io.cozy.permissions: CouchDB(unknown_error): undefined" domain=eric.cozy.xxx.fr
cozy    | time="2022-04-03T17:54:21Z" level=info msg="cli token created from admin API at 2022-04-03 17:54:21.395195626 +0000 UTC m=+28.454173432" domain=eric.cozy.xxx.fr nspace=loginaudit
cozy    | time="2022-04-03T17:54:21Z" level=info msg="Start installer process: " domain=eric.cozy.xxx.fr nspace=apps slug=store type=install version_start=
cozy    | time="2022-04-03T17:54:21Z" level=info msg="Successful installer process: 1.9.11" domain=eric.cozy.xxx.fr nspace=apps slug=store type=install version_start=

It looks like it works anyway but ... it doesn't

vsellier commented 2 years ago

sorry to see it's not working well. It's been a while since I've used the docker-compose deployment. I will try to find some time in the next few days to test it.

Eirikr70 commented 2 years ago

Thanks, I think it is quite a small problem, but with my poor skills, I couldn't manage to make a correct diagnosis.

vsellier commented 2 years ago

It seems you have some permissions issues you should resolve before going further.

I suggest you to install your data in other place than your home directory to avoid problems with the permissions to access the directories inside your home and of course adapt the configuration accordingly. If you changer to permission of the new directory, it should be better after.

I have successfully created a new application in a local env just by doing that

test:/tmp/easycozy$ ~/easy-cozy/create-instance.sh test2
Creating instance test2.cozy.test.fr ...
Password:******
Instance created with success for domain test2.cozy.test.fr
Registration token: "xxx"
Define your password by visiting https://test2.cozy.test.fr/?registerToken=xxx
Password:******
/!\ Application registry has not been installed
/!\ Application collect has not been installed
/!\ Application onboarding has not been installed
Password:******
store (1.9.11) has been installed on test2.cozy.test.fr
Open this url on a browser to configure your instance https://test2.cozy.test.fr?registerToken=xxx

I didn't tried to used the instance because it was a quick test with a fake domain. I hope it could help you anyway


For the record, some information gathered during the attempt to reproduce the issue:

I have tried a huge number of turnarounds (such as creating a variable COZY_ADMIN_PASSWORD in addition to COZY_ADMIN_PASSPHRASE) but there is no way to create the instance. I have the feeling that I am close to completing the install, but I can't get past this obstacle. Got any clue ?

I guess you tried to connect with xxx as password but you should have used 'xxx' as the ' are not a string delimiter in the yaml

Eirikr70 commented 2 years ago

Hello, and thanks for helping me out. So, I have set my cozy directory out of my home directory, set 777 rights to all upwards and downwards directories, set a passphrase with no', but it still doesn't work. I see the create-instance.sh script should prompt for a password, but in my case it doesn't

eric@vault:~/easy-cozy $ sudo ./create-instance.sh eric
Creating instance eric.cozy.xxx.fr ...
Failed to create instance for domain eric.cozy.xxx.fr
Error: unknown_error: undefined
store (1.9.11) has been installed on eric.cozy.xxx.fr
No token found.
Eirikr70 commented 2 years ago

I should probably have precised that I use an arm64 RaspiOS : it seems that the docker image of couchdb isn't arm64 compatible.

Eirikr70 commented 2 years ago

Hello @vsellier , I finally succeeded in installing the whole app, but when trying to install the connectors, I get the message "Unable to find a service". Do you think there is something I can do ?