I'm trying to deploy a sails.js app (sails.js version 0.11) to Openshift.
I'm aware of the previous questions and answers in here for example;
https://gist.github.com/mdunisch/4a56bdf972c2f708ccc6
I followed the steps from that post.
I also created my app via git://github.com/ryanj/nodejs-custom-version-openshift.git so I have minimum npm version required by sailsjs. Still the application doesn't start. Has anybody attempted deploy sails v0.11 app on openshift before?
Thank you
I see below in the logs
DEBUG: Running node-supervisor with
DEBUG: program 'server.js'
DEBUG: --watch '/var/lib/openshift/55a4256b5973cadc8400000d/app-root/data/.nodewatch'
DEBUG: --ignore 'undefined'
DEBUG: --extensions 'node|js|coffee'
DEBUG: --exec 'node'
DEBUG: Starting child process with 'node server.js'
DEBUG: Watching directory '/var/lib/openshift/55a4256b5973cadc8400000d/app-root/data/.nodewatch' for changes.
Listening on 127.2.103.1, port 8080
DEBUG: Sending SIGTERM to child...
My solution as explained here works.
https://github.com/aug70/openshift-sails-starter
If you follow the instructions to setup a OpenShift cartridge and merge with this repo, you can deploy it on OpenShift.
Couple important points;
OpenShift package.json file is different!
You would want to use forever when running application and your start script should be something like
"start": "./node_modules/forever/bin/forever -l ~/app-root/logs/forever.log --append --pidFile ~/app-root/logs/forever.pid start app.js --prod"
If you happen to use mongodb, your connections.js file mongodb entry would be
"url : process.env.OPENSHIFT_MONGODB_DB_URL + process.env.OPENSHIFT_GEAR_NAME "
Solution is based on Sails.js version 0.11.0
Related
I have developed node rest api and vuejs web applications,
Im trying to deploy both project in to one aws server which run ubuntu.
Both applications have different port,
domain I try to configure api.example.com for api and example.com for vue app.
I can run both applications once after running the command in SSH, but I need them to run it forever.
What I did,
Deploy to apps separately
Apps can access with ports
I need them access
api.example.com
example.com
what are the step to do,
Any changes host file.
I found another way to deploy vue app and express/nodejs in one server without using PM. This what I did
Build your vue code using npm run build command. This will create a folder dist which should have index.html file and static folder.
Copy dist folder into your server code repository. In my case I created a folder public and moved the dist folder inside public.
In app.js file right before module.exports=app line, copy the following lines of code
//These 2 lines make sure that vue and express app are coming from the same server.
app.use('/static', express.static(path.join(__dirname,"../public/dist/static/")));
app.get('/', function(req,res) {
res.sendFile('index.html', { root: path.join(__dirname, '../public/dist/') });
});
First line make sure that the /static folder is accessible and second line will serve the index.html file when you run the node server. Routing between components will be taken care by vue.
This is how we are running our VueJS UI and ExpressJS REST API from the same server.
We are managing our services with PM2.
VueJS (Dev Environment, You can add the same settings to production)
In package.json add "start": "HOST='0.0.0.0' PORT=80 npm run dev",, where 80 is the port VueJS is listening on, to the "scripts": {..} array. Then, after installing PM2, (for dev) we can start VueJS with cd /location/of/vue/root; sudo pm2 start npm run dev --name Vue -- start. (Make sure that Apache is not running).
Please note that setting the HOST to 0.0.0.0 is important. Do not set it to LocalHost or your Servers IP address or you may run into issues.
ExpressJS
In the /location/of/express/app.js add this similar to the bottom of the file:
app.listen(process.env.PORT || 8081), where 8081 is the port your REST API should be listening on. I can then start it with sudo pm2 start /location/of/express/app.js --name Express
At this point, the VueJS should be available at www.example.com (implied Port 80) and the REST API would be available at www.example.com:8081.
If you want to have api.example.com/ point to the API, you need to make sure that your DNS is pointing the "api" subdomain to the desired port, or you may have to add the port into the URL as above.
Additionally, you can easily follow the logs through PM2 as well with pm2 logs APPNAME --lines 100.
I'm running through the angular-cli tutorial, and the NG Live Development server doesn't seem to launch (No response on http://localhost:8080) with no errors in console. This is a blank project with no code created using:
ng new test-app
cd test-app
ng serve
I've tried ng serve --host 0.0.0.0 ng serve --host 0.0.0.0 --port 4201 with multiple ports. I've made sure there is nothing listening on those ports.
Environment: Windows 10 (1709)
#angular/cli: 1.6.7
#angular-devkit/build-optimizer: 0.0.42
#angular-devkit/core: 0.0.29
#angular-devkit/schematics: 0.0.52
#ngtools/json-schema: 1.1.0
#ngtools/webpack: 1.9.7
#schematics/angular: 0.1.17
typescript: 2.5.3
webpack: 3.10.0
Is there a log that could provide more information? I haven't been able to find anyone having trouble on this basic step. Cheers.
if you are using docker in your machine try deleting all the files in docker desktop,it worked for me
I need to build a meteor application under windows. How to do it right?
I found the meteor-electron package. If I understand correctly, it creates an executable file (exe).
I perform the following commands:
meteor create meteor-electron-build-test
cd meteor-electron-build-test
meteor add meson: electron
meteor
At this stage, everything is fine, the application of the electron inside the meteor is launched.
But if I stop the electron in the console and go to .meteor-electron \ win32-ia32 \ builds \ Electron-win32-ia32 \ Electron.exe - this application is empty.
I tried to add settings.
{
"electron": {
"name": "MyApp",
"version": "0.1.0",
"description": "A really cool app.",
"rootUrl": "https://myapp.com",
"launchPath": "/ app / landing",
"sign": "Developer ID Application: ...",
"height": 768,
"width": 1024,
"frame": true,
"title-bar-style": "hidden",
"resizable": true,
"protocols": [{
"name": "MyApp",
"schemes": ["myapp"]
}]
}
}
And launched the team meteor --settings settings.json. The result is the same.
https://github.com/StekolschikovV/meteor-electron-build-test
If I add the "appSrcDir" parameter: "./" - starts an endless loop that all copies to the .meteor-electron folder.
How to correctly build an executable file meteor electron using windows?
meteor-electron doesn't deliver a meteor server process, only a thin web client. Therefore, your rootUrl setting must point to a valid web address hosting your app. This can be http://localhost:3000 for the purposes of testing.
Try Electrify. I just tested it on the latest Meteor 1.7 and it works. Bundles node and MongoDB. Runs meteor client and server.
npm install -g electrify
https://github.com/arboleya/electrify
I would like to debug my sails.js application but I don't know how to launch node-inspector for this occasion.
Normally it would go :
$ node --debug myapp.js
If I run my sails application normally :
$ sails lift --prod
and then launch node-inspector
$ node-inspector --debug-port 1337
Node Inspector v0.7.0-2
info - socket.io started
Visit http://127.0.0.1:8080/debug?port=1337 to start debugging.
I get this error in inspector GUI :
Error: read ECONNRESET. Check there is no other debugger client attached to port 1337.
As of Sails 0.9.8 you can use sailsd to call sails in debug mode, e.g. sailsd lift.
-- Edit --
Looks like this didn't actually make it into 0.9.8, my bad. To make your own debugging command for now, save the following into /usr/local/bin as sailsd (or whatever you like):
#!/bin/sh
node --debug `which sails` $#
-- Edit 2 --
In Sails v0.10.x, you can do sails debug instead of sails lift to start Sails in debug mode!
Correct me if im wrong but, you cant use debug port 1337 if sails lifts on port 1337.
try specifying a different port.
node --debug app.js
#this will lift sails on port 1337 and the default debug port i think its 5858
#start node-inspector, once it starts hit enter to put it into background
node-inspector &;
#visit http://127.0.0.1:8080/debug?port=5858
edit just confirmed this method works, instead of using sails lift you're using node to start app.js in debug mode. the node-inspector web runs on port 8080 and the debugger links on port 5858 by default.
I have a digital ocean droplet that I am trying to deploy the most basic of meteor apps to, but I am getting a failing response. Any idea why this is happening?
UPDATE: added entire output
Anderss-iMac:microscope-deploy anderskitson$ mup deploy
Meteor-UP : Production Quality Meteor Deployments
--------------------------------------------------
Bundling Started: /Users/anderskitson/sites/microscope
Started TaskList: Deploying App
[bray.anderskitson.ca] uploading bundle
[bray.anderskitson.ca] uploading bundle: SUCCESS
[bray.anderskitson.ca] setting up env vars
[bray.anderskitson.ca] setting up env vars: SUCCESS
[bray.anderskitson.ca] invoking deployment process
[bray.anderskitson.ca] invoking deployment process: FAILED
-----------------------------------STDERR-----------------------------------
Warning: Permanently added 'bray.anderskitson.ca,162.243.52.235' (RSA) to the list of known hosts.
npm WARN package.json http-proxy#1.0.0 No repository field.
npm http GET https://registry.npmjs.org/fibers
npm http 304 https://registry.npmjs.org/fibers
stop: Unknown instance:
bash: line 46: wait-for-mongo: command not found
-----------------------------------STDOUT-----------------------------------
> fibers#1.0.1 install /opt/meteor/tmp/bundle/programs/server/node_modules/fibers
> node ./build.js
`linux-x64-v8-3.14` exists; testing
Binary is fine; exiting
fibers#1.0.1 node_modules/fibers
meteor start/running, process 10373
wait for mongo(5 minutes) to initiaze
----------------------------------------------------------------------------
Completed TaskList: Deploying App
I ran into same problem and I figured out that this command wasn't fired really well
sudo npm install -g forever userdown wait-for-mongo
and I manually did that so I can see wait-for-mongo a valid command,
see if that helps you too.