dijkr / Copia

Laravel-project with CMS
0 stars 0 forks source link

Laravel deployment struggles #30

Open dijkr opened 11 months ago

dijkr commented 11 months ago

Routes --> Apache config

<Directory "/var/www/html/Copia-master">
    AllowOverride All
    # Allow open access:
    Require all granted
</Directory>

Database

Dependencies Install Composer Install npm Build npm / vite

CMS The asset-container does not contain images. When upload, they still won't be display in the view.

Selinux Blocks parts of the website, of when new items are added. Needs to configured properly.

dijkr commented 11 months ago

Database / controller Above steps actually made the website available without errors. https://github.com/dijkr/Copia/issues/29 still is a issue, since the homepage / home needs data or it won't load. That problem is seperated from this one.

dijkr commented 11 months ago

Database The foreign key issue still needs to be resolved, since they should be set when running a migration I guess?

dijkr commented 11 months ago

Update Is had to do with the license. Its not allowed to run a production server without a paid pro-license. Also it seems the .env file need the actual IP, and not local host. Not sure tho, but its solved.

CMS Upload images to the CMS and test if they display correctly within the view.

The CMS loads imagaes from this location @ deployment server: <img src="http://localhost/storage/banner_food.jpeg"/>

Development server: <img src="/images/banners/banner_food.jpeg">

This is weird, because with this, I need to add /images to the view at the deployment server, but not at the development server.

dijkr commented 11 months ago

Change this to improve a deployment: Also upload the asset container of the CMS to Github. What location?

/public/build
/public/hot
/public/storage

Also check locations like /storage. Some folders has a .gitignore file stored in it.

dijkr commented 11 months ago

With the third deployment, everything went smooth, except npm run build was not allowed to run, because there was a problem with the permissions for Vite. It was solved by reinstalling npm.

rm node_modules/ -rf
npm install
dijkr commented 11 months ago

With Red Hat @ Azure, the user need sudo. That is an issue with composer. Its possible with sudo. Daarnaast is er een versie mismatch. Development server (Alma Linux 9.1) node v16.18.1 en RHEL 8 node v10.24.0

The solution was to install v16: dnf module list nodejs dnf module install nodejs:16/common

dijkr commented 11 months ago

Selinux This will configure Selinux, so it won't block content anymore: chcon -R -t httpd_sys_rw_content_t /var/www/html/copia.nl setsebool httpd_can_network_connect 1 setsebool -P httpd_can_network_connect_db on

dijkr commented 6 months ago

Now testing with premade httpd.conf, what still needs work is:

Update: Vite is failing with installing, so npm run build fail, need to run the code to avoid a 500 error rm node_modules/ -rf npm install npm run build

dijkr commented 6 months ago

Files to pack to the git-download