CoderDojo / cp-local-development

Local development tool for the Community Platform
MIT License
19 stars 56 forks source link

Cannot load test data #42

Open nerdess opened 8 years ago

nerdess commented 8 years ago

localhost:8000 is working fine but when I execute

run ./localdev.js testdata zen

i get lots of postgres-related errors. attached my postgres logfile

postgresql_error_log.txt

nerdess commented 8 years ago

I checked load_test_data.sh and found out the problem is within this line

PGPASSWORD=$POSTGRES_PASSWORD psql --single-transaction -w -h $POSTGRES_HOST -U $POSTGRES_USERNAME -d $POSTGRES_NAME -f "$PROJECT_DIR/scripts/database/pg/populate-dojos.sql" --port $POSTGRES_PORT

$POSTGRES_NAME uses the database "cp-dojos-development" but when I look into this database it has no tables so of course any INSERT state fails.

Where can I find the schema for cp-dojos-development?

Wardormeur commented 8 years ago

Migrations are ran/checked upon each run, try running ./localdev run zen once before using testdata

nerdess commented 8 years ago

there is no testdata, the database cp-dojos-development is emtpy...!

Wardormeur commented 8 years ago

The tables are created through migrations scripts which are run when the service is ran (ie : https://github.com/CoderDojo/cp-dojos-service/blob/master/service.js#L39 ) Even though you'll have the schema through the run, is disrecommend using test-data as https://github.com/CoderDojo/community-platform/issues/926 shows that a part of those are broken

nerdess commented 8 years ago

without test data there is no german version of the page so i cannot try and fix this issue: https://github.com/CoderDojo/community-platform/issues/856

also, without testdata i cannot login to try and replicate the bug. i can't even register as a new user on localhost since the "Select a user type" dropdown is not populated with the various coderdojo usertypes (Parent/Guardian, Mentor....)

i'd really love to fix some issues on the platform but without a working local dev environment i cannot do anything :(

Wardormeur commented 8 years ago

I'll try to have a look soon, but you don't need the test-data to run zen, running it with empty data is also possible You'll need the translation file from crowdin to get it in german (https://crowdin.com/project/zen-community-platform/de#) and put it in the locale folder (under a newly created de_DE folder)

nerdess commented 8 years ago

but how can i login without the testdata?

also: the translation file is several files/folders, not sure what is needed there....

Wardormeur commented 8 years ago

I don't believe you need any data to get it running,(as you can still register locally). Like I said, I'll have a look at it asap though. In the meantime, can you tell me which version of postgres are you running? Regarding the translations, there is a "cloud-like" button on the right side before the list of file that allows you to download all the files at once :)

Wardormeur commented 8 years ago

Hye, just tested here, testdata works when migrations are ran before, run ./localdev run zen first, then the testdata one. The reason is the run cmd is adding the tables which are required to insert the data in, and your error (which I also had by not runnning "run zen") specifically says you're missing the table initialization

nerdess commented 8 years ago

sorry for responding so late :)

did a git pull, ran npm install and ./localdev run zen and now the data migration worked...!

nerdess commented 8 years ago

well actually.....cheered too early. I was trying to login once using manager@example.com / test but then all just fell apart. when i execute ./localdev run zen i now get a strange error and localhost is not available:

Error running service: Error running command: node ./service.js - Error: Command failed: node ./service.js module.js:442 throw err; ^

Error: Cannot find module '../build/Debug/addon' at Function.Module._resolveFilename (module.js:440:15) at Function.Module._load (module.js:388:25) at Module.require (module.js:468:17) at require (internal/module.js:20:19) at Object. (/Users/sissi/Sites/cp-local-development/workspace-zen/cp-dojos-service/node_modules/heapdump/lib/main.js:18:15) at Module._compile (module.js:541:32) at Object.Module._extensions..js (module.js:550:10) at Module.load (module.js:458:32) at tryModuleLoad (module.js:417:12) at Function.Module._load (module.js:409:3)

Error: Cannot find module '../build/Debug/addon' at Function.Module._resolveFilename (module.js:440:15) at Function.Module._load (module.js:388:25) at Module.require (module.js:468:17) at require (internal/module.js:20:19) at Object. (/Users/sissi/Sites/cp-local-development/workspace-zen/cp-dojos-service/node_modules/heapdump/lib/main.js:18:15) at Module._compile (module.js:541:32) at Object.Module._extensions..js (module.js:550:10) at Module.load (module.js:458:32) at tryModuleLoad (module.js:417:12) at Function.Module._load (module.js:409:3)

at ChildProcess.exithandler (child_process.js:207:12)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:852:16)
at Socket.<anonymous> (internal/child_process.js:323:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:492:12) - module.js:442
throw err;
^

Error: Cannot find module '../build/Debug/addon' at Function.Module._resolveFilename (module.js:440:15) at Function.Module._load (module.js:388:25) at Module.require (module.js:468:17) at require (internal/module.js:20:19) at Object. (/Users/sissi/Sites/cp-local-development/workspace-zen/cp-dojos-service/node_modules/heapdump/lib/main.js:18:15) at Module._compile (module.js:541:32) at Object.Module._extensions..js (module.js:550:10) at Module.load (module.js:458:32) at tryModuleLoad (module.js:417:12) at Function.Module._load (module.js:409:3)

2016-06-28T14:54:30.263Z ewp8fatj3t0a/1467125668925/23347/- INFO client {type:web,port:10303,pin:role:cd-users,cmd:} 2016-06-28T14:54:30.264Z ewp8fatj3t0a/1467125668925/23347/- INFO client {type:web,port:10303,pin:role:cd-profiles,cmd:} events.js:160 throw er; // Unhandled 'error' event ^

Error: listen EADDRINUSE 0.0.0.0:10306 at Object.exports._errnoException (util.js:1007:11) at exports._exceptionWithHostPort (util.js:1030:20) at Server._listen2 (net.js:1253:14) at listen (net.js:1289:10) at net.js:1399:9 at _combinedTickCallback (internal/process/next_tick.js:77:11) at process._tickDomainCallback (internal/process/next_tick.js:122:9) Error running service: Error running command: node ./service.js - Error: Command failed: node ./service.js events.js:160 throw er; // Unhandled 'error' event ^

Error: listen EADDRINUSE 0.0.0.0:10306 at Object.exports._errnoException (util.js:1007:11) at exports._exceptionWithHostPort (util.js:1030:20) at Server._listen2 (net.js:1253:14) at listen (net.js:1289:10) at net.js:1399:9 at _combinedTickCallback (internal/process/next_tick.js:77:11) at process._tickDomainCallback (internal/process/next_tick.js:122:9)

Error: listen EADDRINUSE 0.0.0.0:10306 at Object.exports._errnoException (util.js:1007:11) at exports._exceptionWithHostPort (util.js:1030:20) at Server._listen2 (net.js:1253:14) at listen (net.js:1289:10) at net.js:1399:9 at _combinedTickCallback (internal/process/next_tick.js:77:11) at process._tickDomainCallback (internal/process/next_tick.js:122:9)

at ChildProcess.exithandler (child_process.js:207:12)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:852:16)
at Socket.<anonymous> (internal/child_process.js:323:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:492:12) - events.js:160
  throw er; // Unhandled 'error' event
  ^

Error: listen EADDRINUSE 0.0.0.0:10306 at Object.exports._errnoException (util.js:1007:11) at exports._exceptionWithHostPort (util.js:1030:20) at Server._listen2 (net.js:1253:14) at listen (net.js:1289:10) at net.js:1399:9 at _combinedTickCallback (internal/process/next_tick.js:77:11) at process._tickDomainCallback (internal/process/next_tick.js:122:9)

events.js:160 throw er; // Unhandled 'error' event ^

Error: ENAMETOOLONG: name too long, stat 'workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests/workspace-zen/cp-e2e-tests' at Error (native)

nerdess commented 8 years ago

did a "npm rebuild" and now get a different error which sums up as this:

Seneca Fatal Error
==================

Message: Module version mismatch. Expected 48, got 47.

did "npm install --save seneca" but this does not help/change anything.....also removed the node_modules folder and ran "npm install" again no success.

btw: running node 6.2.2. and npm 3.9.5.

Wardormeur commented 8 years ago

We didn't test on node 6.2 so far until we have proper tests, so that only 0.10.43 is the recognized version which runs properly