Dockerize existing Laravel vs creating new projects + copy files - php

I am struggling with new Dockervel environment on Monterey. Before going further, I would like to have some general advice.
Before Monterey (on Mojave), I use HomeBrew and Composer to create Laravel projects and adding dependencies. I have 10 existing projects like that.
After doing a clean install of Monterey, I decided to go for Docker. I successfully created a new project and also installed phpMyAdmin (into 2 containers mysql & phpmyadmin).
Now I need to move these 10 "old" Laravel projects from my backup to Docker on Monterey.
So I moved the first old project and dockerized it but ran into version issues which I assume I might be able to fix (I have another post specifically on these issues).
Is it the best way to do this to upgrade the 10 old projects to Docker? I presume that at the end I will have 10 containers (one for each project) plus the 2 php/phpMyAdmin. Will I be able to have several docker containers running at the same time and be able to view them in the browser as localhost/project1, localhost/project2... and so on?
I also tried to install a new project and copy all the specific files into it from the backup but that is very cumbersome. Is that an option?
Is there another easier solution?

Related

How to include a Project from a server into a Laravel sail docker image

I am totally new to PHP / Laravel / Linux / composer / docker etc.
However I do have the task: go retrieve some code files from an internal server and make a docker container out of it. The project is written in PHP 7.1.3 and uses the Laravel framework.
I've copied the whole https folder from the server which I think contains everything I need.
I also was able to create the example app from the Laravel documentation and also I made a brand new Laravel project. However, is there any chance to "generate" a new project using all the code files I have right now?
I even have a composer.json and composer.lock file, which in my opinion should "list" every component I would need in my docker installation, right?
What also bugs me is that I can't even get the project working on my dev machine...
I think you should do this step by step. But let me first answer some of your questions.
If "https" folder contains similar folder structure like fresh Laravel installation, it is likely to be all of it. But we can not be sure about it.
As far as i know there is no way to generate new project out of your files. First of all you need to know which Laravel version project uses. It must be stated at composer.json.
In you composer.json file lists required packages for you project. When you install them this packages are installed folder called vendor
Here is my suggestions;
As you stated it seems you are very new about these topics if someone give these task to you its not a smart way to teach this kind of topics.
I think you have to start with running project in your local machine. If you get errors than ask them in a new question. Most likely you need database and you need to know running migrations seeds etc.
When you manage to run the project you can start dockerizing your project. If your project is build with newer versions of laravel you can easly use sail otherwise you can build own dockerfile or upgrade laravel to newer versions.
Your problem is too broad, i think you cannot find answers to such question.

How to move laravel projevt from Wamp to lamp centoS 7

I need to move existing laravel 5 project to linux centos 7. I'm going to install lamp, copy source files and database backup and move them to new centos 7 server. Is there anything I should take into account? I moved a lot of pure PHP webpages but never laravel projects. Help appreciated :)
You should pay attention to the following:
PHP and mysql version. Laravel 5 tends to break with certain PHP versions
Having document root as /public folder
Make sure to have the bootstrap and the storage folders writable
Make sure to clean the cache upon migration

Laravel Docker For Mac Very Slowly [duplicate]

This question already has answers here:
Docker in MacOs is very slow
(9 answers)
Closed 2 years ago.
I am following this tutorial (https://tighten.co/blog/converting-a-legacy-app-to-laravel/) to migrate a legacy app to Laravel and have made it as far as the "Spring Cleaning" section. My legacy code is in a legacy directory inside my Laravel build.
Our development environment uses Docker Compose to build a container on the host machine (which in my case is a Mac but can be either Windows or Linux as well depending on the developer). The source code is in a volume mounted to the container so that the developer's updates can be seen in the browser as soon as the developer reloads the page.
When I go to get Laravel to load it's default route (the basic route that Laravel builds with) I get page load times in excess of 6 minutes.
I have tried using cached volumes like so: ./:/var/www/portal/:cached
I have also tried following this tutorial (https://www.jeffgeerling.com/blog/2020/revisiting-docker-macs-performance-nfs-volumes) for using an NFS mount. I got it working but the page load size was still over 6 minutes for the default page.
What is causing this extremely slow page-load time? How are Dockerized Laravel Development Environments supposed to be structured to avoid this issue with Docker's VM on Mac and Windows?
I didn't have this problem when developing just in the legacy app. I'm not inclined to think that Laravel itself is causing so large a slowdown. My thought is that it is the Docker VM running on Mac but I haven't been able to prove that yet.
Docker on OS X is just slow. Newer Docker versions have improved this.
Are you actually deploying this Dockerized? If not, consider just using artisan serve.

How to set up React-Laravel project with out php artisan serve?

I have created a react-laravel project using laravel-mix. Right now I am run project using
npm run watch
php artisan serve
So by this, I access project by : http://localhost:8000
I have also worked in laravel. In laravel, if we want to access project without php artisan serve then we can access using : http://localhost/project_name/public.
Now my question is, how can I access/execute react-laravel project without php artisan serve? Is there any kind of way to access/execute project without port? Because I want to set up react-laravel on live server and I don't want to continue open terminal on server after code uploading.
I will really appreciate your feedbacks.
There are a multitude of ways to set up a laravel project. and it has nothing to do with the frontend suite you use whether its React or Vue, I will give you 2 options here to run a laravel application.
1. vagrant/homestead
Laravel Homestead is an official, pre-packaged Vagrant box that provides you a wonderful development environment without requiring you to install PHP, a web server, and any other server software on your local machine. No more worrying about messing up your operating system! Vagrant boxes are completely disposable. If something goes wrong, you can destroy and re-create the box in minutes!
Doc Link
2. XAMPP/WAMP/ or any LAMP stack
XAMPP is a completely free, easy to install Apache distribution containing MariaDB, PHP, and Perl. The XAMPP open source package has been set up to be incredibly easy to install and to use.
Link
Personally I prefer Laravel Homestead since it contains everything out of the box for laravel Development. like PHP, Nginx, MariaDB, Node, etc...

What files and folders to copy when moving Laravel Project

I'm kinda still finding my way around the Laravel development framework. I want to use a Sample Project Here for my learning
Now the project was done in Laravel 5 and i'm trying to use the Latest 5.5 Laravel.
How do i go about this and what files and folders do i have to copy to my Laravel 5.5 project to get this working.
The file and code structure has changed quite a lot from Laravel 5.0 to Laravel 5.5.
If you are wanting to use that project on Laravel 5.5 then you would need to go through the update process for each version until you reached Laravel 5.5. These can all be found in the Laravel documentation for the respective version.
An easy, and better approach, would just be to incorporate this into your project manually.
SB Admin is just a theme based on Bootstrap and so you can just incorporate it into your app as you would Bootstrap.
You can download the source for SB Admin here - https://startbootstrap.com/template-overviews/sb-admin/
You can also check out the source on GitHub if you need more of an idea on how to use it on specific pages - https://github.com/BlackrockDigital/startbootstrap-sb-admin
If you really want to use that project to learn Laravel then you can. As you're still new to Laravel, I wouldn't bother updating it (you'd likely be in over your head).
To get started with the project, just follow the instructions on their repo - https://github.com/start-laravel/sb-admin-laravel-5:
Clone the project git clone https://github.com/start-laravel/sb-admin-laravel-5.git
Switch into the newly created folder
composer install to install Laravel and the required dependencies
npm install
bower install

Categories