Cloud9 bottle Web Server, accessed externally - webserver

I create a Web Server in python using bottle library. Its works fine and run in https://c9.io. I want access this web service externally.
I´m using host=os.environ['IP'] and port=os.environ['PORT'] to capture the port and ip environment variable.
How can I do it?

Another thing you can do is to replace your host as 0.0.0.0 instead of localhost. This will redirect you to your cloud9's localhost. For example, I'm running my app as:
bottle.run(host='0.0.0.0', port=8082)
You can access the server from a new tab after running your server.

Currently I am facing with the same problem and my solution was to start the app like this:
python myapp.py $IP $PORT
And inside the main module used entrypont2 to map those arguments to variable and use it for run bottle:
from bottle import run
from entrypoint2 import entrypoint
#...
#entrypoint
def main(ip, port):
run(server='gevent', host=ip, port=port, debug=True)
Then I can reach it from web browser using url like this:
http://<workspace>.<user>.c9.io/

Related

NodeJs and Google Colab

I need to pass an array/or parameters from NodeJS to a notebook of Colab or Notebook of Jupiter.
How I can do that?
There is possible some solution?
Thank you!
run nodejs as webserver (easiest modules http or expressjs ) and publish your arrays/parameters as json (JSON.encode). If you dont have server, you can use whatsmyip services to find your place ip address, and adjusting your router (modem) to point ports to your computer.
in the collab you can use !wget http://myip:8080/myarrays -O my.json to save or urllib.request.urlretrieve to retrive.
run nodejs in the colab and webserver/socket/file implementations works.

Making nextcloud work on a prefixed path (using docker and caddy)

I'm trying to setup my own instance of nextcloud on my server but I'm running into a problem as I want nextcloud to be available under https://example.com/cloud/.
Next cloud is running in a CoreOS virtual machine called let's say myvm.
So this is the way I setup my CaddyFile:
example.com {
gzip
proxy /cloud myvm:8080 {
transparent
without /cloud
}
}
I have other proxies that work fine for other services or VMs that are written similarily.
With this, and publishing port 8080 in my docker-compose file, I manage to connect to the nextcloud instance. But every time I go to example.com/cloud/ it will redirect me to example.com/apps/files/ instead of example.com/cloud/apps/files/.
If I enter this last url manually, I can access to nextcloud, but also the page doesn't load properly because all the contents cannot be loaded because they are not prompted with the prefix cloud/.
Is there a way to explain nextcloud about this prefix through the configuration of docker-compose file? (It's the only configuration I created, it works with just that and no extra work, I use one similar to the one available here (the apache one).)
Or maybe I can improve the CaddyFile config? (By the way, if I don't use the without option, it will just not work at all and return 404 when I go to the url).

How to use RTCMultiConnection on Ruby/Python/PHP or similar platforms?

RTCMultiConnection seems using socket.io (node.js) based solution.
How to integrate RTCMultiConnection into ruby-on-rails (or PHP/Python/ASP.NET/MVC/etc.)?
You can setup a separate ipAddress/domain for node.js.
Or you can use same domain however run node.js on a separate port e.g. 9001.
Your PHP/Ruby/Python/ASPX pages can internally use/link that node.js/socket.io server.
Use nohup command to keep running server.js in the background.
Now copy/paste any of the RTCMultiConnection demo in your Ruby/PHP pages.
Make sure that socket.io.js is having a valid URL
<script src="https://your-domain.com:9001/socket.io/socket.io.js"></script>
Make sure that socketURL property is having valid socket.io server link/reference
connection.socketURL = 'https://your-domain.com:9001/';
Now you can use any demo on your Ruby/PHP/Python/etc. pages.
PS. Chrome requires HTTPs-privileges for audio/video/screen capturing. So please make sure that your domain is having SSL installed.

How to pass data by host page when using golang as gwt 's backend?

Currently,my configuration is like this:
gwt+nginx+golang
,and nginx works as a proxy that will redirect all requests(on port:80) to golang server(on port:8080).Since I use golang as backend,so I want user to access my website by
www.domain.com
directly without specifing host page like this:
www.domain.com/index.html.
I think it should be easy in production model:just proxy all requests on / to a golang service,question is on development model:without a host page,How to get gwt app run up?
DevMode is no different actually. Deploy a compiled version on your server once, then run DevMode in -noserver mode passing it -startupUrl http://www.domain.com. It should Just Work™.

ASP.Net MVC 2 on nginx/mono 2.8

I am trying to setup ASP.Net MVC 2 application on Linux environment. I've installed Ubuntu 10.10 on VirtualBox, then installed Mono 2.8 from sources. After that I have installed nginx and configure it as recommended here.
Unfortunately, FastCGI shows me standard error 500 page:
No Application Found
Unable to find a matching application for request:
Host localhost:80
Port 80
Request Path /Default.aspx
Physical Path /var/www/mvc/Default.aspx
My application is located in /var/www/mvc directory. I've tried to create some stub Default.aspx file and place it in root dir of my application, but it didn't help, same error occured.
Thanks.
I've been doing some testing with this as well, using all ubuntu10.10 binaries.
From what I can make from it, either nginx fails to pass the hostname of the mono server fails to receive it over the fastcgi protocol. Anyhow, the tutorial line:
fastcgi-mono-server2 /applications=www.domain1.xyz:/:/var/www/www.domain1.xyz/ /socket=tcp:127.0.0.1:9000
doesn't work. Removing the hostname makes the thing work:
fastcgi-mono-server2 /applications=/:/var/www/www.domain1.xyz/ /socket=tcp:127.0.0.1:9000
but this of course blocks the use of multiple virtual mono hosts.
Since you are running ASP.NET MVC 2 application you should use fastcgi-mono-server4.
Adding following line in /etc/nginx/fastcgi_param resolves the issue for me. It also allows to use multiple virtual hosts.
fastcgi_param HTTP_HOST $host;
Does your application work with xsp (xsp4 if you are using .net 4.0)? You'll want to make sure that is working before you try configuring the connection to another web server.
Does nginx know where to find mono? You most likely have a parallel install and it won't be in the default paths.
I use apache, but you may still find some of the instructions on my blog useful:
http://tqcblog.com/2010/04/02/ubuntu-subversion-teamcity-mono-2-6-and-asp-net-mvc/
I had this problem just now, I too had been following the document on the mono site:
I was trying to start the fastcgi-mono-server as it suggested:
sudo fastcgi-mono-server4 /applications=www.domain1.xyz:/:/var/www/www.domain1.xyz/ /socket=tcp:127.0.0.1:9000 &
However when I did it like that I got the same problem as you. I changed it to this:
sudo fastcgi-mono-server4 /applications=/:/var/www/www.domain1.xyz/ /socket=tcp:127.0.0.1:9000 &
And it worked ( I had to type in www.domain1.xyz/Home/Index to see my MVC page, not worked out how to stop it looking for www.domain1.xyz/default.aspx yet XD ).
You need to make sure the domain set in your site config matches the domain passed to the fastcgi server. So for example if your default site (/etc/nginx/sites-enabled/default) has the following config:
server {
...
server_name www.domain1.xyz;
...
}
You would need to pass that domain into the fastcgi server:
sudo fastcgi-mono-server4 /applications=www.domain1.xyz:/:/var/www/www.domain1.xyz/ ...
Then when you access the site it will obviously need to be with that domain you set.