opheliadesign's avatar

Envoyer - Best practice for non-Laravel software residing in public directory

Hi all,

I started using Envoyer recently and just ran into an issue. I am using Open VBX, an open source phone system powered by Twilio, which needs to be made publicly accessible in the document root of my site. It is stand alone, not a Composer package or anything like that.

The issue is that when I place its directory in my public directory, every time Envoyer deploys my code it starts from scratch with OpenVBX, deleting all of its settings files. OpenVBX is part of my Git repository but I could upload it via FTP rather than Envoyer, but not sure if this would solve the problem.

I saw in another post that someone moved this type of thing "one level up" and used a symbolic link when deploying, but I'm not quite sure how to go about this.

Any help would be appreciated, thanks!

0 likes
6 replies
opheliadesign's avatar

Bump.. Anyone? Really need to get this sorted. Phone system needs to go up by tomorrow and it isn't possible until we figure this out.

opheliadesign's avatar

And to simplify the question - i need to access the contents of a directory under /public or create a link to a top level directory somehow so that the contents of the vbx directory aren't touched every time I deploy code.

opheliadesign's avatar

Okay so Taylor replied to a support ticket regarding this and suggested placing the thrid party app in the storage folder, then creating a link every deployment.

I'm not terribly familiar with Linux file system commands, my attempt to do this failed. Can someone please explain how to accomplish this linking? I'd really appreciate it.

opheliadesign's avatar

Okay, Taylor helped me out with creating the symlink -

I placed the document root for the app in storage/app/vbx as Taylor suggested. Prior to activating the new release,

cd {{release}}
ln -s /home/eyf/storage/app/vbx public/vbx

This seems to work if I place "test.htm" in the /storage/app/vbx directory and access it via the browser but everything else related to OpenVBX does not work. If I simply go to /vbx I get the Laravel NotFoundException, if I go to `/vbx/index.php it takes me to the main page for my Laravel site. What is going on here??

Here is the .htaccess included with OpenVBX, I'm not sure if it has anything to do with this - but it sounds likely because /vbx/index.php is acting like it's Laravel's index.php

<IfModule mod_alias.c>
    # by default disallow access to the base git folder
    RedirectMatch /\.git(/|$) /404
</IfModule>

# cache images for a while
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/css "access plus 1 month"
    ExpiresByType text/javascript "access plus 1 month"
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/jpg "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
</IfModule>

# compress output if we can
<IfModule mod_deflate.c>
    # Set output filter for zipping content
    SetOutputFilter DEFLATE
    # Netscape 4.x and 4.06-4.08 have issues
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    # MSIE can be an issue, for now catch all MSIE
    BrowserMatch \bMSIE[56] !no-gzip !gzip-only-text/html
    # Exclude file types from compression
    SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|pdf|zip|tar|rar|gz|dmg|mp3|mp4|m4a|m4p|mov|mpe?g|qt|swf)$ no-gzip dont-vary
    # Make sure proxy servers deliver what they're given
    <IfModule mod_headers.c>
        Header append Vary User-Agent env=!dont-vary
    </IfModule>
</IfModule>

<IfModule mod_rewrite.c>
    RewriteEngine ON

    # Set this if you have your installation in a subdirectory
    # RewriteBase /openvbx

    # By default always use SSL
    #RewriteCond %{HTTPS} !=on
    #RewriteRule ^(.*) https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule ^(.*) index.php?vbxsite=$1 [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L,QSA]
    #RewriteRule ^(.*) index.php/$1 [L,QSA]

    ErrorDocument 404 /fallback/rewrite.php
</IfModule>

If I simply add the directory to public/vbx in my Git repository and deploy, everything works as expected. But the issue then is that on the next deployment, everything that OpenVBX installs into its directories gets wiped out - which is why it needs to reside in a directory untouched by Envoyer, such as storage.

Surely I can't be the ONLY one running into issues like this with Envoyer, I'd REALLY appreciate some help from my community. Please? Pretty please? Anything?

opheliadesign's avatar

Okay, another weird issue. If I create a text file in the directory I'm trying to access, say "Hello World" in test.txt, I can access it normally - http://mysite.com/vbx/test.txt. However it seems that any PHP files in this directory aren't accessible and throw the NotFoundHttpException - for example, a simple PHP Hello World in http://mysite.com/vbx/test.php = NotFoundHttpException.

So it basically seems like Laravel is refusing to allow the processing of PHP in this directory as long as it is in /storage/app and just throwing the NotFoundHttpException. This also proves that the directory IS accessible to the outside world. Any thoughts?

opheliadesign's avatar
opheliadesign
OP
Best Answer
Level 9

FINALLY solved this (thanks for all the help). I can only assume that PHP code is not executed if it resides ANYWHERE under /storage. So, when Taylor suggested I place a third party PHP app there, apparently it had no hope of ever actually working.

I moved the third party app to the top level directory of the site and created a symbolic link from the current release directory's public folder to it, now everything works. So many wasted hours for something so simple. Also a bit let down not a single person offered to chime in here. Was my question vague? Should I have just known this all along? Odd how some questions just seem to be totally ignored on this forum. :/

Please or to participate in this conversation.