Answers.Body: <p>From the excellent interactive documentation here -- <a href="https://buildkit.civicrm.org/#/tutorials" rel="nofollow">https://buildkit.civicrm.org/#/tutorials</a> (which is almost impossible to find unless you know where to look):</p>
  
  <pre><code>## Download application (with civibuild)
  civibuild download "mytestbuild" \
    --civi-ver "master" \
    --type "drupal-clean"
  </code></pre>
  
  <p>There are a number of interesting gotchas. For example, civibuild download does not download dependencies for civi, it only downloads civi and the CMS. So you may wish to run composer install and npm install between these two stages. Otherwise, both will be run automatically next.</p>
  
  <p>Then install the DB and the rest of the application:</p>
  
  <pre><code>## Install application (with civibuild)
  civibuild install "mytestbuild" \
    --url "http://localhost:8000" \
    --admin-pass "n0ts3cr3t"
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-13T16:24:10.780Z
Answers.LastActivityDate: 2016-02-13T16:34:50.377Z
Answers.LastEditDate: 2016-02-13T16:34:50.377Z
Answers.UserDisplayName: DMCoding
Body: <p>What madness is this? Sorry for the daft title. Let me explain.</p>
  
  <p>I'm trying to create a docker image for CiviCRM which separates out the web server, database server, and program data itself. In theory, I believe such a container could be very useful to the community. Yes, we have <a href="https://github.com/progressivetech/docker-civicrm-buildkit" rel="noreferrer">several docker images which do this</a>. I even built one myself using the <a href="https://github.com/djcf/civibuild-docker" rel="noreferrer">CiviCRM buildkit</a>. However, none of them really follow the docker principles:</p>
  
  <ul>
  <li>We can't choose our own web servers in separate containers (i.e. they are not composable)</li>
  <li>We can't use standard docker tools for e.g. managing the SQL database (i.e. they do not conform to established principles).</li>
  <li>Some of them do not even install programatically!</li>
  </ul>
  
  <p>So the plan here is actually quite simple but my lack of knowledge of the CiviCRM install process is hampering me a bit. First, we define a docker-compose file which sets up sensible defaults for the SQL serverand web server containers, allowing the user to swap out other ones if they so desire. It also defines a data container which grabs CiviCRM program code in the build stage, then installs the database in the run stage, then quits.</p>
  
  <p>Like this:</p>
  
  <p>docker-compose.yml:</p>
  
  <pre><code>server:
      image: richarvey/nginx-fpm (or any other sensible default)
      container-name: "Civi Webserver"
      volumes-from: app
  db:
      image: mysql
      container-name: "Civi DB"
      volumes-from: app
  app:
      build: app
      container-name: "Civi App"
  </code></pre>
  
  <p>app/Dockerfile</p>
  
  <pre><code>from debian:jessie
  # 1: download the build tool
  RUN curl -Ls https://civicrm.org/get-buildkit.sh | bash -s -- --full --dir /buildkit
  # OR install drush/composer/some other equivalent tool
  
  # 2: download the CiviCRM program code
  RUN /buildkit/bin/civibuild create dmaster --no-init-db /var/www/html
  # OR some other equivalent command using drush etc.
  
  # 3: prepare to initialise the db
  COPY initialize-civicrm-db.sh
  
  # 4: When the container is run it will initialise the database, then quit.
  CMD intialize-civicrm-db.sh
  
  VOLUME /var/www/html
  </code></pre>
  
  <p><strong>To summarise:</strong> I'm looking for a way to install CiviCRM in such a way that the build tool does not also try to install the database. Then I also need a way to install the database without installing the program code.</p>
  
Tags: <installation><civicrm-buildkit><drush>
Title: Install CiviCRM without installing the database. And install the database without installing CiviCRM
ThreadText: # Install CiviCRM without installing the database. And install the database without installing CiviCRM
  
  (Asked by: username_0 on 2016-02-11)
  
  What madness is this? Sorry for the daft title. Let me explain.
  
  I'm trying to create a docker image for CiviCRM which separates out the web server, database server, and program data itself. In theory, I believe such a container could be very useful to the community. Yes, we have [several docker images which do this](https://github.com/progressivetech/docker-civicrm-buildkit). I even built one myself using the [CiviCRM buildkit](https://github.com/djcf/civibuild-docker). However, none of them really follow the docker principles:
  
  * We can't choose our own web servers in separate containers (i.e. they are not composable)
  * We can't use standard docker tools for e.g. managing the SQL database (i.e. they do not conform to established principles).
  * Some of them do not even install programatically!
  
  So the plan here is actually quite simple but my lack of knowledge of the CiviCRM install process is hampering me a bit. First, we define a docker-compose file which sets up sensible defaults for the SQL serverand web server containers, allowing the user to swap out other ones if they so desire. It also defines a data container which grabs CiviCRM program code in the build stage, then installs the database in the run stage, then quits.
  
  Like this:
  
  docker-compose.yml:
  
  ```
  server:
      image: richarvey/nginx-fpm (or any other sensible default)
      container-name: "Civi Webserver"
      volumes-from: app
  db:
      image: mysql
      container-name: "Civi DB"
      volumes-from: app
  app:
      build: app
      container-name: "Civi App"
  
  ```
  
  app/Dockerfile
  
  ```
  from debian:jessie
  # 1: download the build tool
  RUN curl -Ls https://civicrm.org/get-buildkit.sh | bash -s -- --full --dir /buildkit
  # OR install drush/composer/some other equivalent tool
  
  # 2: download the CiviCRM program code
  RUN /buildkit/bin/civibuild create dmaster --no-init-db /var/www/html
  # OR some other equivalent command using drush etc.
  
  # 3: prepare to initialise the db
  COPY initialize-civicrm-db.sh
  
  # 4: When the container is run it will initialise the database, then quit.
  CMD intialize-civicrm-db.sh
  
  VOLUME /var/www/html
  
  ```
  
  **To summarise:** I'm looking for a way to install CiviCRM in such a way that the build tool does not also try to install the database. Then I also need a way to install the database without installing the program code.
  
  **Tags:** installation, civicrm-buildkit, drush
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2016-02-13. Score: 3 | Accepted answer
  
  From the excellent interactive documentation here -- <https://buildkit.civicrm.org/#/tutorials> (which is almost impossible to find unless you know where to look):
  
  ```
  ## Download application (with civibuild)
  civibuild download "mytestbuild" \
    --civi-ver "master" \
    --type "drupal-clean"
  
  ```
  
  There are a number of interesting gotchas. For example, civibuild download does not download dependencies for civi, it only downloads civi and the CMS. So you may wish to run composer install and npm install between these two stages. Otherwise, both will be run automatically next.
  
  Then install the DB and the rest of the application:
  
  ```
  ## Install application (with civibuild)
  civibuild install "mytestbuild" \
    --url "http://localhost:8000" \
    --admin-pass "n0ts3cr3t"
  
  ```
  
  
  ---
  
  