SOLVED Problems with deployment GIT Laravel

n212

Registered
Mar 25, 2021
2
0
1
NL
cPanel Access Level
Website Owner
Hello. I currently use Laravel (PHP framework) for my website and at the moment I made it so that there is a symlink from my public_html into my public folder from Laravel in my custom app folder, which is located in /home/myusername/app/public. App is the root from my application, app/public is the public folder from Laravel where index.php is, .git is in the /app root folder.

I already made it so that git version control works, I'm able to pull from that panel fine, the only part that doesn't work is the deployment and gives me a message on there The system cannot deploy.

My .cpanel.yml is as follows:


Code:
---
deployment:
  tasks:
    - export DEPLOYPATH=/home/username/app/
    - /bin/cp -R app $DEPLOYPATH
    - /bin/cp -R bootstrap  $DEPLOYPATH
    - /bin/cp -R config  $DEPLOYPATH
    - /bin/cp -R database  $DEPLOYPATH
    - /bin/cp -R public  $DEPLOYPATH
    - /bin/cp -R resources  $DEPLOYPATH
    - /bin/cp -R routes  $DEPLOYPATH
    - /bin/cp -R storage $DEPLOYPATH
    - /bin/cp -R tests $DEPLOYPATH
    # - /bin/cp /home/vlexvzko/app/package.json
    # - /bin/cp /home/vlexvzko/app/composer.json
    # - /bin/cp /home/vlexvzko/app/composer.lock
    # - /bin/cp /home/vlexvzko/app/webpack.mix.js
Is this the correct way to auto deploy changes to my Laravel application? Thank you for any help!
 
Last edited by a moderator:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
4,251
534
273
cPanel Access Level
Root Administrator
Hey there! I'm wondering if there is an issue with the path as /home/username/app in the DEPLOYPATH setting may end up giving you the result of /home/username/app/app once deployed. Can you check that and see if adjusting that makes a difference?
 
  • Like
Reactions: n212

n212

Registered
Mar 25, 2021
2
0
1
NL
cPanel Access Level
Website Owner
Hi I just managed to fix it. I made a repository path inside cpanel, put the .cpanel.yml in there and now it deploys to my app folder. Do you know if this is possible to do via github instead of my local cpanel repository. That would be ideal
 

ThiagoOrtega

Registered
Apr 6, 2021
2
1
1
Brasil
cPanel Access Level
Root Administrator
Sorry to invade your post @n212 , but I saw that you are already using laravel, would you know how to guide me?

Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException
The GET method is not supported for this route. Supported methods: POST.

we have a problem with the application running on our server (which is shared).
the Laravel version is 8, but the views are made on the blade, with few things in ajax.

the situation: the first time I deployed, I put Laravel in a folder at the root of the server (a directory above the default public_html folder). and then I removed the public_html folder and created a symbolic link to the Laravel public folder (I also had the correct permissions on the Laravel folder, storage and files, all as the tutorial said). in the login form, when done, there was an error saying that the route did not accept the GET method, only POST; it turns out that I was using POST (with csrf in the form and everything), but something, I don't know if in the way I structured the folders or other configuration, there was a kind of redirection and the method was changed. from what I realized the script doesn't even reach the controller layer, the error happens before.

After much research, I found an apparent solution: I put the application inside the standard public_html folder, and in that public_html folder I used a .htaccess that redirected to Laravel's public folder; being .htaccess:

Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?dominio.com.br$
RewriteCond %{REQUEST_URI} !^/laravel/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /laravel/public/$1
RewriteCond %{HTTP_HOST} ^(www.)?dominio.com.br$
RewriteRule ^(/)?$ laravel/public/index.php [L]
doing so the application worked correctly, but only with HTTP. when I switched to running with HTTPS, the same previous problem happened again.
I have already researched a lot and found few people with the same error, but no concrete solution; remembering that it works correctly locally and with HTTP, so it's not as simple as a basic route error.
I also tried to force HTTPS via code and via cpanel, but it also didn't work.


Att
Thank you
 
Last edited:

ThiagoOrtega

Registered
Apr 6, 2021
2
1
1
Brasil
cPanel Access Level
Root Administrator
@ThiagoOrtega - you can tag other users by using the @ in front of their name to get their attention if you'd like, but hopefully they will provide more details about their configuration as this isn't something that cPanel natively supports.

Sorted out! The application was not letting use /admin after I changed the post's name it worked correctly.
 
  • Like
Reactions: cPRex