diff --git a/how-to/How-To-Setup-Nc-Env-In-Ubuntu-Desktop.md b/how-to/How-To-Setup-Nc-Env-In-Ubuntu-Desktop.md index f78c689..e3dcc26 100644 --- a/how-to/How-To-Setup-Nc-Env-In-Ubuntu-Desktop.md +++ b/how-to/How-To-Setup-Nc-Env-In-Ubuntu-Desktop.md @@ -18,9 +18,9 @@ | Component |Version | |----------------|----------------------------------| |Operating System|Ubuntu 22.04 LTS (Jammy Jellyfish)| -|LXD |5.1 | -|vagrant |2.2.19 | -|vagrant-lxd |0.5.6 | +|LXD |5.10 | +|vagrant |2.3.4 | +|vagrant-lxd |0.6.0 | ## Procedure @@ -50,8 +50,8 @@ ``` $ snap list lxd -Name Version Rev Tracking Publisher Notes -lxd 5.0.0-b0287c1 22923 latest/stable canonical✓ - +Name Version Rev Tracking Publisher Notes +lxd 5.10-b392610 24323 latest/stable canonical✓ - ``` @@ -75,27 +75,21 @@ ``` $ sudo zpool --version -zfs-0.8.3-1ubuntu12.13 -zfs-kmod-2.0.6-1ubuntu2.1 +zfs-2.1.4-0ubuntu0.1 +zfs-kmod-2.1.4-0ubuntu0.1 ``` ### Vagrant Installation -Install the curl package: +From the official [installation documentation page](https://developer.hashicorp.com/vagrant/downloads): + ``` -$ sudo apt install curl -``` - -Get the signing key and the Vagrant official repository address in the local APT sources: - -``` -$ sudo curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add - -OK -$ sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" +$ wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg +$ echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list $ sudo apt update -``` +``` Install the vagrant package: ``` @@ -107,7 +101,7 @@ ``` $ vagrant --version -Vagrant 2.2.19 +Vagrant 2.3.4 ``` @@ -136,7 +130,7 @@ ``` $ vagrant plugin list -vagrant-lxd (0.5.6, global) +vagrant-lxd (0.6.0, global) ``` As recommended in the vagrant-lxd documentation ([here](https://gitlab.com/catalyst-it/devtools/vagrant-lxd#synced-folders)), to ensure synced folders work as expected, run the following commands: @@ -148,28 +142,16 @@ ### Mkcert Installation -Download from [the official repository](https://github.com/FiloSottile/mkcert/releases) the latest released binary of mkcert, an utility that makes it easy to create locally trusted TLS certificates: +Install mkcert, an utility that makes it easy to create locally trusted TLS certificates, from APT repositories ``` -$ wget https://github.com/FiloSottile/mkcert/releases/download/v1.4.4/mkcert-v1.4.4-linux-amd64 -``` - -Rename the mkcert binary by stripping the version: - -``` -$ mv mkcert-v1.4.4-linux-amd64 mkcert -``` - -Make it executable: - -``` -$ chmod +x mkcert +$ sudo apt install mkcert ``` Run the install command ``` -$ ./mkcert -install +$ mkcert -install Created a new local CA 💥 The local CA is now installed in the system trust store! ⚡️ ``` @@ -177,9 +159,11 @@ Check the local CAROOT folder by issuing the following command. We will need to make the files in that folder available to the containers as well: ``` -$ ./mkcert -CAROOT +$ mkcert -CAROOT ``` +It should be under `${HOME}/.local/share/mkcert` + ### Nc-env Installation Pick the latest release of the project from [here](https://codeberg.org/pmarini/nc-env/releases), in this example `v20220421`: diff --git a/templates/template00-clean-server/Vagrantfile b/templates/template00-clean-server/Vagrantfile index 7bb5363..77f1ec0 100644 --- a/templates/template00-clean-server/Vagrantfile +++ b/templates/template00-clean-server/Vagrantfile @@ -12,7 +12,7 @@ lxd.api_endpoint = 'https://127.0.0.1:8443' lxd.timeout = 10 lxd.name = 'your-container-name' - lxd.project = ['default'] + lxd.project = 'default' lxd.profiles = ['default'] # lxd.nesting = nil # lxd.privileged = nil @@ -24,4 +24,3 @@ config.vm.provision :shell, path: "provision.sh" end - diff --git a/templates/template01-nextcloud-standalone/Readme.md b/templates/template01-nextcloud-standalone/Readme.md index bebaa45..09606b6 100644 --- a/templates/template01-nextcloud-standalone/Readme.md +++ b/templates/template01-nextcloud-standalone/Readme.md @@ -3,7 +3,7 @@ #### Setup * Assuming that the copy of the template is called `nc-instance`, move to folder `nc-instance`. -* Check the content of folder `artifacts` +* Check the content of folder `artifacts`: |File name | Description| | --- | --- | @@ -17,12 +17,11 @@ | `rootCA.pem` | The rootCA previously created in your host machine | | `rootCA-key.pem` | The rootCA key previously created in your host machine | - +* Open `Vagrantfile` and fill in the values of the following parameters: + * `lxd.name`: The name of the container (it is recommended to give the same name as the folder, in this example `nc-instance`. + * `MACHINE_HOSTNAME`: The hostname of the container (it is recommended to give the same name as the folder, plus the domain, in this example `nc-instance.localenv.com`. + * `NEXTCLOUD_INSTALLER_ARCHIVE`: The name of the installer archive you are using. * Create folder `log` -* Open `Vagrantfile` and change the value of variable `lxd.name`. It makes sense to give the same name as the folder, in this example `nc-instance`. -* Open `provision.sh` - * change the value of variable `MACHINE_HOSTNAME`. It makes sense to give the same name as the folder, plus the domain, in this example `nc-instance.localenv.com`. - * change the value of variable `NEXTCLOUD_INSTALLER_ARCHIVE` to match the name of the installer archive you are using. * Run `vagrant up > log/provisioning.log` -* Make sure your system is able to resolve the domain name that you specified in variable `MACHINE_HOSTNAME`, for example by adding an entry in `/etc/hosts` +* Make sure your system is able to resolve the domain name that you specified in variable `MACHINE_HOSTNAME`, for example by adding an entry in `/etc/hosts` or configure LXD nameserver * Start using your environment diff --git a/templates/template01-nextcloud-standalone/Vagrantfile b/templates/template01-nextcloud-standalone/Vagrantfile index 8091bec..a8fcc51 100644 --- a/templates/template01-nextcloud-standalone/Vagrantfile +++ b/templates/template01-nextcloud-standalone/Vagrantfile @@ -4,14 +4,16 @@ Vagrant.configure("2") do |config| - config.vm.box = "isc/lxc-ubuntu-22.04" + config.vm.box = "isc/forge-clt-ubuntu-22.04" + + config.vm.box_version = "1" config.vm.box_check_update = false config.vm.provider 'lxd' do |lxd| lxd.api_endpoint = 'https://127.0.0.1:8443' lxd.timeout = 10 - lxd.name = 'your-container-name' + lxd.name = '' lxd.project = 'default' lxd.profiles = ['default'] # lxd.nesting = nil @@ -21,7 +23,12 @@ # lxd.config = {} end - config.vm.provision :shell, path: "provision.sh" - + config.vm.provision "shell" do |s| + s.env = { + "MACHINE_HOSTNAME" => "", + "NEXTCLOUD_INSTALLER_ARCHIVE" => "" + } + s.path = "provision.sh" + end end diff --git a/templates/template01-nextcloud-standalone/artifacts/crontab-www-data b/templates/template01-nextcloud-standalone/artifacts/crontab-www-data new file mode 100644 index 0000000..0666fa0 --- /dev/null +++ b/templates/template01-nextcloud-standalone/artifacts/crontab-www-data @@ -0,0 +1 @@ +*/5 * * * * php -f /var/www/nextcloud/cron.php diff --git a/templates/template01-nextcloud-standalone/artifacts/nc-fulltext-live-indexer.service b/templates/template01-nextcloud-standalone/artifacts/nc-fulltext-live-indexer.service index 5cd49fa..e7b8335 100644 --- a/templates/template01-nextcloud-standalone/artifacts/nc-fulltext-live-indexer.service +++ b/templates/template01-nextcloud-standalone/artifacts/nc-fulltext-live-indexer.service @@ -9,6 +9,7 @@ User=www-data Group=www-data WorkingDirectory=/var/www/nextcloud +ExecStartPre=/usr/bin/php /var/www/nextcloud/occ fulltextsearch:stop ExecStart=/usr/bin/php /var/www/nextcloud/occ fulltextsearch:live -q ExecStop=/usr/bin/php /var/www/nextcloud/occ fulltextsearch:stop Nice=19 diff --git a/templates/template01-nextcloud-standalone/provision.sh b/templates/template01-nextcloud-standalone/provision.sh index 525ec80..6a8e604 100644 --- a/templates/template01-nextcloud-standalone/provision.sh +++ b/templates/template01-nextcloud-standalone/provision.sh @@ -6,17 +6,6 @@ echo "provisioning started: ${start_time}" -#### The user must fill these variables - START - -# Fully Qualified Name: ex. "nc.localenv.com" -MACHINE_HOSTNAME= - -# Nextcloud Installer name (format tar.bz2): ex. "nextcloud-X.Y.Z.tar.bz2" -# If using a version older that 24, change also the parameter PHP_VERSION -NEXTCLOUD_INSTALLER_ARCHIVE= - -#### The user must fill these variables - END - ## NC<24 => PHP=7.4 ## NC>=24 => PHP=8.1 OR PHP=7.4 ## https://www.linuxcapable.com/how-to-install-php-7-4-on-ubuntu-22-04-lts/ @@ -42,13 +31,6 @@ ##################################################################### ip_address=`ip -4 addr show ${NETWORK_INTERFACE} | grep -oP '(?<=inet\s)\d+(\.\d+){3}'` -adduser --disabled-password --gecos GECOS ${NEXTCLOUD_USER} - -usermod -p "`openssl passwd -1 -salt 5RPVAd ${NEXTCLOUD_USER}`" ${NEXTCLOUD_USER} - -adduser ${NEXTCLOUD_USER} sudo - - ## Install Nextcloud: https://docs.nextcloud.com/server/stable/admin_manual/installation/example_ubuntu.html ##### @@ -250,14 +232,20 @@ occ config:system:set filelocking.enabled --value 'true' +occ config:app:set backgroundjob backgroundjobs_name --value="cron" + +occ app:disable recommendations + +occ config:app:set text workspace_available --value=0 + echo "END - Tweaking some Nextcloud settings" systemctl restart apache2 systemctl status apache2 -## Adding system user to www-data group (to ease command line operations) -adduser ${NEXTCLOUD_USER} www-data +## Install crontab for www-data for Nextcloud Background jobs +crontab -u www-data /vagrant/artifacts/crontab-www-data echo "START - Cleanup" @@ -269,11 +257,9 @@ echo "This container has IP (interface: ${NETWORK_INTERFACE}): ${ip_address}" -echo "If you add this IP to the hostname (${MACHINE_HOSTNAME}) in your hosts file:" +echo "If you add this IP to the hostname (${MACHINE_HOSTNAME}) in your hosts file or configure LXD DNS," -echo " You can connect with user ${NEXTCLOUD_USER} via ssh (password ${NEXTCLOUD_USER}): ssh ${NEXTCLOUD_USER}@${MACHINE_HOSTNAME}" - -echo " You can connect to this Nextcloud instance with the following URL: https://${MACHINE_HOSTNAME}" +echo "you can connect to this Nextcloud instance with the following URL: https://${MACHINE_HOSTNAME}" echo "provisioning started: ${start_time}" diff --git a/templates/template02-collabora-online/Readme.md b/templates/template02-collabora-online/Readme.md index b471d76..d6b8bb9 100644 --- a/templates/template02-collabora-online/Readme.md +++ b/templates/template02-collabora-online/Readme.md @@ -17,8 +17,11 @@ * Create folder `log` -* Open `Vagrantfile` and change the value of variable `lxd.name`. It makes sense to give the same name as the folder, in this example `collabora-instance`. -* Open `provision.sh` and change the value of variable `MACHINE_HOSTNAME`, `CO_VERSION` and `CUSTOMER_HASH`. For `MACHINE_HOSTNAME`, it makes sense to give the same name as the folder, plus the domain, in this example `collabora-instance.localenv.com`. +* Open `Vagrantfile` and assign values to the following parameters or variables: + * `lxd.name` (it is recommended to give the same name as the folder, in this example `collabora-instance`) + * `MACHINE_HOSTNAME` + * `CO_VERSION` + * `CUSTOMER_HASH` (only for Enterprise Edition) * Run `vagrant up > log/provisioning.log` -* Make sure your system is able to resolve the domain name that you specified in variable `MACHINE_HOSTNAME`, for example by adding an entry in `/etc/hosts` +* Make sure your system is able to resolve the domain name that you specified in variable `MACHINE_HOSTNAME`, for example by adding an entry in `/etc/hosts` or configure a nameserver in LXD * Start using your environment diff --git a/templates/template02-collabora-online/Vagrantfile b/templates/template02-collabora-online/Vagrantfile index 61de529..c9c2253 100644 --- a/templates/template02-collabora-online/Vagrantfile +++ b/templates/template02-collabora-online/Vagrantfile @@ -4,14 +4,16 @@ Vagrant.configure("2") do |config| - config.vm.box = "isc/lxc-ubuntu-22.04" + config.vm.box = "isc/forge-clt-ubuntu-22.04" + + config.vm.box_version = "1" config.vm.box_check_update = false config.vm.provider 'lxd' do |lxd| lxd.api_endpoint = 'https://127.0.0.1:8443' lxd.timeout = 10 - lxd.name = 'your-container-name' + lxd.name = '' lxd.project = 'default' lxd.profiles = ['default'] # lxd.nesting = nil @@ -22,7 +24,15 @@ # lxd.config = {} end - config.vm.provision :shell, path: "provision.sh" + config.vm.provision "shell" do |s| + s.env = { + "MACHINE_HOSTNAME" => "", + "CO_VERSION" => "", + "CUSTOMER_HASH" => "" + } + s.path = "provision.sh" + end + end diff --git a/templates/template02-collabora-online/artifacts/coolwsd.xml b/templates/template02-collabora-online/artifacts/coolwsd.xml index 7a494f4..f5c9d1e 100644 --- a/templates/template02-collabora-online/artifacts/coolwsd.xml +++ b/templates/template02-collabora-online/artifacts/coolwsd.xml @@ -7,131 +7,6 @@ - de_DE en_GB en_US es_ES fr_FR it nl pt_BR pt_PT ru - - - - - - - - - - - 1 - - 4 - 5 - - false - 96 - 3600 - - - 30 - 300 - false - 0 - 8000 - 0 - 0 - 100 - 100 - - 10000 - 60 - 300 - 3072 - 85 - 120 - - - - - 120 - 900 - - - - - - true - - warning - notice - fatal - false - - -INFO-WARN - - - /var/log/coolwsd.log - never - timestamp - true - 10 days - 10 - true - false - - - false - 82589933 - - - - - - /var/log/coolwsd.trace.json - - - false - - - - - - - - false - - - - - - all - any - - - - 192\.168\.[0-9]{1,3}\.[0-9]{1,3} - ::ffff:192\.168\.[0-9]{1,3}\.[0-9]{1,3} - 127\.0\.0\.1 - ::ffff:127\.0\.0\.1 - ::1 - 172\.17\.[0-9]{1,3}\.[0-9]{1,3} - ::ffff:172\.17\.[0-9]{1,3}\.[0-9]{1,3} - 10\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} - ::ffff:10\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} - - - - - - - - true @@ -150,34 +25,6 @@ - - true - - false - 1800 - false - 1 - false - - - - - - - - - true - false - - - - - default - - @@ -203,27 +50,6 @@ - true - - true - false - - - - - - - - - - - - - - - - - diff --git a/templates/template02-collabora-online/provision.sh b/templates/template02-collabora-online/provision.sh index d168f34..45be837 100644 --- a/templates/template02-collabora-online/provision.sh +++ b/templates/template02-collabora-online/provision.sh @@ -6,22 +6,6 @@ echo "provisioning started: ${start_time}" -############################### -#### The user must fill these variables - START -############################### -# Fully Qualified Name -MACHINE_HOSTNAME= - -## Collabora Online Version -CO_VERSION= - -## Customer Hash as obtained from Collabora. If left -## empty, CODE will be installed -CUSTOMER_HASH= - -############################## -#### The user must fill these variables - END -############################## OS_VERSION=ubuntu2204 COLLABORA_USER=usrv @@ -42,12 +26,6 @@ ##################################################################### ip_address=`ip -4 addr show ${NETWORK_INTERFACE} | grep -oP '(?<=inet\s)\d+(\.\d+){3}'` -adduser --disabled-password --gecos GECOS ${COLLABORA_USER} - -usermod -p "`openssl passwd -1 -salt 5RPVAd ${COLLABORA_USER}`" ${COLLABORA_USER} - -adduser ${COLLABORA_USER} sudo - ## How-To: Setting up and configuring native CODE packages on Linux ## https://www.collaboraoffice.com/code/linux-packages/ @@ -74,7 +52,7 @@ if [ "${CUSTOMER_HASH}" == "" ]; then apt install -y coolwsd code-brand else - apt install -y coolwsd collabora-online-brand + apt install -y coolwsd collabora-online-brand nextcloud-office-brand fi export CAROOT=/vagrant/artifacts/ @@ -104,11 +82,9 @@ echo "This container has IP (interface: ${NETWORK_INTERFACE}): ${ip_address}" -echo "If you add this IP to the hostname (${MACHINE_HOSTNAME}) in your hosts file:" +echo "If you add this IP to the hostname (${MACHINE_HOSTNAME}) in your hosts file or enable LXD DNS," -echo " You can connect with user ${COLLABORA_USER} via ssh (password ${COLLABORA_USER}): ssh ${COLLABORA_USER}@${MACHINE_HOSTNAME}" - -echo " Your Collabora Server instance is accessible via the following URL: https://${MACHINE_HOSTNAME}:443" +echo "your Collabora Server instance is accessible via the following URL: https://${MACHINE_HOSTNAME}" echo "provisioning started: ${start_time}" diff --git a/templates/template03-keycloak/Readme.md b/templates/template03-keycloak/Readme.md index 0cbfe59..249f681 100644 --- a/templates/template03-keycloak/Readme.md +++ b/templates/template03-keycloak/Readme.md @@ -7,16 +7,19 @@ |File name | Description| | --- | --- | -| `keycloak-X.Y.Z.zip` | The installer archive to be downloaded from [here](https://www.keycloak.org/downloads.html) - Distribution powered by Quarkus | +| `keycloak-X.Y.Z.tar.gz` | The installer archive to be downloaded from [here](https://www.keycloak.org/downloads.html) - Distribution powered by Quarkus | | `keycloak.service` | The systemd unit file for Keycloak service | | `rootCA.pem` | The rootCA previously created in your host machine | | `rootCA-key.pem` | The rootCA key previously created in your host machine | | `keycloak-env.conf` | The environment file for the systemd service | | `keycloak.conf` | The Keycloak configuration file || + +* Open `Vagrantfile` and a value to the following variables and parameters: + * `lxd.name` (it is recommended to give the same name as the folder, in this example `keycloak-instance`) + * `MACHINE_HOSTNAME` + * `KEYCLOAK_VERSION` * Create folder `log` -* Open `Vagrantfile` and change the value of variable `lxd.name`. It makes sense to give the same name as the folder, in this example `keycloak-instance`. -* Open `provision.sh` and change the value of variable `MACHINE_HOSTNAME`. It makes sense to give the same name as the folder, plus the domain, in this example `keycloak-instance.localenv.com`. * Run `vagrant up > log/provisioning.log` -* Make sure your system is able to resolve the domain name that you specified in variable `MACHINE_HOSTNAME`, for example by adding an entry in `/etc/hosts` +* Make sure your system is able to resolve the domain name that you specified in variable `MACHINE_HOSTNAME`, for example by adding an entry in `/etc/hosts` or setting up the LXD nameserver * Start using your environment diff --git a/templates/template03-keycloak/Vagrantfile b/templates/template03-keycloak/Vagrantfile index 1df9726..f42d1c0 100644 --- a/templates/template03-keycloak/Vagrantfile +++ b/templates/template03-keycloak/Vagrantfile @@ -3,23 +3,35 @@ Vagrant.configure("2") do |config| + + config.vm.box = "isc/forge-clt-ubuntu-22.04" - config.vm.box = "isc/lxc-ubuntu-22.04" + config.vm.box_version = "1" + + config.vm.box_check_update = false config.vm.provider 'lxd' do |lxd| lxd.api_endpoint = 'https://127.0.0.1:8443' lxd.timeout = 10 - lxd.name = 'your-container-name' - lxd.profiles = ['default'] + lxd.name = '' lxd.project = 'default' + lxd.profiles = ['default'] # lxd.nesting = nil # lxd.privileged = nil - # lxd.ephemeral = false + # lxd.ephemeral = false + # lxd.profiles = ['default'] # lxd.environment = {} # lxd.config = {} end - config.vm.provision :shell, path: "provision.sh" + config.vm.provision "shell" do |s| + s.env = { + "MACHINE_HOSTNAME" => "", + "KEYCLOAK_VERSION" => "" + } + s.path = "provision.sh" + end + end diff --git a/templates/template03-keycloak/artifacts/keycloak.service b/templates/template03-keycloak/artifacts/keycloak.service index 8111327..c6b541d 100644 --- a/templates/template03-keycloak/artifacts/keycloak.service +++ b/templates/template03-keycloak/artifacts/keycloak.service @@ -6,9 +6,9 @@ [Service] EnvironmentFile=-/etc/keycloak/keycloak-env.conf -User=#KEYCLOAK_USER# +User=root -Group=#KEYCLOAK_USER# +Group=root ExecStart=/opt/keycloak/bin/kc.sh start-dev diff --git a/templates/template03-keycloak/provision.sh b/templates/template03-keycloak/provision.sh index 4254833..3c09252 100644 --- a/templates/template03-keycloak/provision.sh +++ b/templates/template03-keycloak/provision.sh @@ -6,17 +6,6 @@ echo "provisioning started: ${start_time}" -#### The user must fill these variables - START - -MACHINE_HOSTNAME= - -KEYCLOAK_VERSION= - -#### The user must fill these variables - END - -KEYCLOAK_USER=kck - - KEYCLOAK_INSTALLER_VERSION=keycloak-${KEYCLOAK_VERSION} NETWORK_INTERFACE=eth0 @@ -35,24 +24,16 @@ ##################################################################### ip_address=`ip -4 addr show ${NETWORK_INTERFACE} | grep -oP '(?<=inet\s)\d+(\.\d+){3}'` -adduser --disabled-password --gecos GECOS ${KEYCLOAK_USER} - -usermod -p "`openssl passwd -1 -salt 5RPVAd ${KEYCLOAK_USER}`" ${KEYCLOAK_USER} - -adduser ${KEYCLOAK_USER} sudo - apt update -apt install -y openjdk-11-jdk unzip mkcert +apt install -y openjdk-11-jdk mkcert -unzip /vagrant/artifacts/${KEYCLOAK_INSTALLER_VERSION}.zip +tar -xf /vagrant/artifacts/${KEYCLOAK_INSTALLER_VERSION}.tar.gz mv ${KEYCLOAK_INSTALLER_VERSION} /opt - ln -s /opt/${KEYCLOAK_INSTALLER_VERSION} /opt/keycloak +ln -s /opt/${KEYCLOAK_INSTALLER_VERSION} /opt/keycloak -chown -R kck.kck /opt/${KEYCLOAK_INSTALLER_VERSION} - mkdir /etc/keycloak cp /vagrant/artifacts/keycloak-env.conf /etc/keycloak/keycloak-env.conf @@ -71,7 +52,7 @@ mkcert --cert-file /opt/keycloak/conf/server-crt.pem --key-file /opt/keycloak/conf/server-key.pem "${MACHINE_HOSTNAME}" -chown kck.kck /opt/keycloak/conf/server-crt.pem /opt/keycloak/conf/server-key.pem + systemctl daemon-reload systemctl enable keycloak @@ -86,8 +67,6 @@ echo "If you add this IP to the hostname (${MACHINE_HOSTNAME}) in your hosts file:" -echo " You can connect with user ${KEYCLOAK_USER} via ssh (password ${KEYCLOAK_USER}): ssh ${KEYCLOAK_USER}@${MACHINE_HOSTNAME}" - echo " Your Keycloak Server instance is accessible via the following URL: https://${MACHINE_HOSTNAME}:8443" echo " The admin panel is accessible with user 'admin' and password 'admin'" diff --git a/templates/template04-ldap/.vagrant/machines/default/lxd/action_provision b/templates/template04-ldap/.vagrant/machines/default/lxd/action_provision deleted file mode 100644 index fdb9451..0000000 --- a/templates/template04-ldap/.vagrant/machines/default/lxd/action_provision +++ /dev/null @@ -1 +0,0 @@ -1.5:test-ldap-server \ No newline at end of file diff --git a/templates/template04-ldap/.vagrant/machines/default/lxd/box_meta b/templates/template04-ldap/.vagrant/machines/default/lxd/box_meta deleted file mode 100644 index 2074f9f..0000000 --- a/templates/template04-ldap/.vagrant/machines/default/lxd/box_meta +++ /dev/null @@ -1 +0,0 @@ -{"name":"hibox/focal64","version":"1.0.1619509541","provider":"lxc","directory":"boxes/hibox-VAGRANTSLASH-focal64/1.0.1619509541/lxc"} \ No newline at end of file diff --git a/templates/template04-ldap/.vagrant/machines/default/lxd/creator_uid b/templates/template04-ldap/.vagrant/machines/default/lxd/creator_uid deleted file mode 100644 index e37d32a..0000000 --- a/templates/template04-ldap/.vagrant/machines/default/lxd/creator_uid +++ /dev/null @@ -1 +0,0 @@ -1000 \ No newline at end of file diff --git a/templates/template04-ldap/.vagrant/machines/default/lxd/id b/templates/template04-ldap/.vagrant/machines/default/lxd/id deleted file mode 100644 index 95d91d1..0000000 --- a/templates/template04-ldap/.vagrant/machines/default/lxd/id +++ /dev/null @@ -1 +0,0 @@ -test-ldap-server \ No newline at end of file diff --git a/templates/template04-ldap/.vagrant/machines/default/lxd/index_uuid b/templates/template04-ldap/.vagrant/machines/default/lxd/index_uuid deleted file mode 100644 index 7649355..0000000 --- a/templates/template04-ldap/.vagrant/machines/default/lxd/index_uuid +++ /dev/null @@ -1 +0,0 @@ -25b1bb9842654902900e9add1a7877aa \ No newline at end of file diff --git a/templates/template04-ldap/.vagrant/machines/default/lxd/private_key b/templates/template04-ldap/.vagrant/machines/default/lxd/private_key deleted file mode 100644 index ddb5855..0000000 --- a/templates/template04-ldap/.vagrant/machines/default/lxd/private_key +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEogIBAAKCAQEA9HrOm+9g3OXS5nyW41jFFyD/5WKj1VQvIZfnf7sdJXlPDO7W -/a8OzhCZfksnNfMO+V4cja7WHfFQ5zT+m9wlpwSOxu5W56g5+98Onl5uureJOMVJ -YdY7lf7XRJUgfu810BktQjTHl4wmFLFoh81iekeVF0PsAfsqLM9JFZLy/lkGJMpd -8HWLAqGAuE1U7/gBEihsWndMVRmAuh7nSCz8jXrdYpo/mlnakBLIZ/EPpp8wTj91 -9bANsiEQyE2vfzZVGEe4JByXe5m5TyN493HvDNm1SVAQXu3r7pJWX7LA7irQr7/T -pnoziLGAuhIqUObXo3xyHG2WPAdjuFM/ag6h9QIDAQABAoIBAFQnfb0hbic7mRgr -pMjHQriObGdqR9jj7IFUx6QpJYRDuJlMEYcrXh5CioN1nR6t9uaRpaSDnUKbUWz0 -yfuekPtnzzncyt9dAfCYPHD5MoZlLP/0sSjTVJlyKml6J8Bp2Q0zzWdvwZCB9o3C -76dnZFGRGFn00GVyLndUNuUNO0WfdQfHrmAC3FbVMa3HRRWiQzTgs0lPR9SCh1La -EYh+xSu3J+0ASaVJmn3VoDM5CZyocfWCmq9unOX0VsnoTSZ2hmayJ/ScwXw44xa2 -RfARIbR/J4Id4azzrFYnk8Wq5A0y9bTEY+aZLzhOFz/rR+oefNS6ruddSMi43OpS -8vsNs4ECgYEA/JRKqFP6PYoh/3R7HxHBc3bZwVCJg9I6a+nZvDKOf+2zjW1R5T// -Vpt+tCsHV5oXWHMMDiWi135EpLJ2BhwHDc1u7wf+hvsIImfUkxw4dam8yZQGPjz6 -oDBS/BH2h71yT1H/D5X00HBxIfZgiAmklBEXs8rVlG80zcJGBITIzqECgYEA98pv -DHvdYSyhaDKMzrcx1Y0xAKXsdDWKu70Wa+L4LIwHgDVIdYZhjcFOhtIUeuutbqNO -L0PdulUej7celg2XGmLAMskE56B8iQ1an9XPiwDlvyFLXdQiDst92N2Ho83Prdeb -YL8tbj6JQJE2PMbxNKKpJ0mRj0aaKuPz//zs9tUCgYA1iimZLNPqn5E9WS+QEm9z -TkoyVCQSMUn4/gUNg5n5PCXHYNjvQ3WYojVlc4mG5D72nMx9YzT1gOqEDuA9w0sr -fdR6DrPBYQ0EXgYNePnu1yARirMYFkz6D8RHcndTprDIZ5UtdJgEZxFUJamorIKa -cFUZ43EKmdgTlY7J/muigQKBgGQBbYQqUZSwgIwfKrkbMp+vlkFetenI2i8fB3eP -aP4Bnd1eo9na3HBrvhenneBmUd6/RgTJbSmQxP7Xtx50abGafVuBydr56IkfvJ2Z -m2PMfuz+sP4zaXNzKV1nOyEfJVxSEkGfpuRBlP9cG/m3iQ3nQEG87WRX6Ey7J3T/ -TVvpAoGAfjRYPIX7UzkfYg5xQ2TTq4piM/kuMHESQz0UKByF0I1Aq86TTuK80jLA -gzodVT5l3zGgSHQr1vZHcOJBYITrg8uVxYBC7A/FAwKQL2wu0O8aV4BV+rNyDrwR -bSt4sc5grsSL1igyGo0rj0B1zX0Ee+tKDbtzBqXjcRgFZeB5PCQ= ------END RSA PRIVATE KEY----- diff --git a/templates/template04-ldap/.vagrant/machines/default/lxd/synced_folders b/templates/template04-ldap/.vagrant/machines/default/lxd/synced_folders deleted file mode 100644 index d40c2ca..0000000 --- a/templates/template04-ldap/.vagrant/machines/default/lxd/synced_folders +++ /dev/null @@ -1 +0,0 @@ -{"lxd":{"/vagrant":{"guestpath":"/vagrant","hostpath":"/home/pietro/_tmp/test-lxc-env","disabled":false,"__vagrantfile":true,"config":{}}}} \ No newline at end of file diff --git a/templates/template04-ldap/.vagrant/machines/default/lxd/vagrant_cwd b/templates/template04-ldap/.vagrant/machines/default/lxd/vagrant_cwd deleted file mode 100644 index f0b864f..0000000 --- a/templates/template04-ldap/.vagrant/machines/default/lxd/vagrant_cwd +++ /dev/null @@ -1 +0,0 @@ -/home/pietro/_tmp/test-lxc-env \ No newline at end of file diff --git a/templates/template04-ldap/.vagrant/rgloader/loader.rb b/templates/template04-ldap/.vagrant/rgloader/loader.rb deleted file mode 100644 index c3c05b0..0000000 --- a/templates/template04-ldap/.vagrant/rgloader/loader.rb +++ /dev/null @@ -1,9 +0,0 @@ -# This file loads the proper rgloader/loader.rb file that comes packaged -# with Vagrant so that encoded files can properly run with Vagrant. - -if ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"] - require File.expand_path( - "rgloader/loader", ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"]) -else - raise "Encoded files can't be read outside of the Vagrant installer." -end diff --git a/templates/template05-elasticsearch/Readme.md b/templates/template05-elasticsearch/Readme.md index 8bd721a..7fb0bca 100644 --- a/templates/template05-elasticsearch/Readme.md +++ b/templates/template05-elasticsearch/Readme.md @@ -1,23 +1,30 @@ ### ElasticSearch server +| :zap: As of March 2023, Nextcloud Full Text Search requires ElasticSearch 7, it's not compatible with ElasticSearch 8| +|----------------------------------------------------------------------------------------------------| + + +| :zap: Elastic Search is quite resource-intensive so that you may want to create a dedicated LXD profile and assign the container to that profile (property `lxd.profiles`) | +|----------------------------------------------------------------------------------------------------| + + #### Setup * Assuming that the copy of the template is called `elasticsearch-instance`, move to folder `elasticsearch-instance`. * Check the content of folder `artifacts` -| :zap: As of June 2022, Nextcloud FullTextSearch requires ElasticSearch 7, it's not compatible with ElasticSearch 8| -|----------------------------------------------------------------------------------------------------| - - |File name | Description| | --- | --- | -| `elasticsearch-${ELASTICSEARCH_VERSION}-amd64.deb` | The Debian DEB archive can be downloaded from [here](https://www.elastic.co/downloads/past-releases#elasticsearch) | +| `elasticsearch-${ELASTICSEARCH_VERSION}-amd64.deb` | Debian archive for version 7.17.X to be downloaded from [here](https://www.elastic.co/guide/en/elasticsearch/reference/7.17/deb.html#install-deb) | | `memory.options` | Limit the total memory assigned to the JVM | | `elasticsearch.yml` | ElasticSearch core configuration file | + +* Open `Vagrantfile` and assign a value to the following variables and parameters: + * `lxd.name` (it is recommended to give the same name as the folder, in this example `elasticsearch-instance`) + * `MACHINE_HOSTNAME` + * `ELASTICSEARCH_VERSION` * Create folder `log` -* Open `Vagrantfile` and change the value of variable `lxd.name`. It makes sense to give the same name as the folder, in this example `elasticsearch-instance`. Also as Elastic Search is resource-intensive you may want to create a dedicated LXD profile and assign the container to that profile (property `lxd.profiles`) -* Open `provision.sh` and change the value of variable `MACHINE_HOSTNAME` and `ELASTICSEARCH_VERSION`. It makes sense to give the same name as the folder, plus the domain, in this example `elasticsearch-instance.localenv.com`. * Run `vagrant up > log/provisioning.log` -* Make sure your system is able to resolve the domain name that you specified in variable `MACHINE_HOSTNAME`, for example by adding an entry in `/etc/hosts` +* Make sure your system is able to resolve the domain name that you specified in variable `MACHINE_HOSTNAME`, for example by adding an entry in `/etc/hosts` or by setting up the LXD nameserver * Start using your environment diff --git a/templates/template05-elasticsearch/Vagrantfile b/templates/template05-elasticsearch/Vagrantfile index 4aecd17..9e0c61b 100644 --- a/templates/template05-elasticsearch/Vagrantfile +++ b/templates/template05-elasticsearch/Vagrantfile @@ -3,19 +3,19 @@ Vagrant.configure("2") do |config| + + config.vm.box = "isc/forge-clt-ubuntu-22.04" - config.vm.box = "hibox/focal64" + config.vm.box_version = "1" config.vm.box_check_update = false - - ## This is the latest box version as of 22/03/2022 - ## Box versions are available here: https://app.vagrantup.com/hibox/boxes/focal64 - config.vm.box_version = "1.0.1639726498" - + config.vm.provider 'lxd' do |lxd| lxd.api_endpoint = 'https://127.0.0.1:8443' lxd.timeout = 10 - lxd.name = 'elastic-search' + lxd.name = '' + lxd.project = 'default' + lxd.profiles = ['default'] # lxd.nesting = nil # lxd.privileged = nil # lxd.ephemeral = false @@ -24,7 +24,14 @@ # lxd.config = {} end - config.vm.provision :shell, path: "provision.sh" + config.vm.provision "shell" do |s| + s.env = { + "MACHINE_HOSTNAME" => "", + "ELASTICSEARCH_VERSION" => "" + } + s.path = "provision.sh" + end + end diff --git a/templates/template05-elasticsearch/provision.sh b/templates/template05-elasticsearch/provision.sh index 060e24c..968b087 100644 --- a/templates/template05-elasticsearch/provision.sh +++ b/templates/template05-elasticsearch/provision.sh @@ -6,17 +6,6 @@ echo "provisioning started: ${start_time}" -#### The user must fill these variables - START - -# Fully Qualified Name: ex. "es-server.localenv.com" -MACHINE_HOSTNAME= - -# ElasticSearch version to be installed (format X.Y.Z)" -ELASTICSEARCH_VERSION= -#### The user must fill these variables - END - -ELASTICSEARCH_USER=usrv - INSTALLER_ARCHIVE_NAME=elasticsearch-${ELASTICSEARCH_VERSION}.deb NETWORK_INTERFACE=eth0 @@ -35,12 +24,6 @@ ##################################################################### ip_address=`ip -4 addr show ${NETWORK_INTERFACE} | grep -oP '(?<=inet\s)\d+(\.\d+){3}'` -adduser --disabled-password --gecos GECOS ${ELASTICSEARCH_USER} - -usermod -p "`openssl passwd -1 -salt 5RPVAd ${ELASTICSEARCH_USER}`" ${ELASTICSEARCH_USER} - -adduser ${ELASTICSEARCH_USER} sudo - dpkg --install /vagrant/artifacts/elasticsearch-${ELASTICSEARCH_VERSION}-amd64.deb cp /vagrant/artifacts/memory.options /etc/elasticsearch/jvm.options.d/memory.options @@ -71,11 +54,9 @@ echo "This container has IP (interface: ${NETWORK_INTERFACE}): ${ip_address}" -echo "If you add this IP to the hostname (${MACHINE_HOSTNAME}) in your hosts file:" +echo "If you add this IP to the hostname (${MACHINE_HOSTNAME}) in your hosts file or you configure the LXD nameserver," -echo " You can connect with user ${ELASTICSEARCH_USER} via ssh (password ${ELASTICSEARCH_USER}): ssh ${ELASTICSEARCH_USER}@${MACHINE_HOSTNAME}" - -echo " Your Elastic Search Server instance is is listening on port 9200: you can validate connectivity with 'curl -X GET "${MACHINE_HOSTNAME}:9200/?pretty"'" +echo "you can validate ElasticSearch connectivity with 'curl -X GET "${MACHINE_HOSTNAME}:9200/?pretty"'" echo "provisioning started: ${start_time}" diff --git a/templates/template06-nextcloud-db-standalone/Readme.md b/templates/template06-nextcloud-db-standalone/Readme.md index dbeb95e..c5485bd 100644 --- a/templates/template06-nextcloud-db-standalone/Readme.md +++ b/templates/template06-nextcloud-db-standalone/Readme.md @@ -11,9 +11,13 @@ * Create folder `log` -* Open `Vagrantfile` and change the value of variable `lxd.name`. It makes sense to give the same name as the folder, in this example `nc-db-instance`. -* Open `provision.sh` - * change the value of variable `MACHINE_HOSTNAME`. It makes sense to give the same name as the folder, plus the domain, in this example `nc-db-instance.localenv.com`. +* Open `Vagrantfile` and assign a value to the following parameters and variables: + * `lxd.name` (it is recommended to give the container the same name as the folder, in this example `nc-db-instance`) + * `MACHINE_HOSTNAME` + * `NEXTCLOUD_DB_NAME` + * `NEXTCLOUD_DB_USER` + * `NEXTCLOUD_DB_PASSWORD` + * Run `vagrant up > log/provisioning.log` * Make sure your system is able to resolve the domain name that you specified in variable `MACHINE_HOSTNAME`, for example by adding an entry in `/etc/hosts` * Start using your environment diff --git a/templates/template06-nextcloud-db-standalone/Vagrantfile b/templates/template06-nextcloud-db-standalone/Vagrantfile index ccd739e..94e0446 100644 --- a/templates/template06-nextcloud-db-standalone/Vagrantfile +++ b/templates/template06-nextcloud-db-standalone/Vagrantfile @@ -4,26 +4,33 @@ Vagrant.configure("2") do |config| - config.vm.box = "hibox/focal64" + config.vm.box = "isc/forge-clt-ubuntu-22.04" + + config.vm.box_version = "1" config.vm.box_check_update = false - - ## This is the latest box version as of 17/06/2021 - config.vm.box_version = "1.0.1619509541" config.vm.provider 'lxd' do |lxd| lxd.api_endpoint = 'https://127.0.0.1:8443' lxd.timeout = 10 - lxd.name = 'nc-database' + lxd.name = '' + lxd.project = 'default' + lxd.profiles = ['default'] # lxd.nesting = nil # lxd.privileged = nil # lxd.ephemeral = false - # lxd.profiles = ['default'] # lxd.environment = {} # lxd.config = {} end - config.vm.provision :shell, path: "provision.sh" - + config.vm.provision "shell" do |s| + s.env = { + "MACHINE_HOSTNAME" => "", + "NEXTCLOUD_DB_NAME" => "", + "NEXTCLOUD_DB_USER" => "", + "NEXTCLOUD_DB_PASSWORD" => "", + } + s.path = "provision.sh" + end end diff --git a/templates/template06-nextcloud-db-standalone/provision.sh b/templates/template06-nextcloud-db-standalone/provision.sh index 138a855..ad6477a 100644 --- a/templates/template06-nextcloud-db-standalone/provision.sh +++ b/templates/template06-nextcloud-db-standalone/provision.sh @@ -6,27 +6,6 @@ echo "provisioning started: ${start_time}" -echo "provisioning started: ${start_time}" - -#### The user must fill these variables - START - -# Fully Qualified Name: ex. "nc.localenv.com" -MACHINE_HOSTNAME= - -#### The user must fill these variables - END - -SYSTEM_USER=usrv - -NEXTCLOUD_DB_NAME=nextcloud_db - -NEXTCLOUD_DB_USER=nextcloud_usr - -NEXTCLOUD_DB_PASSWORD=${NEXTCLOUD_DB_USER} - -NEXTCLOUD_DB_PORT=3306 - -NETWORK_INTERFACE=eth0 - #PHP_INI=/etc/php/7.4/apache2/php.ini hostnamectl set-hostname ${MACHINE_HOSTNAME} @@ -43,13 +22,6 @@ ##################################################################### ip_address=`ip -4 addr show ${NETWORK_INTERFACE} | grep -oP '(?<=inet\s)\d+(\.\d+){3}'` -adduser --disabled-password --gecos GECOS ${SYSTEM_USER} - -usermod -p "`openssl passwd -1 -salt 5RPVAd ${SYSTEM_USER}`" ${SYSTEM_USER} - -adduser ${SYSTEM_USER} sudo - - ## Install Nextcloud: https://docs.nextcloud.com/server/stable/admin_manual/installation/example_ubuntu.html ##### @@ -74,11 +46,11 @@ echo "START - Create the database" -mysql -u root -e 'create database nextcloud_db;' +mysql -u root -e "create database ${NEXTCLOUD_DB_NAME};" -mysql -u root -e "create user nextcloud_usr@'%' identified by 'nextcloud_usr'" +mysql -u root -e 'create user "'"${NEXTCLOUD_DB_USER}"'" identified by "'"${NEXTCLOUD_DB_PASSWORD}"'"' -mysql -u root -e "grant all privileges on nextcloud_db.* to 'nextcloud_usr'@'%'" +mysql -u root -e "grant all privileges on ${NEXTCLOUD_DB_NAME}.* to ${NEXTCLOUD_DB_USER}@'%'" echo "END - Create the database" @@ -92,11 +64,9 @@ echo "This container has IP (interface: ${NETWORK_INTERFACE}): ${ip_address}" -echo "If you add this IP to the hostname (${MACHINE_HOSTNAME}) in your hosts file:" +echo "If you add this IP to the hostname (${MACHINE_HOSTNAME}) in your hosts file, or configure LXD nameserver" -echo " You can connect with user ${SYSTEM_USER} via ssh (password ${SYSTEM_USER}): ssh ${SYSTEM_USER}@${MACHINE_HOSTNAME}" - -echo " You can connect to this MariaDB instance with the following parameters:" +echo "you can connect to this MariaDB instance on standard port 3306 with the following parameters:" echo " hostname: ${MACHINE_HOSTNAME}" @@ -106,8 +76,6 @@ echo " password: ${NEXTCLOUD_DB_PASSWORD}" -echo " port: ${NEXTCLOUD_DB_PORT}" - echo "provisioning started: ${start_time}" echo "provisioning ended: ${end_time}" diff --git a/templates/template07-glusterfs-server/Readme.md b/templates/template07-glusterfs-server/Readme.md index 2e566ad..6a492b1 100644 --- a/templates/template07-glusterfs-server/Readme.md +++ b/templates/template07-glusterfs-server/Readme.md @@ -2,17 +2,20 @@ #### Setup +| :zap: The container is required to be privileged. The configuration switch is already enabled in Vagrantfile.| +|----------------------------------------------------------------------------------------------------| + * Assuming that the copy of the template is called `glusterfs-instance`, move to folder `glusterfs-instance`. * Check the content of folder `artifacts` |File name | Description| | --- | --- | - * Create folder `log` -* Open `Vagrantfile` and change the value of variable `lxd.name`. It makes sense to give the same name as the folder, in this example `glusterfs-instance`. -* Open `provision.sh` - * change the value of variable `MACHINE_HOSTNAME`. It makes sense to give the same name as the folder, plus the domain, in this example `glusterfs-instance.localenv.com`. +* Open `Vagrantfile` and assign a value to the following parameters and variables: + * `lxd.name` (it is recommended to give the container the same name as the folder, in this example `nc-db-instance`) + * `MACHINE_HOSTNAME` + * Run `vagrant up > log/provisioning.log` * Make sure your system is able to resolve the domain name that you specified in variable `MACHINE_HOSTNAME`, for example by adding an entry in `/etc/hosts` * Start using your environment diff --git a/templates/template07-glusterfs-server/Vagrantfile b/templates/template07-glusterfs-server/Vagrantfile index ac6c9df..8968d7d 100644 --- a/templates/template07-glusterfs-server/Vagrantfile +++ b/templates/template07-glusterfs-server/Vagrantfile @@ -4,26 +4,30 @@ Vagrant.configure("2") do |config| - config.vm.box = "hibox/focal64" + config.vm.box = "isc/forge-clt-ubuntu-22.04" + + config.vm.box_version = "1" config.vm.box_check_update = false - - ## This is the latest box version as of 17/06/2021 - config.vm.box_version = "1.0.1619509541" config.vm.provider 'lxd' do |lxd| lxd.api_endpoint = 'https://127.0.0.1:8443' lxd.timeout = 10 - lxd.name = 'glusterfs-server' + lxd.name = '' + lxd.project = 'default' + lxd.profiles = ['default'] # lxd.nesting = nil lxd.privileged = true # lxd.ephemeral = false - # lxd.profiles = ['default'] # lxd.environment = {} # lxd.config = {} end - config.vm.provision :shell, path: "provision.sh" - + config.vm.provision "shell" do |s| + s.env = { + "MACHINE_HOSTNAME" => "" + } + s.path = "provision.sh" + end end diff --git a/templates/template07-glusterfs-server/provision.sh b/templates/template07-glusterfs-server/provision.sh index ceb7863..5269b97 100644 --- a/templates/template07-glusterfs-server/provision.sh +++ b/templates/template07-glusterfs-server/provision.sh @@ -6,10 +6,6 @@ echo "provisioning started: ${start_time}" -MACHINE_HOSTNAME=glusterfs-server.localenv.com - -SYSTEM_USER=usrv - NETWORK_INTERFACE=eth0 hostnamectl set-hostname ${MACHINE_HOSTNAME} @@ -26,11 +22,7 @@ ##################################################################### ip_address=`ip -4 addr show ${NETWORK_INTERFACE} | grep -oP '(?<=inet\s)\d+(\.\d+){3}'` -adduser --disabled-password --gecos GECOS ${SYSTEM_USER} - -usermod -p "`openssl passwd -1 -salt 5RPVAd ${SYSTEM_USER}`" ${SYSTEM_USER} - -adduser ${SYSTEM_USER} sudo +apt update apt install -y glusterfs-server @@ -46,6 +38,8 @@ systemctl status glusterd +gluster volume info vol01 + echo "START - Cleanup" rm -rf /vagrant/artifacts/* @@ -56,10 +50,6 @@ echo "This container has IP (interface: ${NETWORK_INTERFACE}): ${ip_address}" -echo "If you add this IP to the hostname (${MACHINE_HOSTNAME}) in your hosts file:" - -echo " You can connect with user ${SYSTEM_USER} via ssh (password ${SYSTEM_USER}): ssh ${SYSTEM_USER}@${MACHINE_HOSTNAME}" - echo "provisioning started: ${start_time}" echo "provisioning ended: ${end_time}" diff --git a/templates/template08-haproxy-server/Readme.md b/templates/template08-haproxy-server/Readme.md index 2b8fbe8..f08f804 100644 --- a/templates/template08-haproxy-server/Readme.md +++ b/templates/template08-haproxy-server/Readme.md @@ -1,4 +1,4 @@ -### Stand-alone Nextcloud server +### Stand-alone HAProxy Server #### Setup @@ -8,17 +8,17 @@ |File name | Description| | --- | --- | | haproxy.cfg | haproxy configuration file | -| `mkcert` | mkcert command line utility to be downloaded [here](https://github.com/FiloSottile/mkcert/releases). Pick the latest binary for amd64 and rename it to `mkcert` | | `rootCA.pem` | The rootCA previously created in your host machine | | `rootCA-key.pem` | The rootCA key previously created in your host machine | * Create folder `log` -* Open `Vagrantfile` and change the value of variable `lxd.name`. It makes sense to give the same name as the folder, in this example `haproxy-server`. -* Open `provision.sh` - * change the value of variable `MACHINE_HOSTNAME`. It makes sense to give the same name as the folder, plus the domain, in this example `haproxy-server.localenv.com`. - * change the values of `WEBSERVER_NODE01_HOSTNAME` and `WEBSERVER_NODE02_HOSTNAME`. +* Open `Vagrantfile` and assign a value the following variables and parameters + * `lxd.name` (it is recommended to give the same name as the folder, in this example `haproxy-server`) + * `MACHINE_HOSTNAME` + * `WEBSERVER_NODE01_HOSTNAME` + * `WEBSERVER_NODE02_HOSTNAME` * Run `vagrant up > log/provisioning.log` * Make sure your system is able to resolve the domain name that you specified in variable `MACHINE_HOSTNAME`, for example by adding an entry in `/etc/hosts` * Start using your environment diff --git a/templates/template08-haproxy-server/Vagrantfile b/templates/template08-haproxy-server/Vagrantfile index a135374..7734e22 100644 --- a/templates/template08-haproxy-server/Vagrantfile +++ b/templates/template08-haproxy-server/Vagrantfile @@ -4,26 +4,32 @@ Vagrant.configure("2") do |config| - config.vm.box = "hibox/focal64" + config.vm.box = "isc/forge-clt-ubuntu-22.04" + + config.vm.box_version = "1" config.vm.box_check_update = false - - ## This is the latest box version as of 17/06/2021 - config.vm.box_version = "1.0.1619509541" config.vm.provider 'lxd' do |lxd| lxd.api_endpoint = 'https://127.0.0.1:8443' lxd.timeout = 10 - lxd.name = 'haproxy-server' + lxd.name = '' + lxd.project = 'default' + lxd.profiles = ['default'] # lxd.nesting = nil # lxd.privileged = nil # lxd.ephemeral = false - # lxd.profiles = ['default'] # lxd.environment = {} # lxd.config = {} end - config.vm.provision :shell, path: "provision.sh" - + config.vm.provision "shell" do |s| + s.env = { + "MACHINE_HOSTNAME" => "", + "WEBSERVER_NODE01_HOSTNAME" => "", + "WEBSERVER_NODE02_HOSTNAME" => "", + } + s.path = "provision.sh" + end end diff --git a/templates/template08-haproxy-server/provision.sh b/templates/template08-haproxy-server/provision.sh index 0ee39b5..7f99aaf 100644 --- a/templates/template08-haproxy-server/provision.sh +++ b/templates/template08-haproxy-server/provision.sh @@ -6,21 +6,6 @@ echo "provisioning started: ${start_time}" -#### The user must fill these variables - START - -# Fully Qualified Name -MACHINE_HOSTNAME= - -# Hostname of the first node of the webserver farm -WEBSERVER_NODE01_HOSTNAME= - -# Hostname of the first node of the webserver farm -WEBSERVER_NODE02_HOSTNAME= - -#### The user must fill these variables - END - -SYSTEM_USER=usrv - NETWORK_INTERFACE=eth0 @@ -38,17 +23,12 @@ ##################################################################### ip_address=`ip -4 addr show ${NETWORK_INTERFACE} | grep -oP '(?<=inet\s)\d+(\.\d+){3}'` -adduser --disabled-password --gecos GECOS ${SYSTEM_USER} - -usermod -p "`openssl passwd -1 -salt 5RPVAd ${SYSTEM_USER}`" ${SYSTEM_USER} - -adduser ${SYSTEM_USER} sudo - ## Install Haproxy - latest version: https://www.haproxy.com/blog/how-to-install-haproxy-on-ubuntu/ +apt update -apt install -y --no-install-recommends software-properties-common +apt install -y --no-install-recommends software-properties-common gnupg-agent -add-apt-repository -y ppa:vbernat/haproxy-2.4 +add-apt-repository -y ppa:vbernat/haproxy-2.7 apt update @@ -57,13 +37,13 @@ apt install -y haproxy ## Install the mkcert rootCA (see https://github.com/FiloSottile/mkcert#installing-the-ca-on-other-systems) -chmod u+x /vagrant/artifacts/mkcert +apt install mkcert export CAROOT=/vagrant/artifacts/ -/vagrant/artifacts/mkcert -install +mkcert -install -/vagrant/artifacts/mkcert --cert-file /etc/ssl/certs/${MACHINE_HOSTNAME}.pem --key-file /etc/ssl/private/${MACHINE_HOSTNAME}-key.pem "${MACHINE_HOSTNAME}" +mkcert --cert-file /etc/ssl/certs/${MACHINE_HOSTNAME}.pem --key-file /etc/ssl/private/${MACHINE_HOSTNAME}-key.pem "${MACHINE_HOSTNAME}" ## HAproxy needs the certificate and the key in the same file cat /etc/ssl/certs/${MACHINE_HOSTNAME}.pem /etc/ssl/private/${MACHINE_HOSTNAME}-key.pem > /etc/ssl/private/${MACHINE_HOSTNAME}-full.pem @@ -83,10 +63,6 @@ echo "This container has IP (interface: ${NETWORK_INTERFACE}): ${ip_address}" -echo "If you add this IP to the hostname (${MACHINE_HOSTNAME}) in your hosts file:" - -echo " You can connect with user ${SYSTEM_USER} via ssh (password ${SYSTEM_USER}): ssh ${SYSTEM_USER}@${MACHINE_HOSTNAME}" - echo "provisioning started: ${start_time}" echo "provisioning ended: ${end_time}" diff --git a/templates/template09-web-server-node/Readme.md b/templates/template09-web-server-node/Readme.md index efa6ee8..7542d55 100644 --- a/templates/template09-web-server-node/Readme.md +++ b/templates/template09-web-server-node/Readme.md @@ -1,4 +1,4 @@ -### Stand-alone Nextcloud server +### Stand-alone Nextcloud node (to be used in a cluster) #### Setup @@ -10,17 +10,23 @@ | `nextcloud-X.Y.Z.tar.bz2` | The installer archive to be downloaded from [here](https://download.nextcloud.com/server/releases/) | | `nextcloud-X.Y.Z.tar.bz2.md5` | md5 signature of the installer archive to be downloaded from [here](https://download.nextcloud.com/server/releases/) | | `nextcloud.conf` | Apache Web Server main configuration file | -| data-nextcloud.mount | Mount systemd service for the GlusterFS filesystem | - - - +| `data-nextcloud.mount` | Mount systemd service for the GlusterFS filesystem | +| `occ` | Alias for the occ command | * Create folder `log` -* Open `Vagrantfile` and change the value of variable `lxd.name`. It makes sense to give the same name as the folder, in this example `nc-instance`. -* Open `provision.sh` - * change the value of variable `MACHINE_HOSTNAME`. It makes sense to give the same name as the folder, plus the domain, in this example `nc-instance.localenv.com`. - * change the value of variable `NEXTCLOUD_INSTALLER_ARCHIVE` to match the name of the installer archive you are using. +* Open `Vagrantfile` and assign a value to the following variables and parameters: + + * `lxd.name` (it is recommended to give the same name as the folder, in this example `nc-instance`) + * `MACHINE_HOSTNAME` + * `NEXTCLOUD_INSTALLER_ARCHIVE` to match the name of the installer archive you are using. + * `DATABASE_MACHINE_HOSTNAME` + * `DATABASE_ALREADY_EXIST` + * `REDIS_MACHINE_HOSTNAME` + * `REDIS_MACHINE_PORT` + * `GLUSTERFS_MACHINE_HOSTNAME` + * `GLUSTERFS_VOLUME` + * Run `vagrant up > log/provisioning.log` -* Make sure your system is able to resolve the domain name that you specified in variable `MACHINE_HOSTNAME`, for example by adding an entry in `/etc/hosts` +* Make sure your system is able to resolve the domain name that you specified in variable `MACHINE_HOSTNAME`, for example by adding an entry in `/etc/hosts` or configure LXD nameserver * Start using your environment diff --git a/templates/template09-web-server-node/Vagrantfile b/templates/template09-web-server-node/Vagrantfile index 428d542..6ebc0f6 100644 --- a/templates/template09-web-server-node/Vagrantfile +++ b/templates/template09-web-server-node/Vagrantfile @@ -4,26 +4,39 @@ Vagrant.configure("2") do |config| - config.vm.box = "hibox/focal64" + config.vm.box = "isc/forge-clt-ubuntu-22.04" + + config.vm.box_version = "1" config.vm.box_check_update = false - - ## This is the latest box version as of 17/06/2021 - config.vm.box_version = "1.0.1619509541" config.vm.provider 'lxd' do |lxd| lxd.api_endpoint = 'https://127.0.0.1:8443' lxd.timeout = 10 - lxd.name = 'your-container-name' + lxd.name = '' + lxd.project = 'default' + lxd.profiles = ['default'] # lxd.nesting = nil # lxd.privileged = nil # lxd.ephemeral = false - # lxd.profiles = ['default'] # lxd.environment = {} # lxd.config = {} end - config.vm.provision :shell, path: "provision.sh" - + config.vm.provision "shell" do |s| + s.env = { + "MACHINE_HOSTNAME" => "", + "NEXTCLOUD_INSTALLER_ARCHIVE" => "", + "DATABASE_MACHINE_HOSTNAME" => "", + "DATABASE_ALREADY_EXIST" => "1", + "REDIS_MACHINE_HOSTNAME" => "", + "GLUSTERFS_MACHINE_HOSTNAME" => "", + "GLUSTERFS_VOLUME" => "", + "PROXY_MACHINE_IP" => "", + "PROXY_MACHINE_HOSTNAME" => "" + + } + s.path = "provision.sh" + end end diff --git a/templates/template09-web-server-node/provision.sh b/templates/template09-web-server-node/provision.sh index 41bab31..810ec60 100644 --- a/templates/template09-web-server-node/provision.sh +++ b/templates/template09-web-server-node/provision.sh @@ -6,40 +6,14 @@ echo "provisioning started: ${start_time}" -#### The user must fill these variables - START - -# Fully Qualified Name -MACHINE_HOSTNAME= - -# Add the installer archive name here -NEXTCLOUD_INSTALLER_ARCHIVE= - -# Database Host -DATABASE_MACHINE_HOSTNAME= - -# If the database already exists, set to 1 (this has no effect momentarily) -DATABASE_ALREADY_EXIST=1 - -# Redis Host -REDIS_MACHINE_HOSTNAME= - -# Redis Port (default is generally 6379) -REDIS_MACHINE_PORT= - -# GlusterFs Host -GLUSTERFS_MACHINE_HOSTNAME= - -# GlusterFs Volume -GLUSTERFS_VOLUME= - -#### The user must fill these variables - END - - -NEXTCLOUD_USER=usrv +## NC<24 => PHP=7.4 +## NC>=24 => PHP=8.1 OR PHP=7.4 +## https://www.linuxcapable.com/how-to-install-php-7-4-on-ubuntu-22-04-lts/ +PHP_VERSION=8.1 NETWORK_INTERFACE=eth0 -PHP_INI=/etc/php/7.4/apache2/php.ini +PHP_INI=/etc/php/${PHP_VERSION}/apache2/php.ini hostnamectl set-hostname ${MACHINE_HOSTNAME} @@ -55,20 +29,12 @@ ##################################################################### ip_address=`ip -4 addr show ${NETWORK_INTERFACE} | grep -oP '(?<=inet\s)\d+(\.\d+){3}'` -adduser --disabled-password --gecos GECOS ${NEXTCLOUD_USER} - -usermod -p "`openssl passwd -1 -salt 5RPVAd ${NEXTCLOUD_USER}`" ${NEXTCLOUD_USER} - -adduser ${NEXTCLOUD_USER} sudo - - ## Install Nextcloud: https://docs.nextcloud.com/server/stable/admin_manual/installation/example_ubuntu.html ##### ## Step 001 ## Check the MD5 of the Nextcloud Installer - ##(cd to the folder to avoid a 'File Not Found' error cd /vagrant/artifacts @@ -89,20 +55,37 @@ fi ## Install the needed packages from apt repositories + +if [ "${PHP_VERSION}" == "7.4" ]; then + + apt update + + apt install -y software-properties-common apt-transport-https + + add-apt-repository ppa:ondrej/php -y + +fi + apt update -apt install -y apache2 libapache2-mod-php7.4 imagemagick - -apt install -y php7.4-gd php7.4-mysql php7.4-curl php7.4-mbstring php7.4-intl - -apt install -y php7.4-gmp php7.4-bcmath php-imagick php7.4-xml php7.4-zip - -apt install -y php-redis php-apcu - -apt install -y glusterfs-client - -apt install -y mysql-client - +apt install -y apache2 \ + mariadb-server \ + libapache2-mod-php${PHP_VERSION} \ + imagemagick \ + php${PHP_VERSION}-gd \ + php${PHP_VERSION}-mysql \ + php${PHP_VERSION}-curl \ + php${PHP_VERSION}-mbstring \ + php${PHP_VERSION}-intl \ + php${PHP_VERSION}-gmp \ + php${PHP_VERSION}-bcmath \ + php${PHP_VERSION}-imagick \ + php${PHP_VERSION}-xml \ + php${PHP_VERSION}-zip \ + php${PHP_VERSION}-redis \ + php${PHP_VERSION}-apcu \ + mariadb-client \ + glusterfs-client ## Expand the installer archive and move the content to the web server root folder (/var/www) @@ -202,9 +185,14 @@ --admin-pass "${admin_usr}"\ --data-dir "/data/nextcloud" -## Adding the Hostname in the trusted_domains config key +## Adding MACHINE_HOSTNAME and PROXY_MACHINE_HOSTNAME in the trusted_domains config key occ config:system:set trusted_domains 1 --value "${MACHINE_HOSTNAME}" +occ config:system:set trusted_domains 2 --value "${PROXY_MACHINE_HOSTNAME}" + +## Adding the IP of the proxy system to the list of trusted proxies +occ config:system:set trusted_proxies 1 --value "${PROXY_MACHINE_IP}" + echo "END - Installing Nextcloud from CLI" ## Tweaking some Nextcloud settings @@ -223,7 +211,7 @@ ## Order is important here. The 'redis' array must be configured first. occ config:system:set redis host --value "${REDIS_MACHINE_HOSTNAME}" -occ config:system:set redis port --value "${REDIS_MACHINE_PORT}" +occ config:system:set redis port --value 6379 #https://help.nextcloud.com/t/occ-wont-run-with-memcache-apcu/119724 sudo -u www-data php --define apc.enable_cli=1 /var/www/nextcloud/occ config:system:set memcache.local --value '\OC\Memcache\APCu' @@ -242,9 +230,6 @@ systemctl status apache2 -## Adding system user to www-data group (to ease command line operations) -adduser ${NEXTCLOUD_USER} www-data - echo "START - Cleanup" rm -rf /vagrant/artifacts/nextcloud @@ -255,11 +240,9 @@ echo "This container has IP (interface: ${NETWORK_INTERFACE}): ${ip_address}" -echo "If you add this IP to the hostname (${MACHINE_HOSTNAME}) in your hosts file:" +echo "If you add this IP to the hostname (${MACHINE_HOSTNAME}) in your hosts file or configure LXD nameserver" -echo " You can connect with user ${NEXTCLOUD_USER} via ssh (password ${NEXTCLOUD_USER}): ssh ${NEXTCLOUD_USER}@${MACHINE_HOSTNAME}" - -echo " You can connect to this Nextcloud instance with the following URL: http://${MACHINE_HOSTNAME}. Login with ${admin_usr}/$admin_usr}" +echo "you can connect to this Nextcloud instance with the following URL: http://${MACHINE_HOSTNAME}. Login with ${admin_usr}/$admin_usr}" echo "provisioning started: ${start_time}" diff --git a/templates/template10-redis-server/Readme.md b/templates/template10-redis-server/Readme.md index 5f28aaf..81bc297 100644 --- a/templates/template10-redis-server/Readme.md +++ b/templates/template10-redis-server/Readme.md @@ -1,4 +1,4 @@ -### Stand-alone Nextcloud server +### Stand-alone Redis server #### Setup @@ -9,10 +9,12 @@ | --- | --- | | redis.conf | redis configuration file + * Create folder `log` -* Open `Vagrantfile` and change the value of variable `lxd.name`. It makes sense to give the same name as the folder, in this example `redis-server`. -* Open `provision.sh` - * change the value of variable `MACHINE_HOSTNAME`. It makes sense to give the same name as the folder, plus the domain, in this example `redis-server.localenv.com`. +* Open `Vagrantfile` and assign a value to the following parameters and variables: + * `lxd.name` (it is recommended to give the container the same name as the folder, in this example `redis-server`) + * `MACHINE_HOSTNAME` + * Run `vagrant up > log/provisioning.log` -* Make sure your system is able to resolve the domain name that you specified in variable `MACHINE_HOSTNAME`, for example by adding an entry in `/etc/hosts` +* Make sure your system is able to resolve the domain name that you specified in variable `MACHINE_HOSTNAME`, for example by adding an entry in `/etc/hosts` or by setting up the LXD nameserver * Start using your environment diff --git a/templates/template10-redis-server/Vagrantfile b/templates/template10-redis-server/Vagrantfile index 3aabecf..202cf05 100644 --- a/templates/template10-redis-server/Vagrantfile +++ b/templates/template10-redis-server/Vagrantfile @@ -4,26 +4,30 @@ Vagrant.configure("2") do |config| - config.vm.box = "hibox/focal64" + config.vm.box = "isc/forge-clt-ubuntu-22.04" + + config.vm.box_version = "1" config.vm.box_check_update = false - - ## This is the latest box version as of 17/06/2021 - config.vm.box_version = "1.0.1619509541" config.vm.provider 'lxd' do |lxd| lxd.api_endpoint = 'https://127.0.0.1:8443' lxd.timeout = 10 - lxd.name = 'redis-server' + lxd.name = '' + lxd.project = 'default' + lxd.profiles = ['default'] # lxd.nesting = nil # lxd.privileged = nil # lxd.ephemeral = false - # lxd.profiles = ['default'] # lxd.environment = {} # lxd.config = {} end - config.vm.provision :shell, path: "provision.sh" - + config.vm.provision "shell" do |s| + s.env = { + "MACHINE_HOSTNAME" => "", + } + s.path = "provision.sh" + end end diff --git a/templates/template10-redis-server/provision.sh b/templates/template10-redis-server/provision.sh index 07e8296..63bc229 100644 --- a/templates/template10-redis-server/provision.sh +++ b/templates/template10-redis-server/provision.sh @@ -6,15 +6,6 @@ echo "provisioning started: ${start_time}" -#### The user must fill these variables - START - -# Fully Qualified Name: ex. "redis.localenv.com" -MACHINE_HOSTNAME= - -#### The user must fill these variables - END - -SYSTEM_USER=usrv - NETWORK_INTERFACE=eth0 hostnamectl set-hostname ${MACHINE_HOSTNAME} @@ -56,10 +47,6 @@ echo "This container has IP (interface: ${NETWORK_INTERFACE}): ${ip_address}" -echo "If you add this IP to the hostname (${MACHINE_HOSTNAME}) in your hosts file:" - -echo " You can connect with user ${SYSTEM_USER} via ssh (password ${SYSTEM_USER}): ssh ${SYSTEM_USER}@${MACHINE_HOSTNAME}" - echo "provisioning started: ${start_time}" echo "provisioning ended: ${end_time}"