Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difficulties to setup the dev environment #2903

Open
Peltoche opened this issue Apr 17, 2023 · 8 comments
Open

Difficulties to setup the dev environment #2903

Peltoche opened this issue Apr 17, 2023 · 8 comments

Comments

@Peltoche
Copy link

Hi 👋

I have some difficulties to setup my dev environment. I have installed couchdb locally and it run well:

 curl --silent -XGET http://admin:[email protected]:5984/                                                                             ✔ 
{"couchdb":"Welcome","version":"3.2.2","git_sha":"d5b746b7c","uuid":"a93d5b2525abe571944e0a5315af21bc","features":["access-ready","partitioned","pluggable-storage-engines","reshard","scheduler"],"vendor":{"name":"The Apache Software Foundation"}}

Now I try unsuccessfully to start the docker image cozy-app-dev as it's described in the documenttion. I just added the COUCHDB_URL config because I'm running a couchdb V3 so I don't have the party mode enabled and I can't find any other way to setup the user/password for couchdb.

docker run --rm -it --env COUCHDB_URL=http://admin:password@localhost:5984/ --net=host -v "$(pwd)/build/drive":/data/cozy-app/drive cozy/cozy-app-dev

the output gives me:

checking that localhost:8080 is free... ok
waiting for couchdb...ok
checking couchdb on http://admin:password@localhost:5984/... failed
error: couchdb v1 is running on http://admin:password@localhost:5984/
error: you need couchdb version >= 2
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]

As you can see in one of the call above my couchdb version is "3.2.2" so it should be ok but it still fail.

I have found the error location: https://github.com/cozy/cozy-stack/blob/master/scripts/cozy-app-dev.sh#L140 but I don't see what could fails. All I know is that if I enter an invalid user/password it give the same output but I'm pretty sure of my credentials as I'm connected with it and I tried directly with the curl.

@Crash--
Copy link
Contributor

Crash-- commented Apr 17, 2023

Thanks for creating the issue.

@nono, since it seems related to cozy-app-dev, do you have any idea?

@Peltoche internally we don't use the cozy-app-dev image, we rely on a manual installation https://docs.cozy.io/en/cozy-stack/INSTALL/ . We need to reflect that in our external documentation.

@Peltoche
Copy link
Author

I did tried this too but I didn't find a way to run the local code and make it available into the instance

@Crash--
Copy link
Contributor

Crash-- commented Apr 18, 2023

https://docs.cozy.io/en/cozy-stack/cli/cozy-stack_serve/

cozy-stack serve --appdir drive:/path/to/drive/build/drive

Like that, the slug drive will be served to the instances from the build/drive directory

@nono
Copy link
Member

nono commented Apr 18, 2023

Hi,

the cozy-app-dev docker image has a CouchDB. You don't need to have CouchDB installed before running it. And, in fact, it was not tested to use an external CouchDB.

@Peltoche
Copy link
Author

https://docs.cozy.io/en/cozy-stack/cli/cozy-stack_serve/

Still have issues...

Folder with cozy-drive:

yarn watch:drive:browser

(I have exported the env variable NODE_OPTIONS=--openssl-legacy-provider for fixing #2902)

Folder with cozy-stack:

cozy-stack serve --dev --config $HOME/.config/cozy/config.yaml --mailhog --fs-url=file://localhost${PWD}/storage --konnectors-cmd ${PWD}/scripts/konnector-node-run.sh --appdir drive2:$HOME/Cozy/cozy-drive/build/drive

Error 1:

If I don't add the --dev option it don't find the admin-passphrase file even if it's created and valid.

Error 2:

When a reach http://drive2.cozy.localhost:8080/ I have a blank page. I found out that the url *.cozy.localhost was not resolved so I added 127.0.0.1 cozy.localhost inside /etc/hosts and it seems to solve the issue

Error 3:

When a reload the page I still have an blank page with the following issue:

Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”).
Uncaught EvalError: call to eval() blocked by CSP

@Crash--
Copy link
Contributor

Crash-- commented Apr 18, 2023

add --disable-csp to cozy-stack serve when working with watch / start command

@Peltoche
Copy link
Author

the cozy-app-dev docker image has a CouchDB. You don't need to have CouchDB installed before running it. And, in fact, it was not tested to use an external CouchDB.

I tried without an external couchdb but it blocks at waiting for couchdb.... I have tried with and without --net=host and with and without the 127.0.0.1 cozy.localhost inside /etc/hosts

@Peltoche
Copy link
Author

Peltoche commented Apr 18, 2023

add --disable-csp to cozy-stack serve when working with watch / start command

Curiously even with the --disable-csp flag I still have the same error.

My logs:

cozy-stack serve --dev --disable-csp --config $HOME/.config/cozy/config.yaml --mailhog --fs-url=file://localhost${PWD}/storage --konnectors-cmd ${PWD}/scripts/konnector-node-run.sh --appdir drive:$HOME/Cozy/cozy-drive/build/drive 
                           !! DEVELOPMENT RELEASE !!
You are running a development release which may deactivate some very important
security features. Please do not use this binary as your production server.

INFO[0000] Started in-memory broker for 21 workers type  nspace=jobs
Ready and waiting for connections:
  http server major started on "localhost:8080"
  http server admin started on "localhost:6060"
time=2023-04-18T14:36:58+02:00	status=200	method=GET	host=drive.cozy.localhost:8080	uri=/	bytes_out=1653
time=2023-04-18T14:36:58+02:00	status=200	method=GET	host=cozy.localhost:8080	uri=/assets/styles/theme.faa4e12bdc.css	bytes_out=34
time=2023-04-18T14:36:58+02:00	status=200	method=GET	host=drive.cozy.localhost:8080	uri=/app/drive.js	bytes_out=7196552
time=2023-04-18T14:36:59+02:00	status=200	method=GET	host=drive.cozy.localhost:8080	uri=/vendors/drive.js	bytes_out=51638673
time=2023-04-18T14:36:59+02:00	status=200	method=GET	host=drive.cozy.localhost:8080	uri=/apple-touch-icon.png	bytes_out=464
time=2023-04-18T14:36:59+02:00	status=200	method=GET	host=drive.cozy.localhost:8080	uri=/favicon-16x16.png	bytes_out=297
time=2023-04-18T14:37:03+02:00	status=200	method=GET	host=drive.cozy.localhost:8080	uri=/	bytes_out=1653
time=2023-04-18T14:37:03+02:00	status=200	method=GET	host=cozy.localhost:8080	uri=/assets/styles/theme.faa4e12bdc.css	bytes_out=34
time=2023-04-18T14:37:04+02:00	status=200	method=GET	host=drive.cozy.localhost:8080	uri=/app/drive.js	bytes_out=7196552
time=2023-04-18T14:37:04+02:00	status=200	method=GET	host=drive.cozy.localhost:8080	uri=/vendors/drive.js	bytes_out=51638673
time=2023-04-18T14:37:05+02:00	status=200	method=GET	host=drive.cozy.localhost:8080	uri=/apple-touch-icon.png	bytes_out=464
time=2023-04-18T14:37:05+02:00	status=200	method=GET	host=drive.cozy.localhost:8080	uri=/favicon-16x16.png	bytes_out=297
time=2023-04-18T14:45:59+02:00	status=200	method=GET	host=drive.cozy.localhost:8080	uri=/	bytes_out=1653
time=2023-04-18T14:45:59+02:00	status=200	method=GET	host=cozy.localhost:8080	uri=/assets/styles/theme.faa4e12bdc.css	bytes_out=34
time=2023-04-18T14:45:59+02:00	status=200	method=GET	host=drive.cozy.localhost:8080	uri=/app/drive.js	bytes_out=7196552
time=2023-04-18T14:46:00+02:00	status=200	method=GET	host=drive.cozy.localhost:8080	uri=/vendors/drive.js	bytes_out=51638673
time=2023-04-18T14:46:00+02:00	status=200	method=GET	host=drive.cozy.localhost:8080	uri=/apple-touch-icon.png	bytes_out=464
time=2023-04-18T14:46:00+02:00	status=200	method=GET	host=drive.cozy.localhost:8080	uri=/favicon-16x16.png	bytes_out=297

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants