Passenger Phusion not detecting Rails app under Apache - ruby-on-rails

In an Ubuntu 14.4 environment, am running Passenger under Apache to serve my Rails app.
After starting apache however:
$ passenger-status
Version : 5.3.3
Date : 2018-08-10 17:08:52 -0400
Instance: DZeozT5t (Apache/2.4.7 (Ubuntu) Phusion_Passenger/5.3.3)
Phusion Passenger is currently not serving any applications.
$ passenger-config list-instances
Name PID Description
--------------------------------------------------------------------------
DZeozT5t 1438 Apache/2.4.7 (Ubuntu) Phusion_Passenger/5.3.3
It seems as if Passenger is installed and happily running, but not detecting my application.
$ cat /etc/apache2/sites-enabled/rails.conf
<VirtualHost *:80>
ServerName url.com
DocumentRoot /opt/members-only/public
PassengerRuby /usr/local/bin/ruby
<Directory "/opt/members-only/public">
Allow from all
Options FollowSymLinks
Options -MultiViews
Require all granted
</Directory>
</VirtualHost>
My apache user is www-data
/opt/members-only is a soft link to the deployment directory ( a standard rails app)
$ ls -lash /opt/members-only/
total 104K
4.0K drwxrwxr-x 16 www-data www-data 4.0K Aug 10 17:06 .
4.0K drwxr-xr-x 10 platform platform 4.0K Aug 10 16:34 ..
4.0K drwxrwxr-x 11 www-data www-data 4.0K Jul 30 22:22 app
4.0K drwxrwxr-x 2 www-data www-data 4.0K Jul 30 22:22 bin
4.0K drwxrwxr-x 2 www-data www-data 4.0K Jul 30 23:13 .bundle
4.0K drwx------ 5 www-data www-data 4.0K Aug 10 16:10 config
4.0K -rw-rw-r-- 1 www-data www-data 130 Jul 30 22:22 config.ru
4.0K drwx------ 4 www-data www-data 4.0K Jul 30 22:22 db
4.0K drwxrwxr-x 3 www-data www-data 4.0K Jul 30 22:22 doc
4.0K -rw-rw-r-- 1 www-data www-data 2.3K Aug 10 15:45 Gemfile
8.0K -rw-rw-r-- 1 www-data www-data 6.3K Aug 10 15:45 Gemfile.lock
4.0K drwxrwxr-x 4 www-data www-data 4.0K Jul 30 22:22 lib
4.0K drwxrwxr-x 2 www-data www-data 4.0K Aug 10 16:12 log
4.0K drwxr-xr-x 2 www-data www-data 4.0K Aug 10 16:33 node_modules
4.0K -rw-rw-r-- 1 www-data www-data 70 Jul 30 22:22 package.json
4.0K drwxrwxr-x 4 www-data www-data 4.0K Aug 10 16:13 public
4.0K -rw-rw-r-- 1 www-data www-data 227 Jul 30 22:22 Rakefile
4.0K -rw-rw-r-- 1 www-data www-data 374 Jul 30 22:22 README.md
4.0K drwxrwxr-x 3 www-data www-data 4.0K Jul 30 23:13 vendor
4.0K -rw-r--r-- 1 www-data www-data 86 Aug 10 16:33 yarn.lock
There are no passenger related errors in /var/log/apache2/error.log
How can I get passenger to detect my application?

I had exactly the same problem. When going through this step by step deployment:
https://www.digitalocean.com/community/tutorials/how-to-deploy-a-rails-app-with-passenger-and-apache-on-ubuntu-14-04
I realized that I had not disabled the default site or enabled mine:
sudo a2dissite 000-default
sudo a2ensite testapp
sudo service apache2 restart

Related

how to run a dbt container from command line with volumes

was trying to make a quick dbt container:
docker pull xemuliam/dbt
docker run -d --name dbt \
-p 8085:8085 \
-v /home/mypath/app:/usr/app \
xemuliam/dbt:latest
that didn't work, so i tried to inspect and saw the binding was rprivate, so i changed it to:
docker run -d --name dbt \
-p 8085:8085 \
-v /home/mypath/app:/usr/app,rshared:rshared \
xemuliam/dbt:latest
the issue is that /home/mypath/app ends up being empty, and if i go inside the container it has in the working directory of /usr/app:
drwxr-xr-x 15 root root 4096 Apr 29 12:24 .
drwxr-xr-x 1 root root 4096 Jun 21 20:14 ..
-rw-rw-r-- 1 root root 4895 Apr 28 16:54 ARCHITECTURE.md
-rwxrwxr-x 1 root root 16732 Apr 28 16:54 CHANGELOG.md
-rw-rw-r-- 1 root root 18081 Apr 28 16:54 CONTRIBUTING.md
-rw-rw-r-- 1 root root 2239 Apr 28 16:54 Dockerfile.test
-rw-rw-r-- 1 root root 11344 Apr 28 16:54 License.md
-rw-rw-r-- 1 root root 3271 Apr 28 16:54 Makefile
-rw-rw-r-- 1 root root 2365 Apr 28 16:54 README.md
drwxrwxr-x 5 root root 4096 Apr 28 16:54 core
drwxrwxr-x 4 root root 4096 Apr 29 12:23 dbt-core-1.1.0
-rw-rw-r-- 1 root root 205 Apr 28 16:54 dev-requirements.txt
drwxrwxr-x 2 root root 4096 Apr 28 16:54 docker
-rw-rw-r-- 1 root root 777 Apr 28 16:54 docker-compose.yml
drwxrwxr-x 3 root root 4096 Apr 28 16:54 docs
-rw-rw-r-- 1 root root 51 Apr 28 16:54 editable-requirements.txt
drwxrwxr-x 2 root root 4096 Apr 28 16:54 etc
drwxrwxr-x 3 root root 4096 Apr 28 16:54 events
-rw-rw-r-- 1 root root 65 Apr 28 16:54 mypy.ini
drwxrwxr-x 8 root root 4096 Apr 28 16:54 performance
drwxrwxr-x 6 root root 4096 Apr 28 16:54 plugins
-rw-r--r-- 1 root root 95 Apr 29 12:23 plugins.txt
-rw-rw-r-- 1 root root 242 Apr 28 16:54 pytest.ini
-rw-rw-r-- 1 root root 26 Apr 28 16:54 requirements.txt
drwxrwxr-x 2 root root 4096 Apr 28 16:54 scripts
drwxrwxr-x 5 root root 4096 Apr 28 16:54 test
drwxrwxr-x 7 root root 4096 Apr 28 16:54 tests
drwxrwxr-x 10 root root 4096 Apr 28 16:54 third-party-stubs
-rw-rw-r-- 1 root root 798 Apr 28 16:54 tox.ini
drwxr-xr-x 2 root root 4096 Apr 29 12:24 wheels
in my postgres db i am able to do a volume like this and it works:
-v /home/mypath/data:/var/lib/postgresql/data
i would like to access that stuff on the host so i can play around with editing it.
this is probably the worst way to get this done, so i would appreciate a better answer - but my solution:
step 1: pull image
$ podman pull xemuliam/dbt
step 2: create a container through cli instead of dockerfile
$ podman run -d --name db_dbt \
-p 8085:8085 \
-v /home/myusr/dbt_test/_official:/home/dbt_test/_official \
xemuliam/dbt:latest
step 3: copy files from /usr/app to /home/dbt_test/_official
$ cp -R /usr/app/* /home/dbt_test/_official
exit
$ podman stop db_dbt && podman rm db_dbt
step 4: copy files on the host
$ mkdir /home/myusr/dbt_test/app1
$ cp -R /home/myusr/dbt_test/_official/* /home/myusr/dbt_test/app1/
step 5: create a new volume
$ podman run -d --name db_dbt \
-p 8085:8085 \
-v /home/myusr/dbt_test/app1/:/usr/app/ \
xemuliam/dbt:latest
i really dont like this roundabout way, but now i am able to edit from the host and see what the container does.

Docker container has volume mounted but nginx still serves /var/www/html

I created a docker container using
sudo docker run --name game-nginx -p 80:80 -v ~/docker-image/html:/var/www/html -d nginx
When I ssh into the running docker container I can see the files in /var/www/html
drwxr-xr-x 8 1000 1000 4096 Sep 30 17:59 .git
drwxr-xr-x 2 1000 1000 4096 Sep 30 17:59 .idea
drwxr-xr-x 2 1000 1000 4096 Sep 30 17:59 assets
drwxr-xr-x 2 1000 1000 4096 Sep 30 17:59 classes
-rwxr-xr-x 1 1000 1000 365 Sep 30 17:59 composer.json
-rwxr-xr-x 1 1000 1000 77620 Sep 30 17:59 composer.lock
drwxr-xr-x 2 1000 1000 4096 Sep 30 17:59 css
-rwxr-xr-x 1 1000 1000 367 Sep 30 17:59 index.php
-rwxr-xr-x 1 root root 17 Oct 1 18:31 info.php
drwxr-xr-x 2 1000 1000 4096 Sep 30 17:59 js
drwxr-xr-x 2 1000 1000 4096 Sep 30 17:59 lang
drwxr-xr-x 2 1000 1000 4096 Sep 30 17:59 templates
drwxr-xr-x 2 1000 1000 4096 Sep 30 17:59 tests
drwxr-xr-x 16 1000 1000 4096 Sep 30 17:59 vendor
I have 1 test file index.html inside the directory /var/www/html and when I browse to localhost in the browser it renders index.html instead of index.php
Nginx is configured correctly because when I copy the files manually into /var/www/html it works. But for some reason I can't mount it using a docker container.
After searching the internet I have no idea what my problem was. But this tutorial fixed it for me: http://geekyplatypus.com/dockerise-your-php-application-with-nginx-and-php7-fpm/

Graphileon InterActor Settings Page not rendering properly on first startup

I am trying to get InterActor Community Edition running on my ubuntu 16.04 machine by following the instructions on this page
http://docs.graphileon.com/interactor/Getting_started/Setup_InterActor/Installation.html
I am fine up to the point I do the docker run...-command.
Also, I have neo4j CE 3.2.5 already running at that time....
When I open the Startpage http://localhost:8000 it shows following
login page
Contrary to the description no settings page is shown.
I also opened it directly by typing localhost:8000/settings in the browser and I got the settings page obviously with missing form-inputs and no styles rendered (compared to picture on installation instruction page)
I thought files were missing, therefore did a docker exec -it interactor /bin/bash to check sources (especially js an css-files) within the running container under the directory /var/www/html/interactor/, seemed to be ok, but i do not know how the permissions have to be set, so here they are in the runing container:
root#ffb64b944023:/var/www/html/interactor# ll
total 168
drwxr-xr-x 21 www-data www-data 4096 Oct 2 18:32 ./
drwxr-xr-x 5 root root 4096 Oct 2 18:32 ../
-rw-r--r-- 1 www-data www-data 446 Sep 6 14:26 .htaccess
-rw-r----- 1 www-data www-data 90804 Sep 6 14:26 INTERACTOR_END_USER_LICENSE_AGREEMENT.pdf
drwxr-x--- 4 www-data www-data 4096 Sep 6 14:27 css/
drwxr-x--- 4 www-data www-data 4096 Sep 6 14:27 dashboard/
-rw-r----- 1 www-data www-data 5430 Jun 21 15:19 favicon.ico
-rw-r--r-- 1 www-data www-data 5738 Sep 6 14:26 favicon.png
drwxr-x--- 2 www-data www-data 4096 Sep 6 14:27 images/
-rw-r--r-- 1 www-data www-data 6929 Sep 6 14:26 index.php
drwxr-x--- 4 www-data www-data 4096 Sep 6 14:27 js/
drwxr-x--- 3 www-data www-data 4096 Oct 1 19:31 persistent/
drwxr-x--- 14 www-data www-data 4096 Sep 6 14:27 php/
drwxr-x--- 2 www-data www-data 4096 Sep 6 14:27 scripts/
drwxr-x--- 11 www-data www-data 4096 Oct 2 18:32 settings/
drwxr-x--- 2 www-data www-data 4096 Sep 6 14:27 templates/
-rw-r----- 1 www-data www-data 98 Sep 6 14:26 version.json
thus I tried to open the linked sources in the pagesource within the browser and got some of the files opened and some not, due to 403-Error.
I wonder if the provided image is somehow misconfigured regarding the permissions or if I am doing something wrong.
The strange thing is that I already had it running after I clicked all of the linked sources in the pagesource and reloaded the settings page.
When I finished playing around in interactor I used a docker stop interactor. neither a docker start interactor nor a docker restart interactor gave me a working interactor-instance back and I cannot get it working anymore...what I am doing wrong?
I can reproduce this issue but so far i cannot find a permanent solution.
The only thing to make it work is to connect to the container:
sudo docker exec -i -t interactor /bin/bash
And the run:
chown www-data:www-data /var/www/html/interactor -R
even if all the files are already set like that.
You have to do this everytime you start the container.
We are working on a fix for this.
Disclaimer: i am a developer for Graphileon.

Docker-compose: no access to Wordpress files

I just tried to host a Wordpress instance using docker on a freshly install Ubuntu machine. My problem is I am not allowed to modify the Wordpress files or create new files - I recieve Permission denied. I am certain that I am missing something - Can somebody explain to me what I am doing wrong?
Here are the commands I've used:
wget -qO- https://get.docker.com/ | sh
sudo usermod -aG docker $(whoami)
*restart*
sudo apt-get -y install python-pip
sudo pip install docker-compose
nano docker-compose.yml (See further down for the content of the file)
docker-compose up
The content of docker-compose.yml
wordpress:
image: wordpress
links:
- wordpress_db:mysql
ports:
- 80:80
volumes:
- ./src:/var/www/html
wordpress_db:
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: ****
ports:
- 3306:3306
phpmyadmin:
image: corbinu/docker-phpmyadmin
links:
- wordpress_db:mysql
ports:
- 8181:80
environment:
MYSQL_USERNAME: root
MYSQL_ROOT_PASSWORD: ****
Here is the contents of ls -la inside the src dir:
total 196
drwxr-xr-x 5 www-data www-data 4096 apr 26 16:24 .
drwxrwxr-x 3 philip philip 4096 apr 26 16:14 ..
-rw-r--r-- 1 www-data www-data 234 apr 26 16:14 .htaccess
-rw-r--r-- 1 www-data www-data 418 sep 25 2013 index.php
-rw-r--r-- 1 www-data www-data 19935 mar 5 21:14 license.txt
-rw-r--r-- 1 www-data www-data 7358 dec 6 19:49 readme.html
-rw-r--r-- 1 www-data www-data 5032 jan 28 04:35 wp-activate.php
drwxr-xr-x 9 www-data www-data 4096 apr 12 20:46 wp-admin
-rw-r--r-- 1 www-data www-data 364 dec 19 12:20 wp-blog-header.php
-rw-r--r-- 1 www-data www-data 1476 jan 30 22:56 wp-comments-post.php
-rw-r--r-- 1 www-data www-data 3233 apr 26 16:24 wp-config.php
-rw-r--r-- 1 www-data www-data 2853 apr 26 16:24 wp-config-sample.php
drwxr-xr-x 4 www-data www-data 4096 apr 26 16:33 wp-content
-rw-r--r-- 1 www-data www-data 3286 maj 24 2015 wp-cron.php
drwxr-xr-x 16 www-data www-data 12288 apr 12 20:46 wp-includes
-rw-r--r-- 1 www-data www-data 2380 okt 25 2013 wp-links-opml.php
-rw-r--r-- 1 www-data www-data 3316 nov 6 00:59 wp-load.php
-rw-r--r-- 1 www-data www-data 33837 mar 6 04:06 wp-login.php
-rw-r--r-- 1 www-data www-data 7887 okt 6 2015 wp-mail.php
-rw-r--r-- 1 www-data www-data 13106 feb 17 23:58 wp-settings.php
-rw-r--r-- 1 www-data www-data 28624 jan 28 04:51 wp-signup.php
-rw-r--r-- 1 www-data www-data 4035 nov 30 2014 wp-trackback.php
-rw-r--r-- 1 www-data www-data 3061 okt 3 2015 xmlrpc.php

jenkins doesn't have rights to copy files - or does it?

I have a strange problem in jenkins, I cannot copy files in a job, however, with the user jenkins on the command line, I can do that without problem.
I am using jenkins on debian running under the user "jenkins".
I added the user "jenkins" to the group "www-data", so that I can copy files to the www-folder of apache.
The folder rights of the target folder look like this:
drwxrwxr-x 9 www-data www-data 4096 Jun 23 16:19 .
drwxrwxr-x 4 www-data www-data 4096 Jun 23 12:45 ..
-rw-rw-r-- 1 volker www-data 368 Jun 23 17:10 about.php
-rw-rw-r-- 1 volker www-data 366 Jun 23 17:10 bio.php
-rw-rw-r-- 1 volker www-data 370 Jun 23 17:10 contact.php
drwxrwxr-x 3 volker www-data 4096 Jun 23 16:19 content
drwxrwxr-x 3 volker www-data 4096 Jun 23 16:19 css
drwxrwxr-x 8 volker www-data 4096 Jun 23 16:19 default
drwxrwxr-x 3 volker www-data 4096 Jun 23 16:19 fonts
drwxrwxr-x 2 volker www-data 4096 Jun 23 13:40 image
drwxrwxr-x 3 volker www-data 4096 Jun 23 16:19 images
-rw-rw-r-- 1 volker www-data 372 Jun 23 17:10 impressum.php
-rw-rw-r-- 1 volker www-data 367 Jun 23 17:10 index.php
-rw-rw-r-- 1 volker www-data 296 Jun 23 13:52 kontakt.php
drwxrwxr-x 3 volker www-data 4096 Jun 23 16:19 layout
-rw-rw-r-- 1 volker www-data 367 Jun 23 17:10 news.php
-rw-rw-r-- 1 volker www-data 370 Jun 23 17:10 termine.php
-rw-rw-r-- 1 volker www-data 369 Jun 23 17:10 videos.php
So everything is writable for group www-data.
If I am using the jenkins user to copy the files in the shell, I get no error:
jenkins#rootserver:~/jobs/deploy_notundellende/workspace$ whoami
jenkins
jenkins#rootserver:~/jobs/deploy_notundellende/workspace$ cp -R * /var/www/nue
jenkins#rootserver:~/jobs/deploy_notundellende/workspace$
But if I use the same command in jenkins itself, it fails with permission error:
pwd
/var/lib/jenkins/jobs/deploy_notundellende/workspace
whoami
jenkins
cp -R about.php bio.php contact.php content css fonts images impressum.php index.php layout news.php termine.php videos.php /var/www/nue
cp: cannot create regular file `/var/www/nue/about.php': Permission denied
cp: cannot create regular file `/var/www/nue/bio.php': Permission denied
cp: cannot create regular file `/var/www/nue/contact.php': Permission denied
cp: cannot create regular file `/var/www/nue/content/videos.php': Permission denied
How is that possible? Does anyone have an idea?
OK, I got it to work, I restarted the jenkins server and it worked. I assume it did not work before, because the jenkins server was already running when I changed its permissions. Makes sense to me now, come to think of it :) Anyway, thanks for anybody reading and thinking about this!
Solution 1: Restart Jenkins
(jenkins_url)/safeRestart - Allows all running jobs to complete. New jobs will remain in the queue to run after the restart is complete.
(jenkins_url)/restart - Forces a restart without waiting for builds to complete.
Solution 2: Check the user and permission for the same user
Check user: whoami
change permission: sudo chmod -R 777 /var/www/html/* or sudo chmod a+rwx /var/szDirectoryName
Solution 3:
If you get error/warning like Linux: 'Username' is not in the sudoers file. This incident will be reported ref the link

Resources