diff options
author | Hansjürg Wenger <hansjuerg.wenger@bfh.ch> | 2020-12-15 16:20:32 +0100 |
---|---|---|
committer | Hansjürg Wenger <hansjuerg.wenger@bfh.ch> | 2020-12-15 16:20:32 +0100 |
commit | 0a6377bc9b5759b285f8956cb4137518f950a4b0 (patch) | |
tree | 70d8a89a8968c127af88be3dd04055c4c63236be | |
parent | 746cb52490670340d2d5af2a734324c1aee466cd (diff) | |
download | woocommerce-taler-0a6377bc9b5759b285f8956cb4137518f950a4b0.tar.gz woocommerce-taler-0a6377bc9b5759b285f8956cb4137518f950a4b0.tar.bz2 woocommerce-taler-0a6377bc9b5759b285f8956cb4137518f950a4b0.zip |
modified simple build
-rwxr-xr-x | server-build/QEMU-autobuild/buildReclaim.sh | 4 | ||||
-rw-r--r-- | server-build/my-simple-cdd/00-README | 67 | ||||
-rwxr-xr-x | server-build/my-simple-cdd/01-make-iso.sh (renamed from server-build/my-simple-cdd/make-iso.sh) | 16 | ||||
-rwxr-xr-x | server-build/my-simple-cdd/02-setup-system.sh | 34 | ||||
-rwxr-xr-x | server-build/my-simple-cdd/03-run-system.sh | 18 | ||||
-rw-r--r-- | server-build/my-simple-cdd/README | 76 | ||||
-rwxr-xr-x | server-build/my-simple-cdd/profiles/wootaler.postinst | 12 | ||||
-rwxr-xr-x | server-build/my-simple-cdd/run-system.sh | 7 | ||||
-rwxr-xr-x | server-build/my-simple-cdd/setup-system.sh | 13 |
9 files changed, 145 insertions, 102 deletions
diff --git a/server-build/QEMU-autobuild/buildReclaim.sh b/server-build/QEMU-autobuild/buildReclaim.sh index d039db0..746a939 100755 --- a/server-build/QEMU-autobuild/buildReclaim.sh +++ b/server-build/QEMU-autobuild/buildReclaim.sh @@ -16,7 +16,7 @@ SHOP_ZONE=wootaler-shop OIDC_SCOPE="openid given_name family_name email address phone" # URL where GNUnet REST service is listening for requests -GNUNET_REST="http://localhost:7776/openid/" +GNUNET_REST="http://localhost:7776/openid" ## END configuration @@ -156,7 +156,7 @@ sudo -u www-data wp --user=admin option patch update openid_connect_generic_sett sudo -u www-data wp --user=admin option patch update openid_connect_generic_settings identity_key "sub" < /dev/null sudo -u www-data wp --user=admin option patch update openid_connect_generic_settings no_sslverify "1" < /dev/null sudo -u www-data wp --user=admin option patch update openid_connect_generic_settings nickname_key "sub" < /dev/null -sudo -u www-data wp --user=admin option patch update openid_connect_generic_settings displayname_format "{given_name} {full_name}" < /dev/null +sudo -u www-data wp --user=admin option patch update openid_connect_generic_settings displayname_format "{given_name} {family_name}" < /dev/null sudo -u www-data wp --user=admin option patch update openid_connect_generic_settings identify_with_username "1" < /dev/null sudo -u www-data wp --user=admin option patch update openid_connect_generic_settings enable_logging "1" < /dev/null sudo -u www-data wp --user=admin option patch update openid_connect_generic_settings redirect_user_back "1" < /dev/null diff --git a/server-build/my-simple-cdd/00-README b/server-build/my-simple-cdd/00-README new file mode 100644 index 0000000..ed9d0ae --- /dev/null +++ b/server-build/my-simple-cdd/00-README @@ -0,0 +1,67 @@ +This directory contains some scripts and associated files to +create a Debian image with a WooCommerce+Taler installation. + +We use simple-cdd to non-interactively run the Debian installer, +and have a profile 'talerwoo' with WooCommerce and Taler-specific +specifications. + +Dependencies: +============= + +* debian-archive-keyring +* qemu, qemu-system, qemu-kvm +* xorriso +* bsdtar +* simple-cdd + +Make sure the user using the scripts is in the 'kvm' group. +The scripts are only written for AMD64/x86_64 CPUs. + + +How to use: +=========== + +First run: + +$ ./01-make-iso.sh + +to create the "installer.iso". + +Then run: + +$ ./02-setup-system.sh + +to run the Debian installer to create the 'talerwoo.img'. +wait until the script is done, this takes approx. 15-20 minutes! + +Next, boot the final image using: + +$ ./03-run-system.sh + +You now MUST set up WooCommerce defaults. + +To do this: + +a. Log into the WooTaler site in your host system at http://127.0.0.1:9999/wp-admin/ + (as "admin" with passphrase "admin-pass") + +b. Navigate to http://127.0.0.1:9999/wp-admin/admin.php?page=wc-admin and go through + the annoying WooCommerce setup wizard (Note that many options are enabled by default, + and you have to turn them off.)' + +c. Change the currency to KUDOS to make it work with the demo backend (or change the backend)' + +d. Go into the Wordpress configuration for the OIDC plugin (which is NOT under WooCommerce, + but under WordPress settings), and click "safe" (no need to actually change options). + +Finally, login (as "root") with password "wootaler": + +$ ssh -F ./ssh.cfg localhost + +and run + +# yes | /usr/local/bin/deploy-reclaim.sh + +inside the VM. + +When this is done, your setup is ready! diff --git a/server-build/my-simple-cdd/make-iso.sh b/server-build/my-simple-cdd/01-make-iso.sh index f24c6fe..241af11 100755 --- a/server-build/my-simple-cdd/make-iso.sh +++ b/server-build/my-simple-cdd/01-make-iso.sh @@ -15,10 +15,22 @@ set -eu +ISO=installer.iso + +if [ -f $ISO ] +then + echo "Confirm removal of existing '$ISO' by pressing 'y':" + rm -i $ISO + if [ -f $ISO ] + then + echo "'$ISO' already exists, exiting..." + exit 0 + fi +fi + # Will create images/debian-10-amd64-CD-1.iso export KERNEL_PARAMS="preseed/file=/cdrom/simple-cdd/default.preseed locale=en_US.UTF-8 keymap=us language=en country=US" - build-simple-cdd --verbose --profiles wootaler --auto-profiles wootaler --dist buster # Use shell variable, in case the above changes in the future... @@ -48,7 +60,7 @@ cp iso/txt.cfg cd/isolinux/ # Finally, pack the ISO # Extract header from original ISO dd if=$IMG bs=1 count=432 of=isohdpfx.bin -xorriso -as mkisofs -o installer.iso -isohybrid-mbr isohdpfx.bin -c isolinux/boot.cat -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table ./cd +xorriso -as mkisofs -o $ISO -isohybrid-mbr isohdpfx.bin -c isolinux/boot.cat -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table ./cd # Delete temporary files rm isohdpfx.bin -r cd/ diff --git a/server-build/my-simple-cdd/02-setup-system.sh b/server-build/my-simple-cdd/02-setup-system.sh new file mode 100755 index 0000000..5d89a54 --- /dev/null +++ b/server-build/my-simple-cdd/02-setup-system.sh @@ -0,0 +1,34 @@ +#!/bin/sh +# Run QEMU with the installer.iso image (created via make-iso.sh) to +# create a system image "talerwoo.img". +# + +TARGET=talerwoo.img + +if [ -f $TARGET ] +then + echo "Confirm removal of existing $TARGET by pressing \"y\":" + rm -i $TARGET + if [ -f $TARGET ] + then + echo "proceed with installation (see 00-README)" + exit 0 + fi +fi + +# Create target image file. Note: Debian has a minimum +# size for automatic partitioning >= 10G these days! +qemu-img create -q -f qcow2 $TARGET 32G > /dev/null 2>&1 + +echo "installing system - please be patient (approx. 5-10 minutes)!" + +qemu-system-x86_64 -m 4G -enable-kvm -hda $TARGET \ + -cdrom installer.iso -display none > /dev/null 2>&1 + +echo "run system (first run) - please be patient (approx 10-15 minutes)!" + +qemu-system-x86_64 -m 4G -enable-kvm -net nic,model=rtl8139 \ + -net user,hostfwd=tcp::2222-:22,hostfwd=tcp::7776-:7776,hostfwd=tcp::9999-:80 \ + -hda $TARGET -display none > /dev/null 2>&1 + +echo "proceed with installation (see 00-README)" diff --git a/server-build/my-simple-cdd/03-run-system.sh b/server-build/my-simple-cdd/03-run-system.sh new file mode 100755 index 0000000..da4cf78 --- /dev/null +++ b/server-build/my-simple-cdd/03-run-system.sh @@ -0,0 +1,18 @@ +#!/bin/sh +# Run QEMU with the talerwoo.img (create via setup-system.sh) + +TARGET=talerwoo.img + +echo "start the system.." +# Run qemu +qemu-system-x86_64 -m 4G -enable-kvm -net nic,model=rtl8139 \ + -net user,hostfwd=tcp::2222-:22,hostfwd=tcp::7776-:7776,hostfwd=tcp::9999-:80 \ + -display none -hda $TARGET > /dev/null 2>&1 & + +echo ".. and wait some time until it is ready!" +# wait for system to boot up +sleep 15 + +# login as root +echo "now login as 'root'" +ssh -F ./ssh.cfg localhost diff --git a/server-build/my-simple-cdd/README b/server-build/my-simple-cdd/README deleted file mode 100644 index 496d6cf..0000000 --- a/server-build/my-simple-cdd/README +++ /dev/null @@ -1,76 +0,0 @@ -This directory contains some scripts and associated files to -create a Debian qcow2 image with a WooCommerce+Taler installation. - -We use simple-cdd to non-interactively run the Debian installer, -and have a profile 'talerwoo' with WooCommerce and Taler-specific -specifications. - -Dependencies: -============= - -* debian-archive-keyring -* qemu, qemu-system, qemu-kvm -* xorriso -* bsdtar -* simple-cdd - -Make sure the user using the scripts is in the 'kvm' group. -The scripts are only written for AMD64/x86_64 CPUs. - - -How to use: -=========== - -First run: - -$ ./make-iso.sh - -to create the "installer.iso". Then run: - -$ ./setup-system.sh - -to run the Debian installer to create the 'talerwoo.img'. - -Before booting, make sure that your system is setup to -route packages and performs NAT for the VM (otherwise -the installation script that runs on first startup -will fail): - -$ sudo echo 1 > /proc/sys/net/ipv4/ip_forward -$ sudo iptables -t nat -A POSTROUTING -o wlp3s0 -j MASQUERADE - - -Next, boot the final image using: - -$ ./run-system.sh - -The 'root' password will be set to 'wootaler' initially. - -The 'admin' password for WooCommerce (running on port 9999) -will be 'admin-pass'. - -Upon first boot, you need to wait for a bit for the systemd -service firstboot-wootaler.service to complete. You may -want to check the logs: - -# journalctl -u firstboot-wootaler.service - -If the script fails due to say network errors, you -should be able to simply re-run it using: - -# firstboot-script.sh - -(it will also re-run on each boot until it has -succeeded). - -You now MUST set up WooCommerce defaults. To do this: -a. Log into the WooTaler site in your host system at 127.0.0.1:9999/wp-admin/. as "admin" with passphrase "admin-pass" -b. Navigate to 127.0.0.1:9999/wp-admin/admin.php?page=wc-setup and go through the annoying WooCommerce setup wizard (Note that many options are enabled by default, and you have to turn them off.)' -c. Change the currency to KUDOS to make it work with the demo backend (or change the backend)' -d. Go into the Wordpress configuration for the OIDC plugin (which is NOT under WooCommerce, but under WordPress settings), and click "safe" (no need to actually change options). - -Finally, run: - -# yes | /usr/local/bin/deploy-reclaim.sh - -as root inside the VM. diff --git a/server-build/my-simple-cdd/profiles/wootaler.postinst b/server-build/my-simple-cdd/profiles/wootaler.postinst index 27342f5..9d36093 100755 --- a/server-build/my-simple-cdd/profiles/wootaler.postinst +++ b/server-build/my-simple-cdd/profiles/wootaler.postinst @@ -23,6 +23,12 @@ set -eu echo "Giving system time to complete setup" sleep 60 +echo "Enable root login with password" + +# Permit root login with passwd +echo "PermitRootLogin yes" >> /etc/ssh/sshd_config +systemctl restart sshd + echo "## Launching WooCommerce-Taler installation ##" cd /root @@ -49,8 +55,10 @@ cp /root/woocommerce-taler/server-build/QEMU-autobuild/buildReclaim.sh /usr/loca # Remove self from boot sequence rm /etc/systemd/system/firstboot-wootaler.service -echo "Postinstall script done" -exit 0 +echo "Postinstall script done, shutdown system" + +shutdown -h now "firstboot installation done, shutdown system" + EOF chmod +x /usr/local/bin/firstboot-script.sh diff --git a/server-build/my-simple-cdd/run-system.sh b/server-build/my-simple-cdd/run-system.sh deleted file mode 100755 index 23f5fca..0000000 --- a/server-build/my-simple-cdd/run-system.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -# Run QEMU with the talerwoo.img (create via setup-system.sh) - -IMAGE=talerwoo.img - -# Run qemu -qemu-system-x86_64 -m 4G -enable-kvm -net nic,model=rtl8139 -net user,hostfwd=tcp::9999-:80 -hda $IMAGE diff --git a/server-build/my-simple-cdd/setup-system.sh b/server-build/my-simple-cdd/setup-system.sh deleted file mode 100755 index bbc6b0c..0000000 --- a/server-build/my-simple-cdd/setup-system.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -# Run QEMU with the installer.iso image (created via make-iso.sh) to -# create a system image "talerwoo.img". -# - -TARGET=talerwoo.img -rm -f $TARGET - -# Create target image file. Note: Debian has a minimum -# size for automatic partitioning >= 10G these days! -qemu-img create -f qcow2 $TARGET 32G - -qemu-system-x86_64 -m 4G -enable-kvm -hda $TARGET -cdrom installer.iso |