Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need basic installation documentation #4

Open
ankitmundra88 opened this issue Jan 31, 2018 · 8 comments
Open

Need basic installation documentation #4

ankitmundra88 opened this issue Jan 31, 2018 · 8 comments

Comments

@ankitmundra88
Copy link

@dlundgren

We are trying to install the phagrancy on Oracle Linux 6. We have been able to host the application but are not able to check whether it is properly running or not.
Can we have a documentation that would provide us with the information on what httpd.conf we would need to host the application correctly.

Also the curl command provided in the readme.md are incorrect. As the httpd is hosted on port 80 and not port 8099.

Having a basic documentation stating what needs to be placed where and what configuration should be done for apache would help a lot.

Thanks for building the application though. :-)

@mclamb
Copy link

mclamb commented Feb 17, 2018

Agreed, this project is exactly what I am looking for but having some issues getting it up and running. I am currently trying to get phagrancy running with the following docker-compose file:

version: '2'

services:
  nginx-php-fpm:
    image: richarvey/nginx-php-fpm:latest
    restart: always
    environment:
      GIT_REPO: 'https://github.com/dlundgren/phagrancy.git'
      WEBROOT: '/var/www/html/web'
      http_proxy: ${http_proxy}
      https_proxy: ${https_proxy}
      no_proxy: ${no_proxy}

The process is not fully automated yet in docker-compose until I can figure out all the steps necessary, but for now, I run the above (docker-compse up) and then docker exec -it <container> /bin/bash in another shell so that I can install php composer, dependency modules, .env, etc:

# Get php composer
cd /root
wget -O composer-setup.php https://getcomposer.org/installer
php composer-setup.php --install-dir=/usr/local/bin --filename=composer

# Install phagrancy dependencies with composer
cd /var/www/html
composer install

# Create sample .env file, I think the "access_password" is the name of the user?
cat > .env <<EOF
storage_path="data/storage"
api_token="mytoken"
access_password="myuser"
EOF

# Create /var/www/html/data/storage (eventually will move this to a persistent docker volume)
mkdir -p data/storage

# Restart php-fpm? Is this necessary?
supervisorctl restart php-fpm

At this point things are running and I can see the web requests in the docker-compose output. If I try something like this within the container shell:

cd /root
# Just create a dummy file that represents a box for now
echo random string > testbox.box
curl -XPUT http://localhost/api/v1/box/myuser/testbox/version/1.0.0/provider/virtualbox/upload --upload-file testbox.box

The request does not seem to work. I get a 404 page back. I was thinking that this should upload that dummy test box into data/storage/myuser/testbox/ or something like that?

Any suggestions would be much appreciated!

Thanks

@dlundgren
Copy link
Owner

@ankitmundra88 I'll take a look at better instructions this week for Apache & Nginx.

@mclamb It looks like the api token is missing from the CURL request. Other than that, make sure that the /var/www/data/storage directory exists, and is owned by the user php-fpm is running as.

Since you are using Nginx you'll need to change client_max_body_size since the default is 1M.

@mclamb
Copy link

mclamb commented Feb 20, 2018

Thanks for the help. I ensured that /var/www/data/storage does exist and tried it with root ownership as well as nginx (root owns the master php-fpm process, nginx owns its worker children)

Is this the correct box upload with the access_token:

curl -XPUT http://localhost/api/v1/box/myuser/testbox/version/1.0.0/provider/virtualbox/upload?access_token=mytoken --upload-file testbox.box

I am still getting a 404 in the logs on the server side:

nginx-php-fpm_1  | 127.0.0.1 - - [20/Feb/2018:04:11:16 +0000] "PUT /api/v1/box/myuser/testbox/version/1.0.0/provider/virtualbox/upload?access_token=mytoken HTTP/1.1" 404 1220 "-" "curl/7.55.0"

Just to be clear, the .env file should exist at the WEBROOT, correct? In my case it is in /var/www/html in the container. I have restarted nginx and php-fpm a number of times as well.

I also tried with an absolute storage_path="/var/www/html/data/storage"

Is there a requirement to do anything prior to uploading the box like this? It seems like the real Vagrant Cloud API requires calls to create the box, version, provider, then a preparation for upload, and finally the upload API call itself (https://www.vagrantup.com/docs/vagrant-cloud/api.html)

Thanks!

@dlundgren
Copy link
Owner

@ankitmundra88 Do these configurations help any? https://github.com/dlundgren/phagrancy/wiki/Web-server-setup

@dlundgren
Copy link
Owner

@mclamb I had to reconfigure the PHP block in the docker image to the following in order to get it to work.

    location ~ [^/]\.php(/|$) {
       	fastcgi_split_path_info ^(.+?\.php)(/.*)$;
       	if (!-f $document_root$fastcgi_script_name) {
   	        return 404;
       	}
        fastcgi_pass unix:/var/run/php-fpm.sock;
       	fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
       	include fastcgi_params;
    }

@syntacticvexation
Copy link
Collaborator

I'm really excited about this project as it looks to provide much better support for really large boxes but I had similar problems getting it working. I have a few suggestions that would make it easier, more than happy to put up a pull request for the wiki.

  1. Have a page at the web root that enables easy confirmation the application has been correctly configured, it currently displays 404 whether working or not.
  2. Update README.md to advise composer has to be installed and composer install run in the installation directory.
  3. Update README.md to advise the php-mbstring package relevant to the installation OS has to be installed. This isn't installed by default with many PHP installations. Without this package, attempts to upload and download files fails with a generic 500 response.
  4. Update README.md to provide troubleshooting instructions or allow a debug flag to be set in the .env to permit Slim errors to be displayed:
    $container = new Slim\Container([ 'settings' => [ 'displayErrorDetails' => true, ], ]);
  5. Provide an example .env or update the README.md to describe the format.
  6. Update the README.md to explicitly describe how the access_password is used (HTTP Basic Auth). This is different to how the access_token is used (GET parameter). Ideally this could also be configured so that a browser displays the Basic Auth prompt (I'm assuming it just needs to return a HTML response based on the Accept: header rather than JSON)

@syntacticvexation
Copy link
Collaborator

I've made a start of some of these things in a forked Wiki here:
https://github.com/syntacticvexation/phagrancy/wiki

@dlundgren
Copy link
Owner

@syntacticvexation I learned how to merge your wiki in. Thanks for writing that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants