How I can resolve 502 error on Gitlab? - ruby-on-rails

So, I try to install Gitlab and I have some problems. At the end of Installation from source, when I try to start all services, I have a 502 error. I have this message when I try sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production :
Check GitLab API access: FAILED. code: 502
gitlab-shell self-check failed
Try fixing it:
Make sure GitLab is running;
Check the gitlab-shell configuration file:
sudo -u git -H editor /home/git/gitlab-shell/config.yml
Please fix the error above and rerun the checks.
After some search, I think it's a unicorn error. That's what I find in the file log tail -n 15 /home/git/gitlab/log/unicorn.stderr.log :
F, [2015-08-17T14:08:25.266483 #15125] FATAL -- : error adding listener addr="188.213.26.27":80
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/socket_helper.rb:147:in `initialize': Permission denied - bind(2) for "188.213.26.27" port 80 (Errno::EACCES)
I don't know how I can change this and if it's the real problem. If it can help, this is the Nginx log tail -f /var/log/nginx/gitlab_error.log :
2015/08/16 16:46:24 [error] 14932#0: *33 limiting connections by zone "limit_per_ip", client: 188.213.26.27, server: gitlab.nova.ovh, request: "GET / HTTP/1.0", host: "gitlab.nova.ovh"
2015/08/16 17:00:41 [error] 14932#0: *71 limiting connections by zone "limit_per_ip", client: 188.213.26.27, server: gitlab.nova.ovh, request: "GET / HTTP/1.0", host: "gitlab.nova.ovh"
2015/08/16 17:01:04 [error] 19194#0: *33 limiting connections by zone "limit_per_ip", client: 188.213.26.27, server: gitlab.nova.ovh, request: "GET / HTTP/1.0", host: "gitlab.nova.ovh"
2015/08/16 17:03:01 [error] 19713#0: *33 limiting connections by zone "limit_per_ip", client: 188.213.26.27, server: gitlab.nova.ovh, request: "GET / HTTP/1.0", host: "gitlab.nova.ovh"
2015/08/17 12:18:09 [error] 18616#0: *3 connect() to unix:/home/git/gitlab/tmp/sockets/gitlab.socket failed (111: Connection refused) while connecting to upstream, client: 82.127.11.127, server: gitlab.nova.ovh, request: "GET / HTTP/1.1", upstream: "http://unix:/home/git/gitlab/tmp/sockets/gitlab.socket:/", host: "gitlab.nova.ovh"
2015/08/17 12:18:26 [error] 18616#0: *6 connect() to unix:/home/git/gitlab/tmp/sockets/gitlab.socket failed (111: Connection refused) while connecting to upstream, client: 188.213.26.27, server: gitlab.nova.ovh, request: "GET //api/v3/internal/check HTTP/1.1", upstream: "http://unix:/home/git/gitlab/tmp/sockets/gitlab.socket://api/v3/internal/check", host: "gitlab.nova.ovh"
2015/08/17 13:47:09 [error] 18616#0: *38 connect() to unix:/home/git/gitlab/tmp/sockets/gitlab.socket failed (111: Connection refused) while connecting to upstream, client: 188.213.26.27, server: gitlab.nova.ovh, request: "GET //api/v3/internal/check HTTP/1.1", upstream: "http://unix:/home/git/gitlab/tmp/sockets/gitlab.socket://api/v3/internal/check", host: "gitlab.nova.ovh"
2015/08/17 13:48:05 [error] 18616#0: *42 connect() to unix:/home/git/gitlab/tmp/sockets/gitlab.socket failed (111: Connection refused) while connecting to upstream, client: 188.213.26.27, server: gitlab.nova.ovh, request: "GET //api/v3/internal/check HTTP/1.1", upstream: "http://unix:/home/git/gitlab/tmp/sockets/gitlab.socket://api/v3/internal/check", host: "gitlab.nova.ovh"

Unicorn must not bind port 80 which it is denied anyways (hence the error message). Binding ports below 1024 requires root privileges. Also port 80 is used by nginx. Configure unicorn to not listen to TCP ports at all if you're using unix socket or any high port (e.g. 8080 or 8081) for use with TCP socket.

Related

unRAID Docker SWAG - Cloudflare X-Auth Error

I am trying to connect SWAG to a domain via cloudflare. I get the following error message in the logs of SWAG.
As email I have entered the address with which I log in to cloudflare and as key the Global API Key from cloudflare.
Am I doing something wrong? How can I find out where the error is? Thanks!
I entered the email and the Global API Key into the cloudflare.ini from SWAG Docker and got the error mentioned.
Here is an extract from the logs:
Mar 23 15:30:45 Aldnoah nginx: 2022/03/23 15:30:45 [error] 2323#2323: *868944 connect() to unix:/var/tmp/swag.sock failed (111: Connection refused) while connecting to upstream, client: 192.168.178.22, server: , request: "GET /dockerterminal/swag/token HTTP/1.1", upstream: "http://unix:/var/tmp/swag.sock:/token", host: "192.168.178.47", referrer: "http://192.168.178.47/dockerterminal/swag/"
Mar 23 15:30:45 Aldnoah nginx: 2022/03/23 15:30:45 [error] 2323#2323: *869155 connect() to unix:/var/tmp/swag.sock failed (111: Connection refused) while connecting to upstream, client: 192.168.178.22, server: , request: "GET /dockerterminal/swag/ws HTTP/1.1", upstream: "http://unix:/var/tmp/swag.sock:/ws", host: "192.168.178.47"
Mar 23 15:30:45 Aldnoah nginx: 2022/03/23 15:30:45 [error] 2323#2323: *868944 connect() to unix:/var/tmp/swag.sock failed (111: Connection refused) while connecting to upstream, client: 192.168.178.22, server: , request: "GET /dockerterminal/swag/token HTTP/1.1", upstream: "http://unix:/var/tmp/swag.sock:/token", host: "192.168.178.47", referrer: "http://192.168.178.47/dockerterminal/swag/"
Mar 23 15:30:45 Aldnoah nginx: 2022/03/23 15:30:45 [error] 2323#2323: *869158 connect() to unix:/var/tmp/swag.sock failed (111: Connection refused) while connecting to upstream, client: 192.168.178.22, server: , request: "GET /dockerterminal/swag/ws HTTP/1.1", upstream: "http://unix:/var/tmp/swag.sock:/ws", host: "192.168.178.47"
Mar 23 15:30:46 Aldnoah nginx: 2022/03/23 15:30:46 [error] 2323#2323: *868944 connect() to unix:/var/tmp/swag.sock failed (111: Connection refused) while connecting to upstream, client: 192.168.178.22, server: , request: "GET /dockerterminal/swag/token HTTP/1.1", upstream: "http://unix:/var/tmp/swag.sock:/token", host: "192.168.178.47", referrer: "http://192.168.178.47/dockerterminal/swag/"
Mar 23 15:30:46 Aldnoah nginx: 2022/03/23 15:30:46 [error] 2323#2323: *869161 connect() to unix:/var/tmp/swag.sock failed (111: Connection refused) while connecting to upstream, client: 192.168.178.22, server: , request: "GET /dockerterminal/swag/ws HTTP/1.1", upstream: "http://unix:/var/tmp/swag.sock:/ws", host: "192.168.178.47"
Mar 23 15:30:47 Aldnoah nginx: 2022/03/23 15:30:47 [error] 2323#2323: *868944 connect() to unix:/var/tmp/swag.sock failed (111: Connection refused) while connecting to upstream, client: 192.168.178.22, server: , request: "GET /dockerterminal/swag/token HTTP/1.1", upstream: "http://unix:/var/tmp/swag.sock:/token", host: "192.168.178.47", referrer: "http://192.168.178.47/dockerterminal/swag/"
Mar 23 15:30:47 Aldnoah nginx: 2022/03/23 15:30:47 [error] 2323#2323: *869165 connect() to unix:/var/tmp/swag.sock failed (111: Connection refused) while connecting to upstream, client: 192.168.178.22, server: , request: "GET /dockerterminal/swag/ws HTTP/1.1", upstream: "http://unix:/var/tmp/swag.sock:/ws", host: "192.168.178.47"

Rails app, capistrano, nginx & puma 502 bad gateway

I'm getting a 502 when hitting my rails app.
2018/12/22 20:12:37 [error] 22034#22034: *81 connect() to unix:/home/user/project/shared/tmp/sockets/puma.sock failed (111: Connection refused) while connecting to upstream, client: xx.xx.xx.xx, server: localhost, request: "GET /api/v1/login HTTP/1.1", upstream: "http://unix:/home/user/project/shared/tmp/sockets/puma.sock:/500.html", host: "xx.xx.xx.xx"
Is there a better way to troubleshoot this by finding a more descriptive error?

Docker osTicket HTTP Errors

I'm having troubles getting the Docker containers for osTicket up and running.
I've created and linked the MariaDB and osTicket containers following the getting started directions:
$ docker run --name osticket_mysql -d -e MYSQL_ROOT_PASSWORD=secret \
-e MYSQL_USER=osticket -e MYSQL_PASSWORD=secret -e MYSQL_DATABASE=osticket mariadb
$ docker run --name osticket -d --link osticket_mysql:mysql -p 8080:80 osticket/osticket
I am then suppose to be able to go to http://localhost:8080/scp but I get a HTTP-404 Nginx message.
Going to http://localhost:8080 gives me a 403-Restricted Nginx error
The Nginx Error log from inside of the osTicket container is as follows:
# cat nginx-error.log
2018/07/03 01:38:17 [error] 40#40: *1 directory index of "/var/www/src/public/" is forbidden, client: 172.17.0.1, server: _, request: "GET / HTTP/1.1", host: "localhost:8080"
2018/07/03 01:38:17 [error] 40#40: *1 open() "/var/www/src/public/favicon.ico" failed (2: No such file or directory), client: 172.17.0.1, server: _, request: "GET /favicon.ico HTTP/1.1", host: "localhost:8080"
2018/07/03 01:38:17 [error] 40#40: *1 open() "/var/www/src/public/favicon.ico" failed (2: No such file or directory), client: 172.17.0.1, server: _, request: "GET /favicon.ico HTTP/1.1", host: "localhost:8080"
2018/07/03 01:41:52 [error] 40#40: *3 directory index of "/var/www/src/public/" is forbidden, client: 172.17.0.1, server: _, request: "GET / HTTP/1.1", host: "0.0.0.0:8080"
2018/07/03 01:41:52 [error] 40#40: *3 open() "/var/www/src/public/favicon.ico" failed (2: No such file or directory), client: 172.17.0.1, server: _, request: "GET /favicon.ico HTTP/1.1", host: "0.0.0.0:8080"
2018/07/03 01:41:52 [error] 40#40: *3 open() "/var/www/src/public/favicon.ico" failed (2: No such file or directory), client: 172.17.0.1, server: _, request: "GET /favicon.ico HTTP/1.1", host: "0.0.0.0:8080"
2018/07/03 01:45:32 [error] 40#40: *4 directory index of "/var/www/src/public/" is forbidden, client: 172.17.0.1, server: _, request: "GET / HTTP/1.1", host: "0.0.0.0:8080"
2018/07/03 01:47:21 [error] 40#40: *4 FastCGI sent in stderr: "PHP message: PHP Parse error: syntax error, unexpected 'echo' (T_ECHO), expecting ',' or ';' in /bin/webhook.php on line 12" while reading response header from upstream, client: 172.17.0.1, server: _, request: "GET /webhook.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "0.0.0.0:8080"
Any ideas what I'm doing wrong?
Thanks!
As #AndrewSavinykh pointed out in the comments, the osticket/osticket container image is out of date.
Using the container by Campbell Software Solutions LINK solved the issues.

Rails 5, Mongoid, MongoDB app not running on AWS Elastic Beanstalk

Symptoms:
When navigating to the EB URL, page never loads.
I can provide parts of my project config if needed. Here is a portion of the log from my AWS EB instance:
2018/02/18 09:35:22 [warn] 3060#0: conflicting server name "localhost" on 0.0.0.0:80, ignored
2018/02/18 09:46:48 [error] 3064#0: *167 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 172.31.4.6, server: _, request: "GET /users HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/users", host: "idea-jotter-api-env.ukn765e3m3.ap-southeast-1.elasticbeanstalk.com"
2018/02/18 09:46:49 [error] 3064#0: *167 connect() to unix:///var/run/puma/my_app.sock failed (111: Connection refused) while connecting to upstream, client: 172.31.4.6, server: _, request: "GET /favicon.ico HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/favicon.ico", host: "idea-jotter-api-env.ukn765e3m3.ap-southeast-1.elasticbeanstalk.com", referrer: "http://idea-jotter-api-env.ukn765e3m3.ap-southeast-1.elasticbeanstalk.com/users"
2018/02/19 13:11:50 [error] 3064#0: *24659 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 172.31.31.179, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock/", host: "52.221.25.234"

Rails - Elastick Beanstalk nginx/error.log

Trying to upload my rails app to elastic beanstalk. I have successfully deployed my app and created postgres database. My app works on sqlite3 on development server.
my eb status is ready and health is green.
my eb logs file;
/var/log/nginx/error.log
-------------------------------------
2016/05/27 11:15:44 [warn] 2797#0: conflicting server name "localhost" on 0.0.0.0:80, ignored
2016/05/27 11:27:26 [crit] 2805#0: *140 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 172.31.26.77, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/", host: "viravira-env.bu2eqpbwny.us-west-2.elasticbeanstalk.com"
2016/05/27 11:27:26 [crit] 2805#0: *140 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 172.31.26.77, server: _, request: "GET /favicon.ico HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/favicon.ico", host: "viravira-env.bu2eqpbwny.us-west-2.elasticbeanstalk.com", referrer: "http://viravira-env.bu2eqpbwny.us-west-2.elasticbeanstalk.com/"
2016/05/27 11:34:45 [crit] 2805#0: *262 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 172.31.46.145, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/", host: "viravira-env.bu2eqpbwny.us-west-2.elasticbeanstalk.com"
2016/05/27 11:34:45 [crit] 2805#0: *262 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 172.31.46.145, server: _, request: "GET /favicon.ico HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/favicon.ico", host: "viravira-env.bu2eqpbwny.us-west-2.elasticbeanstalk.com", referrer: "http://viravira-env.bu2eqpbwny.us-west-2.elasticbeanstalk.com/"
2016/05/27 11:40:48 [crit] 2805#0: *353 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 172.31.46.145, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/", host: "viravira-env.bu2eqpbwny.us-west-2.elasticbeanstalk.com"
2016/05/27 11:40:49 [crit] 2805#0: *353 connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream, client: 172.31.46.145, server: _, request: "GET /favicon.ico HTTP/1.1", upstream: "http://unix:///var/run/puma/my_app.sock:/favicon.ico", host: "viravira-env.bu2eqpbwny.us-west-2.elasticbeanstalk.com", referrer: "http://viravira-env.bu2eqpbwny.us-west-2.elasticbeanstalk.com/"
-------------------------------------
/var/log/puma/puma.log
-------------------------------------
=== puma startup: 2016-05-27 11:52:07 +0000 ===
=== puma startup: 2016-05-27 11:52:07 +0000 ===
[23871] - Worker 0 (pid: 23875) booted, phase: 0
[23871] - Gracefully shutting down workers...
[23871] === puma shutdown: 2016-05-27 12:36:32 +0000 ===
[23871] - Goodbye!
=== puma startup: 2016-05-27 12:36:35 +0000 ===
=== puma startup: 2016-05-27 12:36:35 +0000 ===
[24886] - Worker 0 (pid: 24890) booted, phase: 0
I am fairly new to eb so I wonder if the problem occurs because of the followings;
I have not installed node that is why it can not connect
Or I have problems with the security groups. I have 4 total as seen in the picture.
my network interfaces;
when I try to detach RDS security group, it gives an error no authorization, even though I signed in as root.
I have been trying to solve the problem for hours now and really appreciate any help!
EDIT
I think I m having same issue as here. But could not understand how to solve it
Your problem is very clear from the Nginx log:
connect() to unix:///var/run/puma/my_app.sock failed (2: No such file or directory) while connecting to upstream
It reads:
No such file or directory
This means that your socket doesn't not exist at this path:
/var/run/puma/my_app.sock
You need to setup the path to be the same as in your Rails/Puma
upstream(i.e. configuration)
When you will do that don't forget to make sure that Nginx user
can access that socket it will need RW access.

Resources