From c9386744318329d8a591f25932a4b7e6d49768cd Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 3 Sep 2018 23:10:38 +0200 Subject: [PATCH] =?UTF-8?q?Zblerg=C2=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 8 --- Vagrantfile | 35 +++++++++++ deploy.sh | 26 +++++++++ .../stretch-unstable/virtualbox/vagrant_cwd | 1 + prebuild/README.md | 38 ++++++++++++ prebuild/Vagrantfile | 58 +++++++++++++++++++ prebuild/prebuild.sh | 23 ++++++++ 7 files changed, 181 insertions(+), 8 deletions(-) create mode 100755 Vagrantfile create mode 100755 deploy.sh create mode 100644 prebuild/.vagrant/machines/stretch-unstable/virtualbox/vagrant_cwd create mode 100644 prebuild/README.md create mode 100644 prebuild/Vagrantfile create mode 100755 prebuild/prebuild.sh diff --git a/.gitignore b/.gitignore index dc8719b..74b2c58 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,3 @@ -# Apps -*_ynh - -# Tools -vagrant -ynh-dev-tools -Vagrantfile - # Sources repositories moulinette yunohost diff --git a/Vagrantfile b/Vagrantfile new file mode 100755 index 0000000..e3af2f8 --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,35 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! +VAGRANTFILE_API_VERSION = "2" + +NETWORK = "192.168.33." + +HOSTS = { + "ynh-dev" => ["83", "stretch-unstable"], + "ynh-dev-buster" => ["84", "buster-unstable"], +} + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + + # Force guest type, because YunoHost /etc/issue can't be tuned + config.vm.guest = :debian + + HOSTS.each do | (name, cfg) | + ipaddr, version = cfg + + config.vm.define name do |machine| + machine.vm.box = "yunohost/" + version + # Force guest type, because YunoHost /etc/issue can't be tuned + machine.vm.guest = :debian + + machine.vm.provider "lxc" do |lxc| + config.vm.box_url = "https://build.yunohost.org/yunohost-" + version + "-lxc.box" + config.vm.synced_folder ".", "/ynh-dev", id: "vagrant-root" + config.vm.network :private_network, ip: NETWORK + ipaddr, lxc__bridge_name: 'lxcbr0' + end + end + end # HOSTS-each + +end diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 0000000..0bd536f --- /dev/null +++ b/deploy.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +read -p "This script will create a new 'ynh-dev' folder with a dev environment inside. Is this okay ? [Y/N]" -n 1 -r +echo $REPLY +[[ $REPLY =~ ^[Yy]$ ]] || { echo "Aborting."; exit 1; } + +set -x + +sudo apt-get install vagrant lxc git -y + +git clone https://github.com/YunoHost/ynh-dev +cd ./ynh-dev +git clone https://github.com/YunoHost/moulinette +git clone https://github.com/YunoHost/yunohost +git clone https://github.com/YunoHost/yunohost-admin +git clone https://github.com/YunoHost/SSOwat ssowat + +mkdir -p apps + +set +x + +echo " " +echo "---------------------------------------------------------------" +echo "Done ! You should cd into 'ynh-dev' then run './ynh-dev --help'" +echo "---------------------------------------------------------------" +echo " " diff --git a/prebuild/.vagrant/machines/stretch-unstable/virtualbox/vagrant_cwd b/prebuild/.vagrant/machines/stretch-unstable/virtualbox/vagrant_cwd new file mode 100644 index 0000000..8ea7d2b --- /dev/null +++ b/prebuild/.vagrant/machines/stretch-unstable/virtualbox/vagrant_cwd @@ -0,0 +1 @@ +/home/alex/dev/ynh-dev/VagrantFile/prebuild \ No newline at end of file diff --git a/prebuild/README.md b/prebuild/README.md new file mode 100644 index 0000000..39eca9d --- /dev/null +++ b/prebuild/README.md @@ -0,0 +1,38 @@ +# Build your own YunoHost Vagrant box + +## Get Debian base boxes + +```bash +vagrant box add debian/stretch64 +``` + +## Build YunoHost boxes + +Download the vagrant file to build from debian boxes + +```bash +wget https://raw.githubusercontent.com/YunoHost/Vagrantfile/master/prebuild/Vagrantfile +``` + +## Run your homemade boxes + +Run the box you need by calling `vagrant up DEBIAN_CODENAME-YUNOHOST_VERSION` + +```bash +vagrant up stretch-unstable --provider lxc +``` + +- `DEBIAN_CODENAME`: `jessie` or `stretch` +- `DISTRIB`: `unstable`. + +You can now log into your box with `vagrant ssh stretch-unstable` + +## Package your own boxes + +You can package it to use it more quickly later: + +```bash +vagrant up stretch-unstable --provider lxc +vagrant package stretch-unstable --output ./my-yunohost-stretch-unstable-lxc.box --provider lxc +vagrant box add my-yunohost/stretch-unstable ./my-yunohost-stretch-unstable-lxc.box --provider lxc +``` diff --git a/prebuild/Vagrantfile b/prebuild/Vagrantfile new file mode 100644 index 0000000..86e45ec --- /dev/null +++ b/prebuild/Vagrantfile @@ -0,0 +1,58 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! +VAGRANTFILE_API_VERSION = "2" + +$script = <