Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

laradock how to use gitlab webhook? #1360

Closed
linzi007 opened this issue Jan 23, 2018 · 6 comments
Closed

laradock how to use gitlab webhook? #1360

linzi007 opened this issue Jan 23, 2018 · 6 comments
Labels

Comments

@linzi007
Copy link

Info:

  • Docker version ($ docker --version): 17.12.0-ce, build c97c6d6
  • Laradock commit ($ git rev-parse HEAD): 0077de2
  • System info (Mac, PC, Linux): PC
  • System info disto/version: win10 pro

Issue:

I want to use a webhook to auto deploy, then i do:

First, run docker up:

docker-compose up -d nginx redis mysql

Second, add webhook in my gitlab project

point to laravel website http://example.com/deploy/

Third, laravel add router and Controller

// web.php
Route::post('/deploy', 'DeployController@index')->name('deploy');

// DeployController
//........
$result = shell_exec("/usr/bin/git pull");
logger('success result: ' . $result);
//.........

And it doesn't work, the command 'git pull' no run.

I found some error on container php-fpm
[22-Jan-2018 07:46:46] WARNING: [pool www] child 7 said into stderr: "sh: 1: /usr/bin/git: not found"


Expected behavior:

What shoud i do in laradock ?
Git has install in laradock_workspace_1, Should i install it again?


@ed-fruty
Copy link
Contributor

  1. Links to your message, git is not installed on the php-fpm container. Why do you check/search it in the workspace container? In your case you need it in the php-fpm container .
  2. To execute external processes I suggest to use symfony process component
  3. For deploy by hook you can use ready utils, like jenkins, team city or another one. By the way, jenkins container is already exists in the laradock.

@stale
Copy link

stale bot commented Feb 2, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Stale label Feb 2, 2020
@stale
Copy link

stale bot commented Feb 23, 2020

Hi again 👋 we would like to inform you that this issue has been automatically closed 🔒 because it had not recent activity during the stale period. We really really appreciate your contributions, and looking forward for more in the future 🎈.

@stale stale bot closed this as completed Feb 23, 2020
@glebgoloborodko
Copy link

Problem still exist!

When I run with Symfony process component bash script with "git" - I see an error : "git not found". While Symfony process my user = "www-data" and group = "www-data"

But it's strange, because when I go to workspace container with user "www-data" git command exists in /usr/bin/git...

Somehow from Symfony process or from Artisan::call "git" not exists... But user the same! =(

@jtomek
Copy link

jtomek commented Sep 24, 2020

I'm having the same issue, it's something with the php-fpm

If you look inside the PHP-FPM container docker exec -it <DOCKER_PHP-FPM_ID> /bin/sh it's possible to navigate to /usr/bin/ but not /usr/bin/git

How can I add git to PHP-FPM? Or how can I make git visible (its visible from other containers in laradock)?

@jtomek
Copy link

jtomek commented Sep 25, 2020

I just figured it out.... There are multiple gits in those containers. I was setting the permissions on the wrong ones.

You need to run the following command in your php-fpm container:

Get inside of your container like this:

docker-compose exec --user=root php-fpm bash

And run the following command:

apt-get update && apt-get install -y git

I haven't figured out how to automate this via the Dockerfile though.

I tried adding

RUN apt-get update && apt-get install -y git

This command installs git and I can use git during the docker-compose build, but it doesn't stick after the build.

Edit: Style and grammar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants