Use Storybook server on AWS C9? - amazon-web-services

I'm trying to run a storybook server on AWS Cloud9 but the URL it gives doesn't load anything.
I'm starting the server with
start-storybook -h $HOST -p $PORT --ci
This runs through without error and gives me a "server started" message with a URL. But that URL doesn't connect to anything.
I do notice that the URL isn't secure, and I can imagine AWS having issue with that. There is an --https option on the start-storybook command, but it requires SSL information that I don't know how to source.
Anyone know how this I can get this working?

C9 only opens port 8080, 8081, 8082. So your server should be listening on one of three. Try:
start-storybook -p 8080 s public

Related

Attempting to ssh tunnel to another server within the vpc to a specific port to access my api

This is an odd scenario. Essentially, within a vpc, I am attempting to create an ssh tunnel from server A to server B in which server B hosts the api at port 9000, and server A wants to be able to reverse proxy to port say 5000 which should pass the query to server B's port 9000, and return data. I have been tearing my hair out. I currently have gotten this far:
ssh 3000:localhost3000 -vvv -N -i rsa.pem serverB#serverBIP
after which I have attempted to access the port 22 on server A using a curl request but I got a response -- curl: (1) Received HTTP/0.9 when not allowed
I also tried specifying a port
ssh -vvv -N -i rsa.pem serverB#serverBIP -p3000
which quits on me entirely with the response: ssh: connect to host serverBIp port 3000: No route to host
Finally, I tried
ssh -vvv -N -i workstation_pem.pem 3000:localhost:3000 serverBUser#serverBID
which results in Could not resolve hostname 3000:localhost:3000: Name or service not known
Please advise, I am not sure what I am doing wrong. I feel like this should be simple, but I am struggling to get it to work - a simple tunnel from one instance to another at a port to port on server B where serverB has a gunicorn server running
You would need to login to ServerA and then run this command:
ssh -i key.pem -N -L 5000:serverBIP:9000 serverBUser#serverBIP
This tells the computer on which it is run (which is ServerA) to listen on port 5000 and send any incoming requests to port 9000 on ServerB.
Detailed explanation: explainshell.com - ssh -i key.pem -N -L 5000:serverBIP:9000 serverBUser#serverBIP
See also: SSH/OpenSSH/PortForwarding - Community Help Wiki

Connecting to Tensorboard Logs on a Remote Server: The Connection was Reset

When trying to connect to tensorboard logs on a remote server and entering the address http://localhost:16006/ in chrome and firefox I get this message in the command line "channel 3: open failed: connect failed: Connection refused" multiple times and this message on the browser, "The Connection was Reset".
I ssh into the server like this: ssh -L 16006:127.0.0.1:6006 username#machine and then go one level up the log folder and write: tensorboard --logdir logs --port 16006
I tired:
tensorboard --logdir logs --port 16006 --bind-all
and also
tensorboard --logdir logs --host localhost, also
tensorboard --logdir logs --host 127.0.0.1
None of the above has wroked. I tried running the line above from another environment which didn't help. I went to the office and tried connecting to the logs from the server machine directly and it worked.
It used to work before when accessing remotely. Do you know what the problem is? any hint would be immensely appreciated.
I am having the same problem, but I think you should designate --port 6006 since it looks like you are forwarding remote port 6006 to the local port 16006.
Even so, since 6006 is the default port, the other commands should have worked, but you would have to go to http://127.0.0.1:16006 on your local machine, rather than the link it provides.
Some more in depth explanations can be found here how to run tensorboard on a remote server and how to see tensorboard over ssh
Even following this advice though I am still getting a 'channel 3: open failed: connect failed: Connection failed' error

Running code server on gcp cloud shell gives error when previewing

I'm trying to run code-server on gcp cloud shell. I downloaded the following version
https://github.com/cdr/code-server/releases/download/v3.9.2/code-server-3.9.2-linux-amd64.tar.gz, which I think is the correct one, extracted the contents and ran
code-server --auth none
This gave the following output
[2021-04-06T00:53:21.728Z] info code-server 3.9.2 109d2ce3247869eaeab67aa7e5423503ec9eb859
[2021-04-06T00:53:21.730Z] info Using user-data-dir ~/.local/share/code-server
[2021-04-06T00:53:21.751Z] info Using config file ~/.config/code-server/config.yaml
[2021-04-06T00:53:21.751Z] info HTTP server listening on http://127.0.0.1:8080
[2021-04-06T00:53:21.751Z] info - Authentication is disabled
[2021-04-06T00:53:21.751Z] info - Not serving HTTPS
Now when I try Web Preview -> preview on port 8080 nothing happens I just get a blank screen and on the code console I see the following error
2021-04-06T00:50:04.470Z] error vscode Handshake timed out {"token":"e9b80ff7-10f9-4089-8497-b98688129452"}
I'm not sure what I need to do here ?
In cloud shell editor, create a file with .sh extension, and install the code-server by using these steps:
export VERSION=`curl -s https://api.github.com/repos/cdr/code-server/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")'`
wget https://github.com/cdr/code-server/releases/download/v3.10.2/code-server-3.10.2-linux-amd64.tar.gz
tar -xvzf code-server-3.10.2-linux-amd64.tar.gz
cd code-server-3.10.2-linux-amd64
To run the vscode.sh file using terminal:
./vscode.sh
If a warning “permission denied” comes, type chmod +x vscode.sh and then again proceed with
running the file.
To navigate to the folder:
cd code-server-3.10.2-linux-amd64/
To navigate to the bin:
cd bin/
To start the server :
./code-server --auth none --port 8080
Now you can see the VSCode IDE in your browser either by using web preview->preview on port 8080 option or the HTTP server link in your terminal.
My gut is saying that one must study this article (Expose code-server) in great detail. I think you will find that Code server is listening on IP address 127.0.0.1 at port 8080. Your thinking then is to access this server using Web Preview on port 8080 .... however ... pay attention to the IP addresses of your virtual machine. The IP address 127.0.0.1 is known as the loopback address. It is ONLY accessible to applications running on the SAME machine. My belief is that when you run Web Preview, you are trying to access the IP address of your Cloud Shell machine which is NOT 127.0.0.1.
If you read the above article, the story goes on to show how to use SSH forwarding to provide a front-end to whatever this application may be.

Deploy Django Application on Cloud, but even cannot get access to ip_address:8000

I am a beginner on Django. And try to deploy a testproject on cloud server to check if it works or not.
Server: Ubuntu 16.04
And after I create virtualenv on the server with nginx installed.
I execute below:
python manage.py runserver 0.0.0.0:8000
And then I go to the browser to access my server's http://ip-address:8000.
But it failed to show anything of my application.
I already added the ip-address to ALLOWED_HOST. But still not working.
Are there any thoughts for this situation?
maybe this method work for you because it worked for mine on the ec2 instance on Amazon web server.
step1: go to your dashboard find launch-wizard menu and open it.
step2: Now click on inbound after that click on edit. Here click on Add rule and select Custom TCP rule & enter 8000 in port range. Now again click on Add rule and select HTTP and similarly do for HTTPS then click on save button.
step3: save and restart your AWS machine. Hopefully, your Django app runs on 8000 port.
For a Linux instance in the security group, follow these steps to verify the security group rule:
Connect to a Linux instance by using a password.
Run the following command to check whether TCP 80 is being listened. netstat -an | grep 80
If the following result returns, web service for TCP port 80 is enabled.
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
If not then there is a problem with your security group setup, please go through the official documentation and see how you can fix it:
https://www.alibabacloud.com/help/doc-detail/25471.htm

cf create-service-broker fails with connection refused

I'm experimenting with CF in my local bosh-lite setup.
The apps that I deploy into if work well. I am now trying to follow the steps here
https://github.com/cf-platform-eng/cf-community-workshop/blob/master/demos/service-broker-lab.adoc
to try out the custom service broker setup.
The https://github.com/mstine/haash-broker application starts and is running fine:
$ cf apps
name requested state instances memory disk urls
haash-broker started 1/1 768M 1G haash-broker.vbox.mojito, haash-broker.192.168.50.6.xip.io
I can access it from my host machine browser well:
http://haash-broker.192.168.50.6.xip.io/v2/catalog
But when I execute the
cf create-service-broker haash-broker warreng natedogg http://haash-broker.192.168.50.6.xip.io
I get
$ cf create-service-broker haash-broker warreng natedogg http://haash-broker.192.168.50.6.xip.io
Creating service broker haash-broker as admin...
FAILED
Server error, status code: 502, error code: 10001, message: The service broker could not be reached: http://haash-broker.192.168.50.6.xip.io/v2/catalog
When I log in into the CC VM:
$ bosh -e vbox -f cf ssh api/eb4cec99-bab1-4513-a980-fb92775ac2d8
I can ping the hostname:
api/eb4cec99-bab1-4513-a980-fb92775ac2d8:~$ sudo ping haash-broker.192.168.50.6.xip.io
PING haash-broker.192.168.50.6.xip.io (192.168.50.6) 56(84) bytes of data.
64 bytes from 192.168.50.6: icmp_seq=1 ttl=64 time=0.080 ms
But wget connection gets refused:
api/eb4cec99-bab1-4513-a980-fb92775ac2d8:~$ wget http://warreng:natedogg#haash-broker.192.168.50.6.xip.io/v2/catalog
--2018-04-06 04:19:05-- http://warreng:*password*#haash-broker.192.168.50.6.xip.io/v2/catalog
Resolving haash-broker.192.168.50.6.xip.io (haash-broker.192.168.50.6.xip.io)... 192.168.50.6
Connecting to haash-broker.192.168.50.6.xip.io (haash-broker.192.168.50.6.xip.io)|192.168.50.6|:80... failed: Connection refused.
The firewall permits everything on that VM (sudo iptables -L).
The hostname gets resolved properly. The ping works and the 80 port is open on the target IP, since I can reach it from my host browser.
How can that be that the wget doesn't work in such situation?
This also seems to be the reason for me failing to create a service broker cf create-service-broker
UPDATE
I've managed to to execute the cf create-service-broker command with URL of an nginx reverse proxy running outside of my bosh-lite environment. The proxy redirects to the same initial URL http://haash-broker.192.168.50.6.xip.io
and the command succeeds in this way.
But the subsequent
cf create-service-broker haash-broker warreng natedogg http://haash-broker.192.168.50.1.xip.io:9999
cf enable-service-access haash
cf create-service HaaSh basic my-hash
(where haash-broker.192.168.50.1.xip.io:9999 is my nginx proxy) fails with
Server error, status code: 502, error code: 10001, message: The service broker rejected the request to http://haash-broker.192.168.50.1.xip.io:9999/v2/service_instances/4ef19154-d238-4cb3-8003-803fba53af3f?accepts_incomplete=true. Status Code: 400 Bad Request, Body: {"timestamp":1523008856993,"error":"Bad Request","status":400,"message":""}
I can see in both nginx and broker app logs that the the request reaches the broker and it answers with 400.
Debugging now why.
Can you post the result of --server-response option used with wget? Also what happens when you try to curl the broker?
Broker requires credentials, but it is interesting if it responds with 401 or 500 on the first request that wget makes without credentials.