Running composer install not working with Jenkins in a microservices architecture - laravel

I am automating a microservices architecture with a Jenkins pipeline and having this issue although the file composer.json exists in that folder
C:\Program Files
(x86)\Jenkins\workspace\C2Project\C2\autority-service>composer update
Composer could not find a composer.json file in C:\Program Files (x86)\Jenkins\workspace\C2Project\C2\autority-service
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
here is the concerned jenkins stage:
stage('Build autority-service'){ steps { dir('C:\\Program Files (x86)\\Jenkins\\workspace\\C2Project\\C2\\autority-service') {
bat "sudo composer update"
bat "sudo composer dump-autoload"
bat "sudo composer install"
sh "php artisan key:generate"
bat "php artisan cache:clear"
bat "php artisan config:clear"
bat "php artisan migrate"
bat "php artisan db:seed" } } }
Can anyone please help me fix this issue?

I resolved this issue by adding a composer.phar file because Jenkins couldn't recognize the composer.json file as they are similar with this command line curl -sS getcomposer.org/installer | php then installed composer on the Jenkins server using the composer.phar file php composer.phar install

Related

Laravel, Breeze is not generating "Build" folder

Folder image
Even though I have done the following commands,
"php artisan breeze:install
php artisan migrate
npm install
npm run dev"
the build folder is not generating.

Could not open input file: artisan when running php artisan serv

I'm trying to run an existing laravel project in my new windows.
when I try
php artisan serv
in my project directory, it says
Could not open input file: artisan
I even updated composer
how to configure my old project anyway?
Please run proper command on laravel project root directory:
php artisan serve

php artisan storage:link linking wrong directory

I need advice to setup php artisan storage:link in my .ebextensions/setup.config. Currently, after the command being executed my storage folder are linked under path "/var/app/ondeck/storage/app/public" instead of "/var/www/html/storage/app/public". Below are my setup configuration.
06-link_storage:
command: "php artisan storage:link"
cwd: "/var/app/ondeck"
Here's a screenshot of the path linked in one of my instances.
I've also tried changing the path to /var/www/html. However the path link also invalid.
06-link_storage:
command: "php artisan storage:link"
cwd: "/var/www/html"
Any help or advice would mean a lot to me. Thanks.

Php artisan optimize is failing on production server

Running composer install on a production server via a bash script is failing at post-install-cmd php artisan optimize with the error There are no commands defined in the "jwt" namespace.
To try to resolve the issue I added the following commands before php artisan optimize
"php artisan clear-compiled",
"php artisan cache:clear",
"php artisan config:clear",
"php artisan config:cache",
Running composer install locally works fine. I can run the commands through a script locally without a problem.
The failure is happening while running composer install through a script on the production server. If I log onto the server and run the commands manually I do not generate the error.
Not sure how to debug, any ideas?
Try adding a pre-install event inside of your composer.json file on the server, note that this event works only if your composer.lock is present and you ran composer install:
"scripts": {
"pre-install-cmd": [
"php artisan config:clear"
],
...
}

Composer not installing Fork CMS on Windows

I have Windows 10, actual XAMPP and actual Composer.
Fork CMS is under E:\xampp\htdocs\fork. In this directory there is a composer.json file with the following lines:
...
"scripts": {
"post-install-cmd": "php app/console assetic:dump . && cd tools && bash ./remove_cache",
"post-update-cmd": "php app/console assetic:dump . && cd tools && bash ./remove_cache"
},
...
When I run "composer install" in this directory I get the following error:
[RuntimeException] Error Output: Command "bash" is misspelled or not
found (* translated from German)
Anyone has a clue for me? I know that bash is from linux, but I don't know how it can be used in my circumstances. Thanks for any help.
The error is as clear as it can get: There is no bash command available on your machine. This is a very likely error, as Windows systems don't have a bash command.
So the solution is easy to find as well: Install the bash command. Git by windows comes with a bash command for instance. Other solutions are also available.

Resources