forked from Disroot/Howto
upgrade vagrant files
This commit is contained in:
parent
a33e42a332
commit
4935ec3eeb
3 changed files with 67 additions and 37 deletions
|
@ -1,59 +1,75 @@
|
|||
# This Vagrant setup is still Work in Progress, though it can be used as is.
|
||||
|
||||
# Disroot Howto Development Environment using Vagrant
|
||||
|
||||
## requrements
|
||||
1. vagrant 2.2.1
|
||||
## requirements
|
||||
1. vagrant 2.2.6
|
||||
for install on Debian run commands:
|
||||
```
|
||||
wget https://releases.hashicorp.com/vagrant/2.2.1/vagrant_2.2.1_x86_64.deb
|
||||
wget https://releases.hashicorp.com/vagrant/2.2.6/vagrant_2.2.6_x86_64.deb
|
||||
```
|
||||
```
|
||||
sudo dpkg -i vagrant_2.2.1_x86_64.deb
|
||||
sudo dpkg -i vagrant_2.2.6_x86_64.deb
|
||||
```
|
||||
```
|
||||
sudo apt install -f
|
||||
```
|
||||
|
||||
2. virtuabox
|
||||
for install on Debian run command:
|
||||
for install on Debian Jessie run command:
|
||||
```
|
||||
sudo apt install virtualbox-6.0
|
||||
```
|
||||
|
||||
for install on Debian Buster run command:
|
||||
```
|
||||
sudo echo 'deb http://download.virtualbox.org/virtualbox/debian buster contrib' > /etc/apt/sources.list.d/virtualbox.list
|
||||
```
|
||||
```
|
||||
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
|
||||
wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
|
||||
```
|
||||
```
|
||||
sudo apt-get update ; sudo apt-get install virtualbox-6.0
|
||||
```
|
||||
|
||||
3. vagrant plugins vagrant-vbguest:
|
||||
for install on Debian run commands:
|
||||
```
|
||||
vagrant plugin install vagrant-vbguest
|
||||
```
|
||||
```
|
||||
vagrant vbguest
|
||||
```
|
||||
|
||||
4. git
|
||||
4. git
|
||||
```
|
||||
sudo apt install git
|
||||
```
|
||||
|
||||
## Installation
|
||||
## Installation
|
||||
|
||||
1. Clone howto repo to howto project folder
|
||||
1. Create a Disroot folder, in which you'll clone the repository:
|
||||
```
|
||||
mkdir ~/Disroot
|
||||
```
|
||||
2. Clone howto repo to Disroot folder
|
||||
```
|
||||
git clone https://git.fosscommunity.in/disroot/howto.git ~/howto
|
||||
```
|
||||
2. Add the local domain name for the hub to your host machine's `/etc/hosts` file.
|
||||
3. Add the local domain name for the hub to your host machine's `/etc/hosts` file.
|
||||
|
||||
```
|
||||
echo "192.168.33.11 howto.disroot.lan" >> /etc/hosts
|
||||
```
|
||||
3. Launch Vagrant to build the virtual machine (VM). This will take several minutes.
|
||||
4. Launch Vagrant to build the virtual machine (VM). This will take several minutes.
|
||||
```
|
||||
cd ~/howto/vagrant
|
||||
cd ~/Disroot/howto/vagrant
|
||||
vagrant up howto_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 ~/howto/vagrant
|
||||
cd ~/Disroot/howto/vagrant
|
||||
vagrant up howto_disroot_lan
|
||||
vagrant provision
|
||||
```
|
||||
|
||||
### Enable SSH access
|
||||
|
@ -65,12 +81,12 @@ To make your development workflow more efficient, you may wish to use an SSH con
|
|||
user@host:~$ cat ~/.ssh/id_rsa.public
|
||||
ssh-rsa eLX1UQbJHUCHf2V3K7YlMP0YmIT+50rlEsWre1eobApKb0Ac/WbvssX/Gh/ user@host
|
||||
```
|
||||
1. Use `vagrant ssh howto_disroot_lan` to log in to the virtual machine.
|
||||
2. Use `vagrant ssh howto_disroot_lan` to log in to the virtual machine.
|
||||
```
|
||||
user@host:~$ cd ~/howto/vagrant
|
||||
user@host:~$ cd ~/Disroot/howto/vagrant
|
||||
user@host:hubzilla-vagrant$ vagrant ssh howto_disroot_lan
|
||||
```
|
||||
1. Switch to root and add your host user public key.
|
||||
3. Switch to root and add your host user public key.
|
||||
```
|
||||
vagrant@stretch:~$ sudo -i
|
||||
root@jessie:~# ssh-keygen
|
||||
|
@ -97,8 +113,7 @@ To make your development workflow more efficient, you may wish to use an SSH con
|
|||
+-----------------+
|
||||
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
|
||||
4. From your host machine, you may now SSH into the virtual machine using
|
||||
```
|
||||
ssh root@howto.disroot.lan
|
||||
```
|
||||
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
WEB_NAME="howto.disroot.lan"
|
||||
WEB_ROOT="/var/www/"
|
||||
WWW_USER="www-data"
|
||||
|
||||
|
||||
YAML="/var/www/howto.disroot.lan/user/config/system.yaml"
|
||||
|
||||
# Provisioning actions
|
||||
|
||||
|
@ -14,16 +13,21 @@ sudo apt-get -y update
|
|||
sudo apt-get -y upgrade
|
||||
sudo apt-get -y install ca-certificates apt-transport-https
|
||||
echo "deb https://packages.sury.org/php/ stretch main" | sudo tee -a /etc/apt/sources.list.d/php.list
|
||||
# Sury Key for PHP7.1
|
||||
|
||||
# Sury Key for PHP7.4
|
||||
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
|
||||
sudo apt-get -y update
|
||||
|
||||
echo "Installing nginx.."
|
||||
sudo apt-get install -y nginx-full composer
|
||||
echo "Installing php7.."
|
||||
sudo apt-get install -y php7.3-zip php7.3-cli php7.3-curl php7.3-gd php7.3-mbstring php7.3-xml php7.3-fpm
|
||||
echo "Installing nginx..."
|
||||
sudo apt-get install -y nginx-full
|
||||
|
||||
# Create the Apache config files and restart webserver
|
||||
echo "Installing composer..."
|
||||
sudo apt-get install -y composer
|
||||
|
||||
echo "Installing php7..."
|
||||
sudo apt-get install -y php7.4-zip php7.4-cli php7.4-curl php7.4-gd php7.4-mbstring php7.4-xml php7.4-fpm
|
||||
|
||||
# Create the Nginx config files and restart webserver
|
||||
sudo rsync -cr /vagrant/provision/etc/nginx/sites-available /etc/nginx/
|
||||
sudo ln -s /etc/nginx/sites-available/"${WEB_NAME}".conf /etc/nginx/sites-enabled/"${WEB_NAME}".conf
|
||||
sudo rm /etc/nginx/sites-enabled/default
|
||||
|
@ -31,7 +35,7 @@ sudo service nginx restart
|
|||
|
||||
# Install GRAV in webroot
|
||||
sudo chown -R ${WWW_USER}:${WWW_USER} /var/www
|
||||
sudo wget https://getcomposer.org/download/1.8.0/composer.phar -O /usr/local/bin/composer && sudo chmod 755 /usr/local/bin/composer
|
||||
sudo wget https://getcomposer.org/download/1.9.1/composer.phar -O /usr/local/bin/composer && sudo chmod 755 /usr/local/bin/composer
|
||||
echo "Git"
|
||||
git clone -b master https://github.com/getgrav/grav.git "${WEB_ROOT}""${WEB_NAME}"
|
||||
sudo chown -R ${WWW_USER}:${WWW_USER} "${WEB_ROOT}"
|
||||
|
@ -46,20 +50,28 @@ sudo -u "${WWW_USER}" bin/grav install
|
|||
sudo -u "${WWW_USER}" bin/gpm install language-selector
|
||||
sudo -u "${WWW_USER}" bin/gpm install form
|
||||
sudo -u "${WWW_USER}" bin/gpm install simplesearch
|
||||
sudo -u "${WWW_USER}" sed -i 's/quark/grav-theme-howto/g' "${WEB_ROOT}""${WEB_NAME}"/user/config/system.yaml
|
||||
sudo -u "${WWW_USER}" ex -s -c '13i|redirect_default_route: true' -c x "${WEB_ROOT}""${WEB_NAME}"/user/config/system.yaml
|
||||
sudo -u "${WWW_USER}" echo "
|
||||
sudo -u "${WWW_USER}" sed -i 's/quark/grav-theme-howto/g' "${YAML}"
|
||||
|
||||
# Add Grav config
|
||||
if ! grep -q redirect_default_route "${YAML}" ; then
|
||||
sudo -u "${WWW_USER}" ex -s -c '13i| redirect_default_route: true' -c x "${YAML}"
|
||||
fi
|
||||
|
||||
if ! grep -q languages "${YAML}" ; then
|
||||
sudo -u "${WWW_USER}" echo "
|
||||
languages:
|
||||
supported:
|
||||
- en
|
||||
- es
|
||||
- fr
|
||||
- it
|
||||
- pl
|
||||
- pt
|
||||
- de" >> "${WEB_ROOT}""${WEB_NAME}"/user/config/system.yaml
|
||||
sudo -u "${WWW_USER}" sed -i '4d' "${WEB_ROOT}""${WEB_NAME}"/user/config/system.yaml
|
||||
sudo -u "${WWW_USER}" ex -s -c "4i| alias: '/home'" -c x "${WEB_ROOT}""${WEB_NAME}"/user/config/system.yaml
|
||||
- de
|
||||
- ru" >> "${YAML}"
|
||||
fi
|
||||
|
||||
sudo -u "${WWW_USER}" ex -s -c "4i| alias: '/home'" -c x "${YAML}"
|
||||
sudo -u "${WWW_USER}" sed -i '4d' "${YAML}"
|
||||
sudo -u "${WWW_USER}" -i 's/false/true/g' "${WEB_ROOT}""${WEB_NAME}"/user/plugins/language-selector/language-selector.yaml
|
||||
|
||||
# Add website domain to local /etc/hosts file
|
||||
|
@ -68,5 +80,8 @@ sudo sed -i "s/127.0.0.1\tlocalhost/127.0.0.1\tlocalhost ${WEB_NAME}/" /etc/host
|
|||
#Add website pages in GRAV
|
||||
sudo mount -o bind /var/www/pages "${WEB_ROOT}""${WEB_NAME}"/user/pages
|
||||
chown "${WWW_USER}":"${WWW_USER}" -R "${WEB_ROOT}""${WEB_NAME}"/user/pages
|
||||
|
||||
#Add Disroot theme in GRAV
|
||||
sudo -u www-data ln -s /var/www/themes/grav-theme-howto "${WEB_ROOT}""${WEB_NAME}"/user/themes/grav-theme-howto
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -29,7 +29,7 @@ server {
|
|||
location ~ /(LICENSE.txt|composer.lock|composer.json|nginx.conf|web.config|htaccess.txt|\.htaccess) { return 403; }
|
||||
|
||||
location ~ \.php$ {
|
||||
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
|
||||
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
|
|
Loading…
Reference in a new issue