Website/vagrant/README.md

137 lines
4.4 KiB
Markdown
Raw Normal View History

2020-01-05 11:05:02 +01:00
# This Vagrant setup is still Work in Progress, though it can be used as is.
2019-03-09 08:55:17 +01:00
# Disroot Website Development Environment using Vagrant
If you prefer the easy way, just execute the vagrant.sh script provided. Make sure your user is in sudoers first. ⚠️ It has been tested with Debian Buster only. ⚠️
2019-03-09 08:55:17 +01:00
## requirements
2020-10-28 09:04:09 +01:00
1. vagrant 2.2.10
2019-03-09 08:55:17 +01:00
for install on Debian run commands:
```
2020-10-28 09:04:09 +01:00
wget https://releases.hashicorp.com/vagrant/2.2.10/vagrant_2.2.10_x86_64.deb
2019-03-09 08:55:17 +01:00
```
```
2020-10-28 09:04:09 +01:00
sudo dpkg -i vagrant_2.2.10_x86_64.deb
2019-03-09 08:55:17 +01:00
```
```
sudo apt install -f
```
2. virtuabox
2019-11-05 14:35:57 +01:00
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
2019-11-05 14:35:57 +01:00
```
```
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
```
2019-03-09 08:55:17 +01:00
3. vagrant plugins vagrant-vbguest:
for install on Debian run commands:
```
vagrant plugin install vagrant-vbguest
```
4. git
```
sudo apt install git
```
## Installation
2020-01-03 10:09:39 +01:00
1. Create a Disroot folder, in which you'll clone three repositories:
2019-03-09 08:55:17 +01:00
```
2020-01-03 10:09:39 +01:00
mkdir ~/Disroot
2019-03-09 08:55:17 +01:00
```
2020-01-03 10:09:39 +01:00
2. Clone disroot-website repo to Disroot folder
```
2020-02-02 11:09:27 +01:00
git clone https://git.disroot.org/Disroot/Website.git ~/Disroot/Website
```
2020-01-05 11:05:02 +01:00
3. Clone grav-theme-disroot repo to Disroot folder
```
2020-02-02 11:09:27 +01:00
git clone https://git.disroot.org/Disroot/grav-theme-disroot.git ~/Disroot/grav-theme-disroot
2020-01-03 10:09:39 +01:00
```
2020-10-28 08:42:11 +01:00
4. Clone grav-theme-disrootblog repo to Disroot folder
```
git clone https://git.disroot.org/Disroot/grav-theme-disrootblog.git ~/Disroot/grav-theme-disrootblog
```
5. Clone grav-plugin-language-selector repo to Disroot folder
2020-01-03 10:09:39 +01:00
```
2020-02-02 11:09:27 +01:00
git clone https://git.disroot.org/Disroot/grav-plugin-language-selector.git ~/Disroot/grav-plugin-language-selector
```
2020-10-28 08:42:11 +01:00
6. Clone Disroot-Privacy-Policy repo to Disroot folder
```
git clone https://git.disroot.org/Disroot/Disroot-Privacy-Policy.git ~/Disroot/Disroot-Privacy-Policy
```
7. Clone Disroot Changelog repo to Disroot folder
```
git clone https://git.disroot.org/Disroot/CHANGELOG.git ~/Disroot/Disroot-Privacy-Policy
```
8. Add the local domain name for the hub to your host machine's `/etc/hosts` file.
2019-03-09 08:55:17 +01:00
```
echo "192.168.33.12 disroot.lan" >> /etc/hosts
```
9. Launch Vagrant to build the virtual machine (VM). This will take several minutes.
2019-03-09 08:55:17 +01:00
```
2020-01-03 10:09:39 +01:00
cd ~/Disroot/disroot-website/vagrant
2019-03-09 08:55:17 +01:00
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
```
2020-01-03 10:09:39 +01:00
cd ~/Disroot/disroot-website/vagrant
2019-03-09 08:55:17 +01:00
vagrant up disroot_lan
vagrant provision
2019-03-09 08:55:17 +01:00
```
### 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
```
2020-01-05 11:05:02 +01:00
2. Use `vagrant ssh disroot_lan` to log in to the virtual machine.
2019-03-09 08:55:17 +01:00
```
2020-01-05 11:05:02 +01:00
user@host:~$ cd ~/Disroot/disroot-website/vagrant
2019-03-09 08:55:17 +01:00
user@host:hubzilla-vagrant$ vagrant ssh disroot_lan
```
2020-01-05 11:05:02 +01:00
3. Switch to root and add your host user public key.
2019-03-09 08:55:17 +01:00
```
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
```
2020-01-05 11:05:02 +01:00
4. From your host machine, you may now SSH into the virtual machine using
2019-03-09 08:55:17 +01:00
```
ssh root@disroot.lan
```