vagrant files for website - WIP

This commit is contained in:
antil0pa 2019-03-09 08:55:17 +01:00
parent c359bcb712
commit ee650f128c
14 changed files with 258 additions and 0 deletions

View File

@ -0,0 +1 @@
1.5:5d65abf9-8aeb-42ec-ae4a-72d18626952d

View File

@ -0,0 +1 @@
1548692645

View File

@ -0,0 +1 @@
{"name":"debian/stretch64","version":"9.4.0","provider":"virtualbox","directory":"boxes/debian-VAGRANTSLASH-stretch64/9.4.0/virtualbox"}

View File

@ -0,0 +1 @@
1000

View File

@ -0,0 +1 @@
5d65abf9-8aeb-42ec-ae4a-72d18626952d

View File

@ -0,0 +1 @@
c8c5655168dc442fb7539dbaa9fb8316

View File

@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAm9LoZvSWMyApgLW8rB6ZotHoA9NwA2ZxKZxgpkHgwj7y1eCW
CwtSDO0zrfKDkPQ2+aclLD3fg1oCit3N8sVd3mjgw23YCUl4uCoSsie+9cNzQdVe
lAW2gf8+522SXbQYMbGyblezugRxdnfqPcSAU5jrG1hCms6MjnGYGqw+mh04hqOk
RY38ugO2VQptsI4CLhVANl6Yp8LYG+ShtWfTfYLyWCOwVtEfUG7qt9AI0CujCwZG
K2vw1ugW69qxug0n5sUuygudfwZ2e5YywWpvTClmxkDIGKalyN7wbPaVAFrULSWr
2X4hp3fjY1Cc1tT6b2DtGLXIm/XvPXX1FGAdhQIDAQABAoIBAFTy1d/K11dn4ThZ
21G6HOe2p1XuntI7ttWIeugoYe+Dgb83gJTkxwZlChd6bl9Hw/C2Pn2v/XoOR/SM
lwoSrunhIydnaq8lbrp3tVmKcYBp3Ru2xqjLtIOKMzDXe0O6OrZcuXmONlzirzh2
hyzFQ3BPnVx68VST5eyB4PopjLdW/O/fG7LpoBLhfZ22k2UvBdmwbz4g+ftSGmmy
K3uINR9ZE/iUDxyV23hKVGtCkCJANR6jl8A4DntSbZLwwbmZvaRlonGXG4I0eQK8
zDdt09Lkq8KCDt0ELaQorcmk5LZPDAph8ejsHLWoKA0qsm3+Y+JwdcthEt0d07/C
zdtbCgECgYEAzVBvoE78vZ7x37XFA38YbKaBIZDyPgO9k9a8LSb8sEX05k9cf4Fx
akIqa2X8m3YMokj9vW65MGWZhcau//ToEzC4ArVR6BzpVkTcw821g7K2oTNrXoYi
f7i5noJMhaRVapinVavgth2aRhZd7C30miefEO3GruOAgPldGao1SjkCgYEAwkrA
tyMgL6dh+I/+U9414Kxy7HFCOLuM9s0JHtGwJgdq09jMo3kMww452+lzKMKsiRPw
/IANjx8ZxFpDRxO1XaNXTD6AhZ/oMdE5CiZOsSA1cme+PpZkbjqiJ0CgyR34yOVy
U1lO9pbJHA8FQ+o3uKo0j0V7b/Ieo5e9gL6Yna0CgYEAzI8nqIEKL6L9OfbQo/st
SpNadScFM+RmLbX1JseBW99XcWAAuMkvRr9FpFuoovuq+sXeia6XtDCGFVMvaLWJ
xBT2QTyGrsyfbuSNUEjUYLLeYx3oC/V4yegyiEsqErz4nYwarLDi4o/79Xize20O
F8kCIsvE+NqSXe4VZEzBa4ECgYADqg1AZvUwcOO0IGMXidVSS25Pb0NkdoUOEofd
gO7liLZHEIureZj4BMiqkRiO6D0AyNN+r5uR23BM97bVHFYLUg1Pbs5VttJWPi/p
NRe+13Cqm7JG0+dI/OoZ+2oM4PfUMh+Z2tFWbTmVweLDiSNL5Enhedn+Hn7dbvsv
9mhCcQKBgQCT9D08MlZClnS+AMbGn/0b/CTDDjCGkjjN8Ccf1PLOzuvkZ78ihV5d
eSE5kS90ZvB5s5l7Ztbi3PYTEkGMZ5ijCf65OiusTK6kXdr30GTO0Jr4NV+282cs
MC6xJskGGDwLBtoZaooQoFJMnZUdN15v96LBXSVy2GPqAjstud/Sdw==
-----END RSA PRIVATE KEY-----

View File

@ -0,0 +1 @@
{"rsync":{"/vagrant":{"type":"rsync","guestpath":"/vagrant","hostpath":"/home/fekete/git-repos/disroot/disroot-website/vagrant","disabled":false,"__vagrantfile":true,"owner":"vagrant","group":"vagrant"}},"virtualbox":{"/vagrant/provision/":{"guestpath":"/vagrant/provision","hostpath":"/home/fekete/git-repos/disroot/disroot-website/vagrant/provision","disabled":false,"__vagrantfile":true},"/var/www/disroot.lan/user/pages":{"owner":"www-data","group":"www-data","guestpath":"/var/www/disroot.lan/user/pages","hostpath":"/home/fekete/git-repos/disroot/disroot-website/pages","disabled":false,"__vagrantfile":true},"/var/www/disroot.lan/user/themes/":{"owner":"www-data","group":"www-data","guestpath":"/var/www/disroot.lan/user/themes","hostpath":"/home/fekete/git-repos/disroot/disroot-theme","disabled":false,"__vagrantfile":true},"/var/www/pages":{"owner":"www-data","group":"www-data","guestpath":"/var/www/pages","hostpath":"/home/fekete/git-repos/disroot/disroot-website/pages","disabled":false,"__vagrantfile":true}}}

View File

@ -0,0 +1 @@
/home/fekete/git-repos/disroot/disroot-website/vagrant-WIP

View File

@ -0,0 +1,9 @@
# 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

105
vagrant-WIP/README.md Normal file
View File

@ -0,0 +1,105 @@
## This Vagrant setup is still Work in Progress and not ready to use as is.
# Disroot Website Development Environment using Vagrant
## requirements
1. vagrant 2.2.1
for install on Debian run commands:
```
wget https://releases.hashicorp.com/vagrant/2.2.1/vagrant_2.2.1_x86_64.deb
```
```
sudo dpkg -i vagrant_2.2.1_x86_64.deb
```
```
sudo apt install -f
```
2. virtuabox
for install on Debian run command:
```
sudo apt install virtualbox-6.0
```
3. vagrant plugins vagrant-vbguest:
for install on Debian run commands:
```
vagrant plugin install vagrant-vbguest
```
```
vagrant vbguest
```
4. git
```
sudo apt install git
```
## Installation
1. Clone disroot-website repo to disroot-website project folder
```
git clone https://git.fosscommunity.in/disroot/disroot-website.git ~/disroot-website
```
2. Add the local domain name for the hub to your host machine's `/etc/hosts` file.
```
echo "192.168.33.12 disroot.lan" >> /etc/hosts
```
3. Launch Vagrant to build the virtual machine (VM). This will take several minutes.
```
cd ~/disroot-website/vagrant
vagrant up disroot_lan
```
Congratulations, you should now have a fully functioning apache+GRAV server running locally in a Virtualbox-hosted VM managed by Vagrant. Next time you want to run vagrant simply run command
```
cd ~/disroot-website/vagrant
vagrant up disroot_lan
```
### Enable SSH access
To make your development workflow more efficient, you may wish to use an SSH connection to rapidly synchronize the files you are developing in your local (host machine) development environment.
1. On your host machine, copy your public key.
```
user@host:~$ cat ~/.ssh/id_rsa.public
ssh-rsa eLX1UQbJHUCHf2V3K7YlMP0YmIT+50rlEsWre1eobApKb0Ac/WbvssX/Gh/ user@host
```
1. Use `vagrant ssh disroot_lan` to log in to the virtual machine.
```
user@host:~$ cd ~/disroot-website/vagrant
user@host:hubzilla-vagrant$ vagrant ssh disroot_lan
```
1. Switch to root and add your host user public key.
```
vagrant@stretch:~$ sudo -i
root@jessie:~# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
b4:e3:00:40:4f:c5:af:27:05:09:d4:70:29:ac:f8:51 root@jessie
The key's randomart image is:
+---[RSA 2048]----+
| .oo=*oo |
| +E.* |
| . oo. o. |
|. o . .o. |
| . . .oS |
| . oo.. |
| o. |
| |
| |
+-----------------+
root@stretch:~# echo "ssh-rsa eLX1UQbJHUCHf2V3K7YlMP0YmIT+50rlEsWre1eobApKb0Ac/WbvssX/Gh/ user@host" >> ~/.ssh/authorized_keys
```
1. From your host machine, you may now SSH into the virtual machine using
```
ssh root@disroot.lan
```

25
vagrant-WIP/Vagrantfile vendored Normal file
View File

@ -0,0 +1,25 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
config.vm.define "disroot_lan" do |disroot_lan|
disroot_lan.vm.box="debian/stretch64"
disroot_lan.vm.hostname = 'disroot.lan'
disroot_lan.vm.box_url = "debian/stretch64"
disroot_lan.vm.synced_folder "provision/", "/vagrant/provision/"
disroot_lan.vm.synced_folder "../pages/", "/var/www/disroot.lan/user/pages", owner: "www-data", group: "www-data"
disroot_lan.vm.synced_folder "../themes/", "/var/www/disroot.lan/user/themes/", owner: "www-data", group: "www-data"
disroot_lan.vm.network "forwarded_port", guest: 80, host: 8888, host_ip: "192.168.33.12"
disroot_lan.vm.network "forwarded_port", guest: 443, host: 4443, host_ip: "192.168.33.12"
disroot_lan.vm.network "private_network", ip: "192.168.33.12"
disroot_lan.vm.provision :shell, path: "bootstrap.sh"
end
end

64
vagrant-WIP/bootstrap.sh Executable file
View File

@ -0,0 +1,64 @@
#!/usr/bin/env bash
# Custom configuration
H2DIR="disroot.lan"
WEBROOT="/var/www/$H2DIR"
WWWUSER="www-data"
# Provisioning actions
# Add dotdeb repository to sources.list for PHP7.0
# echo "deb http://packages.dotdeb.org jessie all" | sudo tee -a /etc/apt/sources.list.d/dotdeb.list
# echo "deb-src http://packages.dotdeb.org jessie all" | sudo tee -a /etc/apt/sources.list.d/dotdeb.list
# Dotdeb Key for PHP7.0
# wget -qO - http://www.dotdeb.org/dotdeb.gpg | sudo apt-key add -
sudo apt-get -y update
echo "Installing Apache.."
sudo apt-get install -y apache2 composer
echo "Installing php7.."
sudo apt-get install -y php7.0-zip php7.0-cli php7.0-curl php7.0-gd php7.0-mysql php7.0-mbstring php7.0-xml libapache2-mod-php7.0 php7.0-mcrypt php7.0-fpm
# Enable all the Apache mods
sudo a2enmod proxy proxy_fcgi rewrite
sudo phpenmod mcrypt zip
# Create the Apache config files and restart webserver
sudo rsync -cr /vagrant/provision/etc/apache2/sites-available/ /etc/apache2/sites-available/
sudo sed -i "s/ServerName V_DOMAIN_NAME/ServerName $H2DIR/g" /etc/apache2/sites-available/*.conf
sudo sed -i "s/V_DOMAIN_NAME/$H2DIR/g" /etc/apache2/sites-available/*.conf
sudo a2ensite "$H2DIR".conf
sudo a2enconf php7.0-fpm
sudo rm /etc/apache2/sites-enabled/000-default.conf
sudo service apache2 restart
# Install GRAV in webroot
composer create-project getgrav/grav $WEBROOT
cd $WEBROOT
sudo chown -R www-data:www-data $WEBROOT
sudo chmod 775 -R bin/
sudo -u www-data bin/grav install
#sudo -u www-data bin/gpm install disroot
sudo -u www-data bin/gpm install language-selector
sudo -u www-data sed -i 's/quark/disroot/g' $WEBROOT/user/config/system.yaml
sudo -u www-data ex -s -c '13i|redirect_default_route: true' -c x $WEBROOT/user/config/system.yaml
sudo -u www-data echo "
languages:
supported:
- en
- es
- fr
- it" >> $WEBROOT/user/config/system.yaml
sudo -u www-data sed -i '4d' $WEBROOT/user/config/system.yaml
sudo -u www-data ex -s -c "4i| alias: '/home'" -c x $WEBROOT/user/config/system.yaml
sudo -u www-data sed -i 's/false/true/g' $WEBROOT/user/plugins/language-selector/language-selector.yaml
#sudo -u www-data cp $WEBROOT/user/plugins/language-selector/templates/partials/language-selector.html.twig $WEBROOT/user/themes/disroot/templates/partials/
#sudo -u www-data ex -s -c "9i| {% include 'partials/language-selector.hreflang.html.twig' %}" -c x $WEBROOT/user/themes/disroot/templates/partials/base.html.twig
#sudo -u www-data sed -i '2d' $WEBROOT/user/themes/disroot/css/layout.css
# Add website domain to local /etc/hosts file
sudo sed -i "s/127.0.0.1\tlocalhost/127.0.0.1\tlocalhost $H2DIR/" /etc/hosts
#Add website pages in GRAV
sudo -u www-data ln -s /var/www/pages/ /var/www/disroot.lan/user/
exit 0

View File

@ -0,0 +1,20 @@
<VirtualHost *:80>
ServerName V_DOMAIN_NAME
DocumentRoot /var/www/V_DOMAIN_NAME
<Directory /var/www/V_DOMAIN_NAME/>
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<IfModule mod_php7.c>
php_admin_value upload_max_filesize 100M
php_admin_value max_file_uploads 50
</IfModule>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>