michaelmcandrew / civicrm-buildkit-docker

This is a read only copy. Please make PRs here: https://lab.civicrm.org/michaelmcandrew/civicrm-buildkit-docker
https://lab.civicrm.org/michaelmcandrew/civicrm-buildkit-docker
GNU Affero General Public License v3.0
40 stars 31 forks source link

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

Open zoobab opened 3 years ago

zoobab commented 3 years ago

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 commented 3 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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:

hyperion14 commented 2 years ago

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=admin@example.com '--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 commented 1 year ago

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 commented 1 year ago

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.