mrmendelson / splor-web

API & Web Layer for Splore
1 stars 0 forks source link

Can't use bootstrap script to setup dev environment #20

Closed cdanielsen closed 7 years ago

cdanielsen commented 8 years ago

Attempting to clone repo and install dev environment via bootstrap.sh with the following hardware:

After cloning repo, running bootstrap.sh results in a hang on editing the env file step:

cErEALkiDD:splor-web ckd$ ls
Procfile        bootstrap-linux.sh  gulpfile.js     routes
README.md       bootstrap.sh        lib         scripts
app.js          config          package.json        test
bin         gulp            public          views
cErEALkiDD:splor-web ckd$ bootstrap.sh
-bash: bootstrap.sh: command not found
cErEALkiDD:splor-web ckd$ ./bootstrap.sh
checking for prerequisites
choose a database name [splor]:

creating .env file
created env file.
you will need to add your Khan Academy credentials. Would you like to edit this file? [Y/n]
n
^C
cErEALkiDD:splor-web ckd$ 

Rerunning script results in the following:

cErEALkiDD:splor-web ckd$ ./bootstrap.sh
checking for prerequisites
declare -x Apple_PubSub_Socket_Render="/private/tmp/com.apple.launchd.hn4F0YWIVx/Render"
declare -x HOME="/Users/ckd"
declare -x LANG="en_US.UTF-8"
declare -x LOGNAME="ckd"
declare -x OLDPWD
declare -x PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
declare -x PWD="/Users/ckd/code/splor-web"
declare -x SHELL="/bin/bash"
declare -x SHLVL="2"
declare -x SSH_AUTH_SOCK="/private/tmp/com.apple.launchd.6EmMuR5LJM/Listeners"
declare -x TERM="xterm-256color"
declare -x TERM_PROGRAM="Apple_Terminal"
declare -x TERM_PROGRAM_VERSION="361.1"
declare -x TERM_SESSION_ID="5CAC4378-2A6D-4051-B606-D07F190CEBCF"
declare -x TMPDIR="/var/folders/wg/f1wkjgxj1lxf0cjpdrd8nk600000gn/T/"
declare -x USER="ckd"
declare -x XPC_FLAGS="0x0"
declare -x XPC_SERVICE_NAME="0"
declare -x __CF_USER_TEXT_ENCODING="0x1F5:0x0:0x0"
choose a database name [splor]:

creating database 'splor'
installing dependencies
npm WARN deprecated graceful-fs@3.0.8: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible.
npm WARN deprecated lodash@1.0.2: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN deprecated graceful-fs@1.2.3: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible.
npm WARN deprecated npmconf@2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm
npm WARN prefer global node-gyp@3.3.0 should be installed with -g

> fsevents@1.0.8 install /Users/ckd/code/splor-web/node_modules/fsevents
> node-pre-gyp install --fallback-to-build

[fsevents] Success: "/Users/ckd/code/splor-web/node_modules/fsevents/lib/binding/Release/node-v47-darwin-x64/fse.node" is installed via remote

> sqlite3@3.1.1 install /Users/ckd/code/splor-web/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build

[sqlite3] Success: "/Users/ckd/code/splor-web/node_modules/sqlite3/lib/binding/node-v47-darwin-x64/node_sqlite3.node" is installed via remote

> node-sass@3.4.2 install /Users/ckd/code/splor-web/node_modules/node-sass
> node scripts/install.js

Binary downloaded and installed at /Users/ckd/code/splor-web/node_modules/node-sass/vendor/darwin-x64-47/binding.node

> spawn-sync@1.0.15 postinstall /Users/ckd/code/splor-web/node_modules/spawn-sync
> node postinstall

> node-sass@3.4.2 postinstall /Users/ckd/code/splor-web/node_modules/node-sass
> node scripts/build.js

` /Users/ckd/code/splor-web/node_modules/node-sass/vendor/darwin-x64-47/binding.node ` exists. 
 testing binary.
Binary is fine; exiting.

> splor-api@0.0.1 install /Users/ckd/code/splor-web
> cd node_modules && ln -nsf ../lib

splor-api@0.0.1 /Users/ckd/code/splor-web

{{ Graph of node modules }}

Loaded configuration file "config/db.js".
Using environment "development".
[Error: Please install 'pg' module manually]
'db:migrate' errored after 135 ms
Error: Please install 'pg' module manually

An npm list does seem to indicate pg is installed, but there are some error messages that seem to indicate the script is looking for package.json in the lib directory?

cErEALkiDD:splor-web ckd$ npm list --depth=0
splor-api@0.0.1 /Users/ckd/code/splor-web
├── async@1.5.2
├── bluebird@2.10.2
├── body-parser@1.15.0
├── bootstrap@3.3.6
├── browserify@11.2.0
├── connect-redis@2.5.1
├── cookie-parser@1.4.1
├── debug@2.2.0
├── dotenv@1.2.0
├── express@4.13.4
├── express-handlebars@2.0.1
├── express-session@1.13.0
├── gulp@3.9.1
├── gulp-livereload@3.8.1
├── gulp-nodemon@2.0.6
├── gulp-plumber@1.1.0
├── gulp-sass@2.2.0
├── gulp-sourcemaps@1.6.0
├── gulp-util@3.0.7
├── jquery@2.2.1
├── jsonwebtoken@5.7.0
├── khan@0.1.4 (git://github.com/jesseditson/khan.git#b7f5331301208b6c264effff18d136516ca3fee6)
├── knuth-shuffle@1.0.1
├──  -> /Users/ckd/code/splor-web/lib extraneous error: ENOENT: no such file or directory, open '/Users/ckd/code/splor-web/lib/package.json
├── moment@2.11.2
├── morgan@1.7.0
├── node-uuid@1.4.7
├── nodemailer@1.11.0
├── nodemailer-mailgun-transport@1.0.1
├── passport@0.3.2
├── passport-khan@0.1.0 (git://github.com/jesseditson/passport-khan.git#4570ed9352f3cf0a06f0aae7155d74ddec8f35a8)
├── pg@4.5.1
├── pg-hstore@2.3.2
├── redis@2.4.2
├── redis-url@1.2.1
├── route-parser@0.0.4
├── sequelize@3.19.3
├── sequelize-cli@1.9.2
├── serve-favicon@2.3.0
├── sqlite3@3.1.1
├── vinyl-buffer@1.0.0
├── vinyl-source-stream@1.1.0
└── watchify@3.7.0

npm ERR! extraneous: lib /Users/ckd/code/splor-web/node_modules/lib
npm ERR! error in /Users/ckd/code/splor-web/node_modules/lib: ENOENT: no such file or directory, open '/Users/ckd/code/splor-web/lib/package.json'

Replacing stock .env file with the following...

# required
KHAN_CONSUMER_KEY=REDACTED
KHAN_CONSUMER_SECRET=REDACTED
TOKEN_SECRET=verysecret
SESSION_SECRET=jefnewuie
MAILGUN_API_KEY=
MAILGUN_DOMAIN=
OVERRIDE_EMAIL=
# optional
APP_PORT=8080
APP_IP=127.0.0.1
DB_TYPE=sqlite
DB_NAME=splor
SQLITE_STORE=sqlite/splor.sqlite
REDIS_HOST=127.0.0.1
# this is a custom port because we run redis with npm start inside of package.json
REDIS_PORT=7889

...and running sequelize db:migrate manually results in the following:

Sequelize [Node: 5.6.0, CLI: 2.3.1, ORM: 3.19.3]

Loaded configuration file "config/db.js".
Using environment "development".
[Error: Please install sqlite3 package manually]

Finally, running npm run dev results in the following:

cErEALkiDD:splor-web ckd$ npm run dev

> splor-api@0.0.1 dev /Users/ckd/code/splor-web
> redis-server --port 7889 & gulp serve

sh: redis-server: command not found
[00:22:25] Using gulpfile ~/code/splor-web/gulpfile.js
[00:22:25] Starting 'sass'...
[00:22:25] Finished 'sass' after 25 ms
[00:22:25] Starting 'js'...
[00:22:25] Starting 'develop'...
[00:22:25] Finished 'develop' after 19 ms
[00:22:25] Starting 'watch'...
[00:22:25] Finished 'watch' after 15 ms
[00:22:25] [nodemon] 1.9.1
[00:22:25] [nodemon] to restart at any time, enter `rs`
[00:22:25] [nodemon] watching: *.*
[00:22:25] [nodemon] starting `node bin/www`
[00:22:27] 993771 bytes written (1.97 seconds)
[00:22:27] Finished 'js' after 2.11 s
[00:22:27] Starting 'serve'...
[00:22:27] Finished 'serve' after 4.3 μs
[00:22:27] [nodemon] restarting due to changes...
[00:22:27] [nodemon] starting `node bin/www`
events.js:154
      throw er; // Unhandled 'error' event
      ^

Error: Redis connection to 127.0.0.1:7889 failed - connect ECONNREFUSED 127.0.0.1:7889
    at Object.exports._errnoException (util.js:856:11)
    at exports._exceptionWithHostPort (util.js:879:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1053:14)
[00:22:30] [nodemon] app crashed - waiting for file changes before starting...

I'm not sure if my older machine is the issue or if it's the script, but I think I'm at kind of an impasse. Thought this might be useful feedback for some possible updates if it indicates something that doesn't look right.

YellowApple commented 8 years ago

I'd start with a clean repo and try manually following the steps in the bootstrap script (install node/SQLite/redis, make a .env, install npm dependencies, initialize the database, etc.). That should help isolate what went awry.