Deploying Shiny App shiny-server issue - r

I am having an issue deploying a shiny app via shiny-server on ubuntu 14 (on chromebook).
I followed all of the setup steps for shiny-server, and the app appeared to deploy OK on my computer.
I run sudo shiny-server in the command prompt and this appears:
[2016-01-10 14:52:36.348] [INFO] shiny-server - Shiny Server v1.4.1.759 (Node.js v0.10.40)
[2016-01-10 14:52:36.351] [INFO] shiny-server - Using pidfile /var/run/shiny-server.pid
[2016-01-10 14:52:36.352] [INFO] shiny-server - Using config file "/etc/shiny-server/shiny-server.conf"
[2016-01-10 14:52:36.410] [WARN] shiny-server - Running as root unnecessarily is a security risk! You could be running more securely as non-root.
[2016-01-10 14:52:36.414] [INFO] shiny-server - Starting listener on 0.0.0.0:3838
I run the command sudo ifconfig to get my server IP address, and the site runs on my computer at: http://my_ip_address:3838/sample-apps/hello/.
However, when I try to go to this link at another computer in my house, the website does not load.
Note*: The thing I did to try to fix it was to configure my server's firewall to allow inbound TCP connections on port 3838, which I think Idid.
When I type sudo ufw status into command prompt, I get:
Status: active
To Action From
-- ------ ----
3838/tcp ALLOW Anywhere
3838 ALLOW Anywhere
80 ALLOW Anywhere
3838/tcp ALLOW Anywhere (v6)
3838 ALLOW Anywhere (v6)
80 ALLOW Anywhere (v6)
I am not sure what else to try.

Have you tried
my_ip_address:3838/hello/
instead of
my_ip_address:3838/sample-apps/hello/
If you check the content of /etc/shiny-server/shiny-server.conf and it says directory_index on; you should be able to browse to my_ip_address:3838 and see a directory listing and at least a welcome page.

Related

Node js Application running on EC2 but not accessible in browser using Nginx

I'm a newbie to Nginx. I cannot access my Node.js application that I deploy on AWS EC2 using Nginx reverse proxy. If I do curl http://localhost:3000 I can see the application is running successfully on the server(I'm using pm2 for running node server). But when I try to access it in my browser or postman using public DNS I get the error This site can't be reached and the request gets timeout. Here's my Nginx configuration (I have followed a number of tutorials for this)
The configuration file is named nginx.conf and is in /etc/nginx/sites-enabled directory. If I do sudo nginx -t it says syntax is ok and the test is successful. Also I can see the Nginx is running using command sudo systemctl status nginx What could be the possible reason for this behaviour?
I figured it out the problem wasn't with the Nginx configuration actually I needed to allow public access for port 80 on my ec2 instance which is blocked by default. I allowed port 80 and everything is working fine. This blog helped me. Visit it for me details on how to enable port 80 for your ec2 instance.

Unable to access shiny server in docker container

I have a Dockerized R Shiny app on Google Cloud VM. It was running well but from yesterday I am not able to access the shiny server. I have checked the docker logs and it gives me below message:
**[2019-03-13T14:56:11.496] [INFO] shiny-server - Shiny Server v1.5.7.890 (Node.js v8.10.0)
[2019-03-13T14:56:11.498] [INFO] shiny-server - Using config file "/etc/shiny-server/shiny-server.conf"
[2019-03-13T14:56:11.559] [WARN] shiny-server - Running as root unnecessarily is a security risk! You could be running more securely as non-root.
[2019-03-13T14:56:11.562] [INFO] shiny-server - Starting listener on 0.0.0.0:3838**
So, does it means the shiny server is running? If YES then why I am not able to access it from a browser (on the browser it gives me an error ERR_CONNECTION_REFUSED)?
Note: The port 3838 (default shiny server port) is whitelisted from VM.

What's the difference between starting nginx with command "nginx", "service start nginx" and "systemctl nginx start"?

I have noticed that when ever I start nginx with ubuntu command "nginx" and I do systemctl status nginx. It shows that systemctl is disabled. More over if I first start nginx with command systemctl start nginx and i try to start nginx with command nginx, it check the availbility of the ports and then says nginx: [emerg] still could not bind(). So i thought there must be a differene and their purpose. When I strt nginx with command nginx the only way to stop nginx is by the means of force using killlall nginx or kill -9 (process id) or by clearing the port. So I am pretty sure there is some difference in them.
The difference between the examples you have provied is how the processes are being started.
Running the command nginx will start the application and wait for your user action to stop it.
The systemctl or service commands are nearly the same thing and running service nginx start or systemctl start nginx will start a service in the background running the Nginx daemon.
You can also use this to do a service nginx restart or systemctl restart nginx to restart the service, or even a service nginx reload / systemctl reload nginx to reload the configuration without completely stopping the Nginx server.
The reason why you can't do both nginx and systemctl start nginx is due to the nginx configuration already listening port 80, and you can't listen on the same port on a single IP address at the same time.
You can also force the nginx service to start on boot by running systemctl enable nginx which will be why your systemctl status nginx returns 'disabled'.
Hope this makes sense.
service command is just a simple script which basically abstract choosing the underlying init system (upstart, systemmd , /etc/init.d or systemctl).
since it being a very concise script, it only supports a very limited set of operations (start | stop | reload .. ).
However, if you actually want to perform the additional operation you need to make use of the actual init system in this case systemctl
An apt example would be starting the service on boot time using systemctl sudo systemctl enable the-name-of-service which is not possible using service

Creating docker repo in Artifactory with dedicated port, it says "SocketException: Permission denied"

I am running Artifactory Pro (5.3.1), and was trying to use the docker registry functionality.
I created a docker repository, and gave it a port 5001 in the "Registry Port" config.
However, there's nothing running on port 5001 ("telnet localhost 5001" refuses to connect), and the logs show this:
[http-nio-8081-exec-7] [ERROR] (o.a.s.s.SshAuthServiceImpl:210) - Failed to start SSH server
java.net.SocketException: Permission denied
at sun.nio.ch.Net.bind0(Native Method) ~[na:1.8.0_72-internal]
at sun.nio.ch.Net.bind(Net.java:433) ~[na:1.8.0_72-internal]
at sun.nio.ch.Net.bind(Net.java:425) ~[na:1.8.0_72-internal]
at sun.nio.ch.AsynchronousServerSocketChannelImpl.bind(AsynchronousServerSocketChannelImpl.java:162) ~[na:1.8.0_72-internal]
at org.apache.sshd.common.io.nio2.Nio2Acceptor.bind(Nio2Acceptor.java:66) ~[sshd-core-0.14.0.jar:0.14.0]
Any idea what could cause a "permission denied"? There's nothing running on that port (same error for any other port). It's on Ubuntu 14.04.
I had a misunderstanding how the docker registry worked with Artifactory.
The Artifactory service doesn't actually open the port assigned to the repo (5001 in this case), but the reverse proxy will listen on it and forward it (with the right X-forwarded-port) to the "normal" Artifactory service port (e.g. 8081).
After setting up the reverse proxy for it, it worked fine.

Kibana4 to listen on Port 80 instead of Port 5601

I have elasticsearch 1.4 and kibana4 running on an Amazo EC2 instance running RHEL7.
Kibana4 is running as a standalone process and is not deployed in a web container such as nginx.It is listening on Port 5601.(the default port). I would like to have kibana listen on port 80.
Can this be achieved without using nginx? If yes how?
You need to set capabilities CAP_NET_BIND_SERVICE to bind non root process to a privileged port (<1024)
to make kibana listen on port 80 :
1- edit kibana port in /etc/kibana/kibana.yml
server.port : "80"
2- run the following commands :
sudo setcap cap_net_bind_service=+epi /usr/share/kibana/bin/kibana
sudo setcap cap_net_bind_service=+epi /usr/share/kibana/bin/kibana-plugin
sudo setcap cap_net_bind_service=+epi /usr/share/kibana/bin/kibana-keystore
sudo setcap cap_net_bind_service=+epi /usr/share/kibana/node/bin/node
Edit file {kibana-directory}/config/kibana.yml. Find this line:
port: 5601
and change it to:
port: 80
Setting the port 80 in config file will trigger the following error
kibana[11777]: FATAL Error: listen EACCES: permission denied 0.0.0.0:80
due to the fact that kibana service by default executes under the user kibana
You can change the user to root, but this will trigger the following warning
kibana[11639]: Kibana should not be run as root. Use --allow-root to continue.
So running kibana service under root user is something not recommended. Better make a port forwarding rule, or a HTTP redirect if you have a web server.
Full settings here: https://www.elastic.co/guide/en/kibana/current/settings.html
This should be added to config/kibana.yml
server.port: 80
And run kibana server with sudo. Make sure no process is using port 80 at the same time.

Resources