Run sails.js on a specific IP address during development - javascript

I am new to sails.js and trying to develop a simple app on a remote sandbox server. When I do 'sails lift' to test running the app, I cannot access it by 'localhost'.
I am wondering what's the right way of running sails on a specific IP during development. I tried 'sails lift --ip xxx.xxx.xx.xx', but it does not work, and the documentation on this seems lacking.
Does anyone know how to run sails.js on an IP without needing deployment?

You need to use local.js in config directoty to add this config:
{
host: your_ip,
port: your_port
}
Or add port and host in config/env/development.js

For anyone looking for Sails 1.x, as host is deprecated in new version, so new name for specifying host is, "explicitHost".
So one can mention in config/env/development.js
explicitHost: 'your_ip_Address'
port: 'your_port_number'
For more, sails documentation for these kind of settings

Related

How can I use an SSL certificate with my Next JS deployment?

I have a Next.js deployment on an EC2 instance. I want to install an SSL certificate. The only way I can think of is to use a custom server config, but this seems to remove certain optimizations that I'd rather keep. Keep in mind I am starting the server using 'next start'.
The solutions I found online only apply to local deployments and they also involve using a custom server config.
Thanks
an option is to use nginx and host configs
https://medium.com/today-i-solved/how-to-deploy-next-js-on-aws-ec2-with-ssl-https-7980ec6fe8d3

Is it possible to expose nodes localhost to my host?

I am currently working on an Ionic based project. due to the fact I don't want to install node.js locally I tried DDEV, even it is supposed to be a PHP development environment.
However, when serving my application via ionic serve -l the frontend of my app is built and should be accessible (within the container) on http://localhost:8200. Well, I have to expose this port to my host I guess.
To do so I already tried a few configurations, but nothing worked out. For example:
I configured the nginx-site-conf for listening on port 8200. A weak try, I know but I had to try.
Furthermore I created a docker-compose.override.yaml and added the port 8200 to be exposed to my host. Didn't work out well.
Has anyone an idea or is DDEV just not the right tool for that job?
You'll want to do a docker-compose.extraport.yaml (name of the file is arbitrary) that exposes that port to the host.
I tried this .ddev/docker-compose.extraport.yaml and it worked fine. I just tested it with nc -l -p 8200 inside the container, and telnet localhost 8200 on the host.
version: '3.6'
services:
web:
ports:
- published: 8200
target: 8200
Details about adding extra docker-compose files are at https://ddev.readthedocs.io/en/latest/users/extend/additional-services/ and https://ddev.readthedocs.io/en/latest/users/extend/custom-compose-files/ - those are mostly aimed at people creating a completely new service, but it all works the same for overriding as here.

access sails app from any client

I have a really strange problem. I have a sails app running on my local machine and want to access this application from another computer within the same network, but I get a timeout.
not that I think that it should be necessary, but I even configured cors in config/cors.js:
allRoutes: true,
origin: '*',
credentials: true,
methods: 'GET, POST, PUT, DELETE, OPTIONS, HEAD',
headers: 'content-type'
My project is pretty empty, I just created a few models/controllers and thats it.
I didn't find anything about this problem in their manual so I guess I must have done something wrong during my project setup. Has anyone an idea on how to fix this?
edit
just to make sure I didn't do something completely wront I just created a new project
sails new foo
cd foo
sails lift
-> http://192.168.1.12:1337
works from localhost, gets a timeout from any other host in the network
I'm actually taking for granted that you already tried to ping your host machine from the other machine and you successfully managed to get a response.
If so, I suggest ngrok package to gain access for other users to your local machine. Ngrok exposes your localhost to the web, and has an NPM wrapper that is simple to install and start:
$ npm install ngrok -g
$ ngrok http 1337
The last command will print in the console the new address that points to localhost:1337
Edit: By the way, I'm pretty sure your problem is about network configurations and not sails configurations.

Deploying Sails.js On Openshift

When I deploy a Sails.js app to OpenShift it restarts over and over again.
So basically I am having the exact same problem with the same output from rhc tail described in this question and this answer describes why this error is occurring but there are no solutions offered
Has anyone successfully deployed a Sails.js app to OpenShift?
I am committed to the OpenShift platform at this point but really want to use SailsJS for my next app.
Thanks for any suggestions.
In order to start Sails on OpenShift, you need to set the port and host config keys in your /config/local.js to:
port: process.env.OPENSHIFT_NODEJS_PORT || 8080,
host: process.env.OPENSHIFT_NODEJS_IP
The question / answer you referred to is valid; the supervisor instance on OpenShift does seem to have a problem with Grunt. The quick solution is to start your app once to get the .tmp directory built, then stop it and move your Gruntfile.js elsewhere. Then you can start your app with ctl_app start and it should do fine. You might also killall node before you start the app, just to make sure previous attempts aren't still going.

Deploying meteor app to domain and aliases

Is it possible to deploy the same meteor app to a domain and its aliases? For example, myapp.com and www.myapp.com
Right now if I deploy to myapp.com, www.myapp.com will say
There is no site deployed at this address.
So I'm wondering if meteor deploy can accept multiple domains (myapp.com, www.myapp.com, etc). Or if there's any alternative method.
Two good solutions:
Use domain forwarding if your DNS host allows.
Or
Create and deploy a simple meteor project to redirect from one domain to another (e.g. www.myapp.com to myapp.com). You can do a simple browser redirect (window.location). Or, you can use the meteorite Router package to do a server redirect.
Yes, you can do it using your DNS host's domain forwarding. See Meteor.js deploy to "example.com" or "www.example.com"?
You're welcome '-)

Categories