mirror of
https://github.com/YunoHost/ynh-dev.git
synced 2024-09-03 20:05:59 +02:00
Zblerg²
This commit is contained in:
parent
7bff693e85
commit
c938674431
7 changed files with 181 additions and 8 deletions
8
.gitignore
vendored
8
.gitignore
vendored
|
@ -1,11 +1,3 @@
|
|||
# Apps
|
||||
*_ynh
|
||||
|
||||
# Tools
|
||||
vagrant
|
||||
ynh-dev-tools
|
||||
Vagrantfile
|
||||
|
||||
# Sources repositories
|
||||
moulinette
|
||||
yunohost
|
||||
|
|
35
Vagrantfile
vendored
Executable file
35
Vagrantfile
vendored
Executable file
|
@ -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
|
26
deploy.sh
Executable file
26
deploy.sh
Executable file
|
@ -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 " "
|
|
@ -0,0 +1 @@
|
|||
/home/alex/dev/ynh-dev/VagrantFile/prebuild
|
38
prebuild/README.md
Normal file
38
prebuild/README.md
Normal file
|
@ -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
|
||||
```
|
58
prebuild/Vagrantfile
vendored
Normal file
58
prebuild/Vagrantfile
vendored
Normal file
|
@ -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 = <<SCRIPT
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# Configure guest hostname
|
||||
sudo bash -c 'echo 127.0.1.1 yunohost.yunohost.org yunohost >> /etc/hosts'
|
||||
sudo hostname yunohost.yunohost.org
|
||||
sudo bash -c 'echo yunohost.yunohost.org > /etc/hostname'
|
||||
|
||||
# Define root password
|
||||
echo -e "yunohost\nyunohost" | sudo passwd root
|
||||
|
||||
# Allow sudo removal (YunoHost use sudo-ldap)
|
||||
export SUDO_FORCE_REMOVE=yes
|
||||
|
||||
# Upgrade guest (done in install script)
|
||||
sudo apt-get update
|
||||
sudo apt-get -y --force-yes upgrade
|
||||
sudo apt-get -y --force-yes dist-upgrade
|
||||
|
||||
# Install YunoHost
|
||||
wget https://raw.githubusercontent.com/YunoHost/install_script/stretch/install_yunohost -q -O /tmp/install_yunohost
|
||||
sudo bash /tmp/install_yunohost -a -d unstable
|
||||
|
||||
# Cleanup
|
||||
sudo apt-get clean -y
|
||||
SCRIPT
|
||||
|
||||
NETWORK = "10.0.3."
|
||||
|
||||
HOSTS = {
|
||||
"ynh-dev" => ["83", "stretch64"],
|
||||
"ynh-dev-buster" => ["84", "testing64"],
|
||||
}
|
||||
|
||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
|
||||
HOSTS.each do | (name, cfg) |
|
||||
|
||||
ipaddr, box = cfg
|
||||
|
||||
config.vm.define name do |machine|
|
||||
machine.vm.box = "debian/" + box
|
||||
machine.vm.provision "shell" do |s|
|
||||
s.inline = $script
|
||||
s.args = ""
|
||||
end
|
||||
machine.vm.provider "lxc" do |lxc|
|
||||
machine.vm.network :private_network, ip: NETWORK + ipaddr, lxc__bridge_name: 'lxcbr0'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
23
prebuild/prebuild.sh
Executable file
23
prebuild/prebuild.sh
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash
|
||||
|
||||
DEBIAN_VERSION="stretch"
|
||||
YNH_VERSION="unstable"
|
||||
PROVIDER="lxc"
|
||||
|
||||
# Compute box name
|
||||
BOX="$DEBIAN_VERSION-$YNH_VERSION"
|
||||
|
||||
# Create box
|
||||
vagrant up $BOX --provider $PROVIDER
|
||||
|
||||
# Package box
|
||||
vagrant package $BOX --output /tmp/yunohost-$BOX-$PROVIDER.box
|
||||
|
||||
# Destroy current box
|
||||
vagrant destroy $BOX
|
||||
|
||||
# User message, and exit
|
||||
echo ""
|
||||
echo "Your Vagrant box was packaged to /tmp/yunohost-$BOX-$PROVIDER.box"
|
||||
echo "You might want to run : vagrant box add "yunohost/$BOX" /tmp/yunohost-$BOX-$PROVIDER.box"
|
||||
exit
|
Loading…
Add table
Reference in a new issue