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

docker-compose exec -u buildkit civicrm civibuild create dmaster fails #63

Open
zoobab opened this issue Feb 10, 2021 · 8 comments
Open

Comments

@zoobab
Copy link

zoobab commented Feb 10, 2021

Hey,

Juts following the instructions, but the create dmaster fails:

$ docker-compose exec -u buildkit civicrm civibuild create dmaster
[[Download dmaster (type 'drupal-demo' in '/buildkit/build/dmaster')]]
[[Update caches]]
remote: Enumerating objects: 16, done.
remote: Counting objects: 100% (16/16), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 17 (delta 10), reused 12 (delta 10), pack-reused 1
Unpacking objects: 100% (17/17), done.
From https://github.com/civicrm/civicrm-core
   df8b072401..83a10ad53e  5.35       -> 5.35
   10efdb7609..06e3452557  master     -> master
remote: Enumerating objects: 15, done.
remote: Counting objects: 100% (15/15), done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 15 (delta 0), reused 15 (delta 0), pack-reused 0
Unpacking objects: 100% (15/15), done.
From https://github.com/civicrm/civivolunteer
 * [new tag]         v1.3.3     -> v1.3.3
 * [new tag]         v1.4.0     -> v1.4.0
 * [new tag]         v1.4.1     -> v1.4.1
 * [new tag]         v2.0.0     -> v2.0.0
 * [new tag]         v2.0.1     -> v2.0.1
 * [new tag]         v2.0.2     -> v2.0.2
 * [new tag]         v2.1.0     -> v2.1.0
 * [new tag]         v2.1.1     -> v2.1.1
 * [new tag]         v2.1.2     -> v2.1.2
 * [new tag]         v2.2.0     -> v2.2.0
 * [new tag]         v2.2.1     -> v2.2.1
 * [new tag]         v2.2.2     -> v2.2.2
 * [new tag]         v2.2.3     -> v2.2.3
 * [new tag]         v2.3.0     -> v2.3.0
 * [new tag]         v2.3.1     -> v2.3.1
[[Execute /buildkit/app/config/drupal-demo/download.sh]]
++ source /buildkit/app/config/drupal-demo/download.sh
+++ '[' -z '' ']'
+++ CMS_VERSION=7.x
+++ '[' -z master ']'
+++ '[' -z '' ']'
+++ NG_PRFL_VERSION=master
+++ '[' -z '' ']'
+++ RULES_VERSION=master
+++ '[' -z master ']'
+++ drupal_download
+++ cvutil_assertvars drupal_download WEB_ROOT CMS_VERSION PRJDIR
+++ _cvutil_assertvars_back=ehxB
+++ set +x
+++ mkdir /buildkit/build/dmaster
mkdir: cannot create directory '/buildkit/build/dmaster': Permission denied

Any idea?

@michaelmcandrew
Copy link
Owner

What OS are you using? Any sudoing going on?

It should just work.

Probably worth trying again in a fresh directory and see if that fixes it - shouldn't take too long.

@peterkmurphy
Copy link

peterkmurphy commented Oct 11, 2021

I got the same issue. I think the problem here is that the owner of the build directory created by the process appears to be root. (Yes, I am the peter user.)

drwxrwxr-x  8 peter peter  4096 Oct 11 09:09 .
drwxrwxr-x 12 peter peter  4096 Oct 11 09:05 ..
drwxr-xr-x  2 root  root   4096 Oct 11 09:09 build
drwxrwxr-x  2 peter peter  4096 Oct 11 09:05 civicrm
-rw-rw-r--  1 peter peter  1274 Oct 11 09:05 docker-compose-build.yml
-rw-rw-r--  1 peter peter  1166 Oct 11 09:05 docker-compose.yml
drwxrwxr-x  2 peter peter  4096 Oct 11 09:05 extra
drwxrwxr-x  8 peter peter  4096 Oct 11 09:05 .git
-rw-rw-r--  1 peter peter    48 Oct 11 09:05 .gitignore
-rw-rw-r--  1 peter peter 34523 Oct 11 09:05 LICENSE
drwxrwxr-x  4 peter peter  4096 Oct 11 09:05 publish
-rw-rw-r--  1 peter peter  9555 Oct 11 09:05 README.md
drwxrwxr-x  2 peter peter  4096 Oct 11 09:05 .vscode

Once I changed the ownership of the build directory to peter:peter, the process worked.

@michaelmcandrew
Copy link
Owner

Thanks for the extra info @peterkmurphy - your diagnosis and work around sounds right.

Just trying to think about how we can solve this in an elegant way. I was assuming that /buildkit/build on the container was owned by the civicrm user, which would map to user 1000 but I see that it isn't.

Will have a think about how to solve this. In the mean time, that workaround makes sense.

@wmortada
Copy link
Contributor

wmortada commented Oct 13, 2021

I've just had the same issue and raised it https://lab.3sd.io/tools/civicrm-buildkit-docker/-/issues/65

I think the answer is simply to include the build directory in the repo. See https://lab.3sd.io/tools/civicrm-buildkit-docker/-/merge_requests/65

I also used the same workaround as @peterkmurphy

@michaelmcandrew
Copy link
Owner

Unfortunatley, that won't work @wmortada

We need the build directory to be populated from the container because it is not empty (it has a .amp directory in it). Some alternative approaches:

  • reengineer buildkit so that the build directory is empty (upstream issue). This probably just means moving whatever is in /buildkit/build/.amp to somewhere else and configuring .amp to look for it there.
  • ensure that we set the ownership of buildkit/build and everything below it to the buildkit user and group when the container is started (easier, and, I think reasonable, though I think it would be good to avoid changing file permissions if we don't need to, and I am not sure if it would solve 100% it would change the ownership on the host). We could do that in docker-civicrm-entrypoint.

@hyperion14
Copy link

hyperion14 commented Apr 25, 2022

unfortunatly, it doesn´t work! I Got this error message: can´t install
_my system:
Ubuntu 22.04 LTS docker michaelmcandrew/civicrm-buildkit-docker :latest

+++ drush site-install -y --db-url=mysql://dmastercms_imjof:ZSGjTBvrwdBlpwDI@mysql:3306/dmastercms_h32ty --account-name=admin --account-pass=zQ6bT4hn9A37 --account-mail=[email protected] '--site-name=CiviCRM Sandbox on Drupal' --sites-subdir=default
Command site-install needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to run this command. [error]
The drush command 'site-install' could not be executed. [error]

@awestuk
Copy link

awestuk commented Apr 7, 2023

The build folder is created on this COPY command. Stack Exchange says that Docker always runs COPY as root, for whatever reason. Fix is:

COPY --chown=buildkit:buildkit apache24-vhost.php /buildkit/build/.amp/apache24-vhost.php

Any objections to that? Seems to work ok.

Wait no, I see I'm at cross purposes. I'll keep poking at it...

@michaelmcandrew
Copy link
Owner

Hey @awestuk - was on holiday last week but back this week. Let me know if you want to discuss in more detail. Also, we have moved this repo to here: https://lab.civicrm.org/michaelmcandrew/civicrm-buildkit-docker. Feel free to submit issues there.

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

No branches or pull requests

6 participants