How do I host an app created with Polymer? - heroku

I've been Googling this problem for some weeks now and can't find a solution to what seems to be a simple problem. It seems to get pretty convoluted pretty quickly.
I've read through the node.js Heroku getting started and a lot of other tutorials but it seems to be that it won't work with Polymer. I can see my app looks and works fine when I run python -m http.server 8000 from the command line in my directory I can view my app in the localhost and it looks great!
If anyone has any clue as to where I should go from here or can point me to any useful links that would be amazing! Even better if there is some kind of skeleton Polymer website that is freely available.

If you aren't trying to host a node.js or other backend with your polymer app you can use github pages. https://pages.github.com/
Polymer app is essentially only files that the browser needs to retrieve from remote server. You don't need to have backend on the host server. If you were trying to host node.js or other backend you could use heroku to host it.

Related

How do I go about setting up my Sinatra REST API on a server?

I'm an iOS developer primarily. In building my current app, I needed a server that would have a REST API with a couple of GET requests. I spent a little time learning Ruby, and landed on using Sinatra, a simple web framework. I can run my server script, and access it from a browser at localhost:4567, with a request then being localhost:4567/hello, as an example.
Here's where I feel out of my depth. I setup an Ubuntu droplet at DigitalOcean, and felt my way around to setting up all necessary tools via command line, until I could again run my server, now on this droplet.
The problem then is that I couldn't then access my server via droplet.ip.address:4567, and a bit of research lead me to discovering I need Passenger and an Apache HTTP Server to be setup, and not with simple instructions.
I'm way in over my head here, and I don't feel comfortable. There must be a better way for me to take my small group of ruby files and run this on a server, than me doing this. But I have no idea what I'm doing.
Any help or advice would be greatly appreciated.
bit of research lead me to discovering I need Passenger and an Apache HTTP Server to be setup, and not with simple instructions.
Ignore that for now. Take baby steps first. You should be able to run your Sinatra app from the command line on the DigitalOcean droplet, and then access it via droplet.ip.address:4567. If that doesn't work something very fundamental is wrong.
When you start your app, you will see what address and port the app is listening on. Make sure it's 0.0.0.0 and 4567. If it's 127.0.0.1 or localhost that means it will only service requests originating from the same machine
After you get this working, next step is to make your Sinatra app into a service. Essentially this means the app runs in the background, and auto-starts when the system reboots. Look into Supervisor which is very simple configuration to get this running.
Later you can install Apache or Nginx to put in front of your Sinatra app. These are proxies which simply forward requests from port 80 (default HTTP port) to your sinatra app, but can do additional things such as add SSL support, load balancing, custom error pages etc. - all of which you do not need right now.

where to deploy a web2py app that uses websockets?

I asked this question and it seems pythonanywhere doesn't support websockets.
pythonanywhere - How do I use websockets to transmit messages as per the web2py messaging example?
so the question is where could I deploy the app as effortlessly as possible?
right now when I run it locally its as easy as
python web2py.py &
python websocket_messaging.py -p 8888 -k mykey
It's not going to be as easy as pythonanywhere, but you could deploy to any VPS, such as Digital Ocean. To make things easier, use one of the web2py deployment scripts, such as https://github.com/web2py/web2py/blob/master/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh. Once you have the basic server set up, you'll still need to install Tornado and follow the other instructions for using websocket_messaging.py.

Set up a simple go server in a webhost

I wanted to set up a simple go server in a webhost. I acquired a domain mydomain.com and hosted it using Bluehost. Now, going through the Go tutorial, I went through this example http://tour.golang.org/#59 and it works fine on my machine. Now, instead, I want to make the HelloWorldServer work when I call mydomain.com:4000 or some other port.
What I did was ssh to my server at bluehost, install go there, then compile the server and run. But then I try to access mydomain.com:4000 and it is not found. I also tried to change "localhost:4000" to just ":4000". any ideas how to make it work ?
Any help or pointers are appreciated. (some more details: it is a shared-hosting account)
This is due to the firewall on your BlueHost server not having ports (including 4000) open on a shared hosting account, Firewall Port Restrictions
If you want to do some simple (and not so simple) web hosting, why don't you look at Google App Engine

Not able to access page data, using anemone with socksify gem and Tor

I ve written a ruby script using anemone gem to crawl a website. The script runs fine when used directly.
But I would like to use socksify gem so that all TCP calls from the script is routed with socks5. I did the following for the same:
Installed and started Tor project and it is running in my machine
Installed socksify gem
ran the following command socksify_ruby localhost 9050 myscript.rb as given here
However anemone does not detect any page in this case. Please let me know what mistake I am doing.
There are a number of problems that could be causing this to happen. First, if ntp is not running on your machine, and the time is off by even a little bit, you will not be able do use the socks server to do anything complicated. This happened to me. You need to install ntp and make sure it has synced before doing anything.
Second, you may find that a lot of this commands like socksify are obsolete. The best way I have found to make sure that everything happens through the socks port without dns leakage is by using curl, which has bindings for many languages. You can carefully watch the traffic with tcpdump to make sure it isn't leaking, and it is watertight in my experience.
I'd also suggest that you look at torsocks, which has recently been updated by dgoulet on github. This replaces tsocks, which the outdated socksify_ruby is based on.
Finally, hidden services have been under great strain lately, because a bot has decided to start up a few million Tor clients. Make sure you can connect with the Tor Browser Bundle, assuming the project you are working on is trying to crawl hidden service.
You didn't actually say that this project involves Tor or hidden services, but you did tag it with Tor.

allow others to see your Sinatra local server through amazon instance

It's really difficult to explain. But basically, I have an amazon instance, and I want to ssh into it and run a local server on it with sinatra. so I would ssh into the amazon instance, git clone my repo, and run ruby config.ru. Then I want someone else to be able to see that exact local server that is being ran. One of the things I've done is added a security group, port 4567 HTTP so that I can access it via public dns. It works on a rack app but it doesn't work on the sinatra, I've even tried a 'hello world' sample app to try to get it working.
I'm not sure if there is a specific reason that you want to do this from an Amazon server or not, but if you just want someone else to see your sinatra app, you could simply use localtunnel.
Using this, you can simply run localhost on your OWN computer, then run localtunnel PORTNUMBER and it will give you a URL that your app will now be visible from. You can then give that URL to anyone you want.
Example of use:
$ ruby myapp.rb
$ localtunnel 4567
A URL will then be displayed for you to copy-paste to a friend. Easy as that.
I use this a lot when developing web apps to be mobile friendly and want to quickly look at the app on my phone without having to deploy to a server.

Resources