Configure gitlab with apache2 (or nginx + apache2) - ruby

I have installed GitLab in a Ubuntu14.04 server with LAMP. I am aware that GitLab has been designed to work with nginx based servers, but this server has web apps that have been installed over apache2 and I need them.
I tried installing GitLab following this tutorial. I used the gitlab_7.7.1-omnibus.5.4.1.ci-1_amd64.deb package.
I ended up having the same problem than some of the people who commented (error 502). I tried following this link through the comments to see if I could find any relevant information, but it doesn't seem to be relevant for my case.
I keep searching for alternative ways to configure nginx through apache2, but I'm not finding anything.
Here's a log entry that I found in /var/log/gitlab/nginx/gitlab_error.log:
2015/01/30 19:32:27 [error] 995#0: *3 connect() to unix:/var/opt/gitlab
/gitlab-rails/sockets/gitlab.socket failed (111: Connection refused)
while connecting to upstream, client: 127.0.0.1, server: mygitlab.com,
request: "GET / HTTP/1.1", upstream: "http://unix:/var/opt/gitlab/gitlab-
rails/sockets/gitlab.socket:/", host: "localhost:8080"
It seems that it is a problem with upstream socket's configuration.
gitlab-ctl status outputs:
run: logrotate: (pid 4465) 1488s; run: log: (pid 826) 5087s
run: nginx: (pid 837) 5087s; run: log: (pid 825) 5087s
run: postgresql: (pid 827) 5087s; run: log: (pid 817) 5087s
run: redis: (pid 828) 5087s; run: log: (pid 818) 5087s
run: sidekiq: (pid 839) 5087s; run: log: (pid 824) 5087s
run: unicorn: (pid 5861) 0s; run: log: (pid 823) 5087s
Anyways, it seems that Omnibus doesn't install nginx at all (or I guess so, there's no service named 'nginx' in /etc/init.d/. I do not discard the possibility that the log generator confused apache2 with nginx).
Questions:
Is it mandatory to install nginx to run gitlab? If so, can it co-exist with apache properly?
Is proxying GitLab through apache a good approach to what I'm looking for?
I don't know much about Unicorn. I found this question in SO. Does this mean that Unicorn handles upstream sockets in GitLab?
EDIT: Checking this document I decided to check if Omnibus installed Ruby with ruby -v and I noticed that Ruby wasn't installed at all. So I decided to compile and install it, following the document's instructions:
mkdir /tmp/ruby && cd /tmp/ruby
curl -L --progress http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.5.tar.gz | tar xz
cd ruby-2.1.5
./configure --disable-install-rdoc
make
sudo make install
Anyways, it seems some dependencies failed and ruby is not plently operative. When I try sudo gem install bundler --no-ri --no-rdoc, the following errors ocurr:
ERROR: Loading command: install (LoadError)
cannot load such file -- zlib
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
During the make operation, these errors happened:
Failed to configure -test-/win32/dln. It will not be installed.
Failed to configure -test-/win32/dln/empty. It will not be installed.
Failed to configure -test-/win32/fd_setsize. It will not be installed.
Failed to configure dbm. It will not be installed.
Failed to configure fiddle. It will not be installed.
Failed to configure gdbm. It will not be installed.
Failed to configure openssl. It will not be installed.
Failed to configure readline. It will not be installed.
Failed to configure tk. It will not be installed.
Failed to configure tk/tkutil. It will not be installed.
Failed to configure win32. It will not be installed.
Failed to configure win32ole. It will not be installed.
Failed to configure zlib. It will not be installed.
EDIT2: It seems that compiling and installing Ruby was completely inneccessary. Looking around for config files, I saw that Omnibus installed lots of dependencies (Ruby among them) in /opt/gitlab/embedded/ directory. :-S

Is it mandatory to install nginx to run gitlab? If so, can it co-exist
with apache properly?
Gitlab is bundled with nginx but you can use it with Apache HTTP server.
Is proxying GitLab through apache a good approach to what I'm looking
for?
You can disable nginx in Gitlab config and configure Apache to forward to Gitlab.
I don't know much about Unicorn. I found this question in SO. Does
this mean that Unicorn handles upstream sockets in GitLab?
Unicorn is HTTP server for Ruby. You can forward requests to Gitlab Unicorn server or gitlab-workhorse.
Below is the basic /etc/gitlab/gitlab.rb configuration used with Apache, other lines are commented:
external_url 'https://my.example.com/gitlab'
gitlab_workhorse['enable'] = true
gitlab_workhorse['listen_network'] = "tcp"
gitlab_workhorse['listen_addr'] = "127.0.0.1:9191"
unicorn['listen'] = '127.0.0.1'
unicorn['port'] = 9099
web_server['external_users'] = ['www-data']
web_server['username'] = 'apache' #'gitlab-www'
web_server['group'] = 'apache' #'gitlab-www'
nginx['enable'] = false
And make proxyPass in /etc/apache2/apache2.conf to the gitlab-workhorse running on 9191:
ProxyPass /gitlab http://127.0.0.1:9191/gitlab
RequestHeader add X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-Ssl on

Related

Cannot access Flink dashboard localhost:8081 on windows

I follow the first steps to install Flink.
I can start the cluster without any problem
$ start-cluster.sh
Starting cluster.
Starting standalonesession daemon on host DESKTOP-....
Starting taskexecutor daemon on host DESKTOP-....
But I don't get any status from
$ ps aux | grep flink
I can also not access the dashboard via localhost:8081.
There is an older post having these issues, but the solution didn't work for me, since the described conf files do no longer exist, apparently.
My JAVA_HOME is set as C:\Progra~1\Java\jdk1.8.0_311 to avoid issues with the space in Program Files.
Can you check the logs in the /logs folder? I'm suspecting that C:\Program Files\ could still cause issues because of the space there.
go to download Flink folder and try bash command
$./bin/start-cluster.sh --daemon bootstrap-server localhost:8081
and run code one more
$ ./bin/flink run examples/streaming/WordCount.jar
if you finished run above code which not issue, go to localhost:8081
This still seems to be problematic. I tried to run from Windows Subsystem for Linux (WSL).
I have the following versions: java 11.0.16 and flink 1.15.2.
sudo apt-get update
sudo apt install openjdk-11-jre-headless
export FLINK_HOME=/mnt/c/Projects/Apache/flink-1.15.2
I set the following in flink-conf.yaml
rest.port: 8081
rest.address: localhost
rest.bind-adress: 0.0.0.0
Whereby I changed the bind address for localhost to 0.0.0.0 this seems to have fixed the problem.
$FLINK_HOME/bin/start-cluster.sh
Now I can access the Flink Web Dashboard.

Apache2 H10292 Invalid proxy UDS filename error after automatic update (Ubuntu 20.04)

This morning Apache2 was automaticaly updated on my Ubuntu 20.04 server:
Start-Date: 2021-09-28 06:37:07
Commandline: /usr/bin/unattended-upgrade
Upgrade: apache2-data:arm64 (2.4.41-4ubuntu3.3, 2.4.41-4ubuntu3.5), apache2-bin:arm64 (2.4.41-4ubuntu3.3, 2.4.41-4ubuntu3.5), apache2:arm64 (2.4.41-4ubuntu3.3, 2.4.41-4ubuntu3.5), apache2-utils:arm64 (2.4.41- 4ubuntu3.3, 2.4.41-4ubuntu3.5)
End-Date: 2021-09-28 06:37:20
All my websites are down along with a 500 error since then.
Here's what I've found out in the apache error log:
[Tue Sep 28 08:40:34.983062 2021] [proxy:error] [pid 1806:tid 281473819050384] [client 192.168.1.17:51286] AH10292: Invalid proxy UDS filename (proxy:unix:///var/run/php/php7.4-fpm.sites.mydomain.com.sock|fcgi://sites//srv/www/sites/html/bookend/index.php)
Should I reconfigure the PHP settings ?
Should I upgrade/downgrade apache ?
What can I do ?
It happened a lot today apparently. There's a workaround for this that you can apply manually though:
Log through SSh.
Then download this wget https://plesk.zendesk.com/hc/article_attachments/4407408199954/PPPM-13232.tgz && tar -xvf PPPM-13232.tgz -C /usr/local/psa/admin/plib/Template/Variable/Domain/
Rebuild config: plesk sbin httpdmng --reconfigure-all
Hopefully that will do. More info here.
I found this information on the plesk page: https://support.plesk.com/hc/en-us/articles/4407366133906-Website-on-Plesk-server-suddenly-started-to-show-500-error-AH10292-Invalid-proxy-UDS-filename
As explained in this post I've installed the 2.4.49 apache version through a PPA:
sudo add-apt-repository ppa:ondrej/apache2
sudo apt install apache2
Everything is back to normal now.
It's also a good idea to prevent any future automatic apache updates to avoid version conflicts:
sudo apt-mark hold apache2

Elasticsearch fails to start or run on OSX

I am posting to hopefully help others if they run into this issue on Mac. I recently updated ES to 2.2.x branch using Homebrew:
brew uninstall --force elasticsearch
brew update
brew install elasticsearch
I repeatedly got connection errors trying both localhost and 127.0.0.1 on port 9200.
curl http://localhost:9200
curl: (7) Failed to connect to localhost port 9200: Connection refused
I tried an unload and load.
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist
Then tried starting manually.
elasticsearch
The following errors appeared indicating that the Java version 1.7.x was an error and why it would not start.
Exception in thread "main" java.lang.RuntimeException: Java version: Oracle Corporation 1.7.0_45 [Java HotSpot(TM) 64-Bit Server VM 24.45-b08] suffers from critical bug https://bugs.openjdk.java.net/browse/JDK-8024830 which can cause data corruption.
Please upgrade the JVM, see http://www.elastic.co/guide/en/elasticsearch/reference/current/_installation.html for current recommendations.
If you absolutely cannot upgrade, please add -XX:-UseSuperWord to the JAVA_OPTS environment variable.
Upgrading is preferred, this workaround will result in degraded performance.
at org.elasticsearch.bootstrap.JVMCheck.check(JVMCheck.java:123)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:283)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
Refer to the log for complete error details.
After getting past this error, there were errors as well for previously-installed plugins on the 1.7.x branch.
Exception in thread "main" java.lang.IllegalStateException: Could not load plugin descriptor for existing plugin [bigdesk]. Was the plugin built before 2.0?
Likely root cause: java.nio.file.NoSuchFileException: /usr/local/var/lib/elasticsearch/plugins/bigdesk/plugin-descriptor.properties
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
at java.nio.file.Files.newByteChannel(Files.java:315)
at java.nio.file.Files.newByteChannel(Files.java:361)
at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:380)
at java.nio.file.Files.newInputStream(Files.java:106)
at org.elasticsearch.plugins.PluginInfo.readFromProperties(PluginInfo.java:87)
at org.elasticsearch.plugins.PluginsService.getPluginBundles(PluginsService.java:378)
at org.elasticsearch.plugins.PluginsService.<init>(PluginsService.java:128)
at org.elasticsearch.node.Node.<init>(Node.java:146)
at org.elasticsearch.node.Node.<init>(Node.java:128)
at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:145)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:178)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:285)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
Refer to the log for complete error details.
The solutions to these issues I discovered were the following:
Edit the /usr/local/etc/elasticsearch/elasticsearch.yml file and verify the bind_host configs are commented so it will default to 0.0.0.0.
Edit the /usr/local/Cellar/elasticsearch/YOUR_VERSION/libexec/bin/elasticsearch.in.sh file and add the -XX:-UserSuperWord flag after the other JAVA_OPTS:
JAVA_OPTS="$JAVA_OPTS -XX:-UseSuperWord"
Manually remove the previous plugins so you can install the latest versions for that ES branch:
/usr/local/Cellar/elasticsearch/2.2.0_1/libexec/bin/plugin list
Installed plugins in /usr/local/var/lib/elasticsearch/plugins:
- bigdesk
- head
/usr/local/Cellar/elasticsearch/2.2.0_1/libexec/bin/plugin remove bigdesk
/usr/local/Cellar/elasticsearch/2.2.0_1/libexec/bin/plugin remove head
After these steps I could once again start ES 2.x and then I can re-install any desired plugins. I hope this helps others if they run into similar issues.
I had this issue on MacOs, when I tried to uninstall elasticsearch7 and install elastisearch#6 using homebrew.
I resolved it by manually deleting the following directories and installed elasticsearch#6
Data: /usr/local/var/lib/elasticsearch/
Logs: /usr/local/var/log/elasticsearch/elasticsearch_<<user>>.log
Plugins: /usr/local/var/elasticsearch/plugins/
Config: /usr/local/etc/elasticsearch/
steps:
>brew uninstall elasticsearch
>rm -rf <<above mentioned directories>>
>brew install elasticsearch#6

Is the latest version of docker from Amazon on ec2 broken?

As of last night all our new docker deployments started failing because the latest version of docker (docker-1.3.2-1.0.amzn1.x86_64) in the amazon repo fails to start up.
Steps to reproduce are:
## Launch instance with default amazon AMI
yum install docker-1.3.2-1.0.amzn1.x86_64
service docker restart
### Get the following error in /var/log/docker
2014/11/26 05:14:16 docker daemon: 1.3.2 c78088f/1.3.2; execdriver: native; graphdriver:
[8f6d7cfb] +job serveapi(unix:///var/run/docker.sock)
[info] Listening for HTTP on unix (/var/run/docker.sock)
docker: relocation error: docker: symbol dm_task_get_info_with_deferred_remove,
version Base not defined in file libdevmapper.so.1.02 with link time reference
If I downgrade back to docker-1.3.1-1.0.amzn1.x86_64 everything seems to be fine.
Is the AWS package actually broken, or is it just our setup?
Is there a work around other than downgrading?
Yes, it is broken for me too.
Downgrading has been the solution yet.
The same error was by me on a centos VM provisioned at my workplace - a yum update resolved it.
I suspect a build was broken but went out, and has been fixed subsequently.

How to run nginx with docker container?

I tried to install nginx within my docker container, before the installation i want to run
the docker run -i -t base /bin/bash command and but i got a error like this..
WARNING: Local (127.0.0.1) DNS resolver found in resolv.conf and
containers can't use it.
Using default external servers : [8.8.8.8 8.8.4.4]
[error] client.go:2298 Error getting size: bad file descriptor
How can i solve this?
I had the same problem. For me, this fixed it:
sudo apt-get install cgroup-lite
However, it seems to be a bunch of related problems. For other solutions/work-arounds, see: https://github.com/dotcloud/docker/issues/4568

Resources