Open valorloff opened 8 years ago
Did you also change your MONGO_URL here? https://github.com/Q42/meteor-gce/blob/master/startup.sh#L71
Did you upload your changed startup.sh to your bucket?
To debug you could add an echo $MONGO_URL
somewhere in your script to see if it picks up the right environment variable.
Thanks for the quick response) of course! export MONGO_URL='mongodb://' in place, startup.sh is fresh and in gs://bucket. But where i can insert debug row echo $MONGO_URL, if 'export' rows is last in startup.sh?
Hmm, it looks like more people have problems with pm2 not picking up environment variables in some cases: https://github.com/Unitech/pm2/issues/83
Some people mention that setting the environment variables in a process.json and starting pm2 with that works:
http://pm2.keymetrics.io/docs/usage/application-declaration/
Could you try that?
I try
MONGO_URL='mongodb://root:*****@10.240.0.3:27017' ROOT_URL='http://localhost' pm2 start main.js --name 'my-app'
---------.pm2/logs/dst-orders-error-0.log-----........................................
Note: you are using a pure-JavaScript implementation of bcrypt.
While this implementation will work correctly, it is known to be
approximately three times slower than the native implementation.
In order to use the native implementation instead, run
meteor npm install --save bcrypt
in the root directory of your application
.................................................................................... so, need change startup.sh cd bundle (cd programs/server && npm install) to: cd bundle (cd programs/server && meteor npm install --save bcrypt) ?
something I have no luck with your script ) fresh experiment: prepare process.json with:
env: {
"HOME":"/home/",
"MONGO_URL":"mongodb://root:***@10.240.0.3:27017",
"ROOT_URL":"http://localhost",
"MAIL_URL":"smtp://*****:*****@smtp.googlemail.com:465",
"PORT":"3000"
}
pm2 start process.json:
Error: Cannot find module 'fibers'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Function._load (/usr/lib/node_modules/pm2/node_modules/pmx/lib/transaction.js:62:21)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/opt/bundle/programs/server/boot.js:1:75)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
The bcrypt warning is probably unrelated to this problem.
I think you're on the right track with the process.json.
Usually when it can't find fibers something went wrong with npm install
. Check if that ran correctly and if the node_modules is in the right location.
Local app on local machine work ok,... may be, incorrectly meteor build process? how check it? may be, try build options? please advise me)
Hmm, I just noticed this script still installs Node 0.10: https://github.com/Q42/meteor-gce/blob/master/startup.sh#L17
Meteor now uses Node 4 as far as I know, so try replacing line 17 in the script with this:
curl -sL https://deb.nodesource.com/setup_4.x | bash -
I have done it from the very beginning: my install row is:
curl --fail -ssL -o setup-nodejs https://deb.nodesource.com/setup_4.x &&
bash setup-nodejs &&
apt-get install -y nodejs build-essential nodejs nginx
but i I have heard, that meteor 1.4 need node 4.4.7 apparently, not the case
made by hand:
curl -sL https://deb.nodesource.com/setup_4.x | bash -
apt-get install nodejs
pm2 kill
pm2 start process.json
Didn't work (
Error: Cannot find module 'fibers'
how to defeat this "fibers" ?
after added to startup.sh row
npm install fibers source-map-support underscore semver
now app launched with hand typing
pm2 start ..
only,
not automatically )
Glad you (almost) got it working. I haven't used this script anymore in a long time, so for maybe a better up to date version you could also try Meteor Up: https://github.com/kadirahq/meteor-up
I liked your docker free method, it more improvable)
meteor app and mongodb on different GCE VMs in same project:
startup.sh: ................
export MONGO_URL='mongodb://root:****@10.110.0.2:27017'
(CHECKED: from mongo-client connecting OK) ........................................pm2/logs/my_app-error-0.log: