I'm new to using web servers, and I'm trying to learn the Bolero (F#) web framework. As a learning exercise, I'm trying to put the example app "into production", i.e. serve it to the internet and not just localhost.
I would like to use a basic (linux) web server to serve the website (specifically DigitalOcean)..i.e. not a specialized dotnet/microsoft/azure etc platform.
I don't believe that launching an app is covered in the documentation on the Bolero website (aside from a development setup using localhost).
I created the app with:
dotnet new bolero-app -o HelloWorld
Then after some web-searching I did:
cd HelloWorld
dotnet publish -c Release
Then if I do:
cd ./src/HelloWorld.Server/bin/Release/net6.0/publish
./HelloWorld.Server
I get the message:
Now listening on: http://localhost:5000
Now listening on: https://localhost:5001
Application started. Press Ctrl+C to shut down.
I'm not sure if those steps are the way I should be going about this...I would like to be serving on port 80, but I've not been able to change that or find where this is set in the example project. I grepped the project for "5000" but couldn't find where that setting is. I tried setting an environment variable with: "sudo export ASPNETCORE_URLS=http://localhost:80/". That hasn't changed where the app tries to serve the site. (Presumably I should be trying to write the server's ip address there instead of localhost?)
Any help is appreciated! Thanks!
EDIT: I've been able to serve the app to the internet!
From the main app directory (HelloWorld) I did:
cd /src/HelloWorld.Server
sudo dotnet run --urls "http://xxx.xxx.xxx.xxx:80/
...where the x's were replaced with my server's IP address.
)
Related
Hello everybody) I started learning dokku. Going through the tutorial from the documentation for the Heroku Ruby on Rails "Getting Started" app I can't go to url generated by dokku in the browser. I am only using my local machine while learning and doing git push to localhost. This command works without errors, the container works, I get the url to the site, but I cannot open it in the browser. The same problem appears with another project, when I try to deploy a python django project, this is just a project skeleton created by django, without my code. It must show a welcome page and I want to see it when the site is running on dokku but I cannot go to the url. I tried to use dokku domains and dokku proxy but couldn't solve the problem. Please help me figure out how to fix this. I'm new to dokku, docker, nginx and deployment so the problem can be trivial. I'm also want to know on which ip, port dokku runs the sites and on which ip do I need to run the wsgi server inside the container?
Trying to use clearml-server on own Ubuntu 18.04.5 with SSH Port Forwarding and not beeing able to see my debug samples.
My setup:
ClearML server on hostA
SSH Tunnel connections to access Web App from working machine via localhost:18080
Web App: ssh -N -L 18081:127.0.0.1:8081 user#hostA
Fileserver: ssh -N -L 18081:127.0.0.1:8081 user#hostA
In Web App under Task->Results->Debug Samples the Images are still refrenced by localhost:8081
Where can I set the fileserver URL to be localhost:18081 in Web App?
I tried ~/clearml.conf, but this did not work ( I think it is for my python script ).
Disclaimer: I'm a member of the ClearML team (formerly Trains)
In ClearML, debug images' URL is registered once they are uploaded to the fileserver. The WebApp doesn't actually decide on the URL for each debug image, but rather obtains it for each debug image from the server. This allows you to potentially upload debug images to a variety of storage targets, ClearML File Server simply being the most convenient, built-in option.
So, the WebApp will always look for localhost:8008 for debug images that have already been uploaded to the fileserver and contain localhost:8080 in their URL.
A possible solution is to simply add another tunnel in the form of ssh -N -L 8081:127.0.0.1:8081 user#hostA.
For future experiments, you can choose to keep using 8081 (and keep using this new tunnel), or to change the default fileserver URL in clearml.conf to point to port localhost:18081, assuming you're running your experiments from the same machine where the tunnel to 18081 exists.
Recently I migrated my workspace from the old Cloud9 to AWS Cloud9. Now I can no longer run my application. I'm hoping somebody on Stack Overflow might have an idea what the problem is because AWS' help forums and documentations skip past the parts I'm missing.
The "Run" button tries run the last file that I was viewing and editing, rather than my application as a whole.
So I try to start it running in the terminal with "rails s -b $IP -p $PORT". I get this line:
Listening on tcp://127.0.0.1:8080
So the program should be running, right? But the green "Run" button is now disabled, and I don't get the spinning icon in my terminal window that I used to get with old Cloud9.
Next I try getting the application's url from the "Share" menu, which is:
18.212.63.5
When I try to navigate to this url in another window, I get an error
ERR_CONNECTION_TIMED_OUT
When I try to "Preview Running Application" with the IDE, I get the error
66af0558a4b44f8bb019cb5628f6b28f.vfs.cloud9.us-east-1.amazonaws.com refused to connect.
In related news, I'm highly frustrated with AWS for a lot of other reasons. Should I consider switching to a different IDE? Or keep trying to learn this one?
Thank you in advance for any insight.
See also https://forums.aws.amazon.com/thread.jspa?messageID=899522, which provides a set of diagnostic commands that you can run from a terminal session in the AWS Cloud9 IDE for your development environment that can output the incoming traffic rules for the environment's associated Amazon EC2 instance's security group and network ACL. These traffic rules need to allow incoming traffic for the correct protocol and port.
I had what I believe was a similar problem. The preview won't show if the app is being served over http, rather than https:
https://docs.aws.amazon.com/cloud9/latest/user-guide/troubleshooting.html#troubleshooting-app-preview-http
A simple workaround here is just to remove the 's' from the amazonaws.com URL listed in the 'refused to connect' error, and then press the button to preview the application in a browser tab.
Also note that on AWS C9 you shouldn't need
rails s -b $IP -p $PORT
It should usually be enough to do
rails server
(though check that, for example, your puma.rb file is set to run on port 8080 rather than 3000)
I made an environment on Cloud9 on AWS, then made a folder named "ruby_projects", then inside that folder, I ran the command:
rails new todolist
then from inside the todolist folder, I ran
rails s
In the share button on the top right corner of the environment, I opened the application link which is 35.162.65.187, but instead of saying "you are on rails" it says:
Oops
Error: 1 validation error detected: Value '35.162.65.187' at 'envir..
For changing port on AWS you can do something like this:
sudo iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 3000
For local machine:
rails server -p 80
But, Phlip absolutely right - you should learn rails on local machine with development environment. Step by step.
You have two ways to preview applications on AWS Cloud9--through the preview URL (from clicking the Preview button) and from the public IP for the host (AKA the sharing URL). The Preview URL is a bit easier to run, but has a few limitations. Specifically:
You need to serve your content on 127.0.0.1:8080 (ports 8081 and 8082 work as well but have to be specified)
You can only access the URL when you are currently logged into the IDE and have the IDE open.
Only IAM users with access to the IDE can access the Preview URL. For instance, this won't work if you are calling this endpoint from another program.
You can read more about the Preview URL here: https://docs.aws.amazon.com/cloud9/latest/user-guide/app-preview.html#app-preview-preview-app
If you need to share this to people who don't have access to the IDE or you need to access the endpoint through a different program, you'll want to use the Sharing URL. This requires a bit of additional configuration, specifically, you'll have to:
Create a security group for the host that opens your selected ports to the main internet
Run the server through 0.0.0.0 instead of 127.0.0.1
You can see how to do this here: https://docs.aws.amazon.com/cloud9/latest/user-guide/app-preview.html#app-preview-share
I'm interested in learning some python, and thought Pylons would be a good starting point (after spending 2 days trying to get django working -- to no avail).
I have an Amazon EC2 instance with Fedora 8 on it. It is a bare-bones install. I am halfway through my second day of trying to get it to work. I have mod_wsgi installed. I have Apache (though that's a later task to tackle). I have easy_install, paster is working fine; basically all of the pre-requisites mentioned throughout the Pylons docs.
I can't for the life of me get the thing to work. And I can't seem to find a coherent walkthough anywhere that lists all the steps necessary. There is tons of info out there, but it is all scattered. Wsgi this, python that. Google, google, google... "47 million results found for 'socket.error:(lol, 'Yous a goofs')".
So, this is my latest attempt:
apachectl -k stop
cd /home/
paster create -t pylons test
[blah blah.. ok]
cd test
nano development.ini
[hmm, last time I changed the host from 127.0.0.1 to my domain name or url, it threw an error like socket.error: (99, 'Cannot assign requested address')... I'll just leave it]
[open port 5000 on firewall]
paster serve development.ini
[firefox->url:5000]
Firefox can't establish a connection to the server
Doing these steps locally works as expected.
This is just a test to see if I can get it to work at all, which I can't. If I get it to work, then is the task of getting it to work with apache.
My madness is that I'd like to play around a little developing and deploying before diving into a full-fledged project. So far: self, I am dissapoint.
[server:main]
use = egg:Paste#http
host = 0.0.0.0
port = 5000
If you leave it as 127.0.0.1, you'll only be able to surf the site from the ECS instance. By putting in the IP of your ECS instance, or 0.0.0.0 which will listen to all available IPs, it should work.
Unless you have something else listening on port 5000, it should work.
If you are using the hostname, and the hostname resolves to an IP address on your machine it should work. If you use a URL, paster won't be able to resolve the domain name properly. I'm guessing that when you used the domain name, it didn't properly resolve it which generated the error you received. 0.0.0.0 or the IP address in that case should fix it.
I'm not 100% sure whether you used a virtualenv for your pylons installation, but, it is generally a good idea since you don't need to alter the server's environment to install new libraries.
http://pylonshq.com/docs/en/1.0/gettingstarted/#installing