Browse Source

a quick start

boyska 8 years ago
commit
7d9c571dd9
5 changed files with 64 additions and 0 deletions
  1. 3 0
      .gitignore
  2. 20 0
      README.md
  3. 3 0
      deploy/deploy.sh
  4. 0 0
      nuovotema/.keepme
  5. 38 0
      testingtoolchain/machinectl.sh

+ 3 - 0
.gitignore

@@ -0,0 +1,3 @@
+config.sh
+.*.sw*
+*~

+ 20 - 0
README.md

@@ -0,0 +1,20 @@
+Cosi di migrazione
+========
+
+Concetto
+----------
+
+Per rendere il tutto più riproducibile possibile, usiamo un container pulito
+ogni volta.
+In teoria ci sono tanti modi di farlo, quindi dentro `testingtoolchain/`
+potremmo supportare vari "backend". In pratica per ora c'è solo `machinectl`.
+Si potrebbe supportare il semplice chroot o un più diretto lxc.
+
+
+Struttura file
+----------------
+
+* `deploy/deploy.sh` --> cosa fare dentro ad una macchina già mezza pronta
+* `nuovotema` --> il nuovo tema!
+* `testingtoolchain/` --> utilità per creare container e cose simili
+* `config.sh` --> file opzionale con cui fare l'override di variabili

+ 3 - 0
deploy/deploy.sh

@@ -0,0 +1,3 @@
+#!/bin/bash
+
+# TODO: drush faituttecose

+ 0 - 0
nuovotema/.keepme


+ 38 - 0
testingtoolchain/machinectl.sh

@@ -0,0 +1,38 @@
+#!/bin/bash
+set -e
+set -u
+set -x
+# questo coso assume che si usa machinectl
+
+# questa macchina e' una debian pulita
+sourcemachine=jessie-amd64-base
+# questa macchina ha alcune cose di base installate/configurate
+# come Apache, PHP, eccetera
+intermediate=wwwd8-base
+testmachine=wwwd8-test-$(date +%y%m%d%H%M%S)
+
+conf="$(dirname $0)/../config.sh"
+[[ -f "$conf" ]]  && . "$conf"
+
+machineexists() {
+	machinectl list-images|awk '{ print $1 }'|egrep -q "^${1}\$"
+}
+
+# intermediate creation END {{{1
+if ! machineexists "$intermediate"; then
+	if ! machineexists "$sourcemachine"; then
+		debootstrap "/var/lib/machines/${sourcemachine}"
+	fi
+	machinectl clone "${sourcemachine}" "${intermediate}"
+fi
+# those are idempotent, so...
+systemd-nspawn --setenv='DEBIAN_FRONTEND=noninteractive' -D "/var/lib/machines/${intermediate}" /usr/bin/apt-get -y install apache2 libapache2-mod-php5 php5-gd mariadb-server
+systemd-nspawn --setenv='DEBIAN_FRONTEND=noninteractive' -D "/var/lib/machines/${intermediate}" /usr/sbin/a2enmod rewrite
+systemd-nspawn --setenv='DEBIAN_FRONTEND=noninteractive' -D "/var/lib/machines/${intermediate}" /usr/sbin/a2enmod php5
+systemd-nspawn --setenv='DEBIAN_FRONTEND=noninteractive' -D "/var/lib/machines/${intermediate}" /bin/mkdir -p /mig
+# intermediate creation END }}}1
+
+machinectl clone "${intermediate}" "${testmachine}"
+systemd-nspawn -D "/var/lib/machines/${testmachine}" --bind-ro="$(readlink -f $(dirname $0)/../):/mig" /mig/deploy/deploy.sh
+
+# vim: set fdm=marker: