Merge pull request #10783 from tobiasd/20211001-Vagrant

Vagrant updates
This commit is contained in:
fabrixxm 2021-10-01 10:35:57 +02:00 committed by GitHub
commit e73be051ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 31 deletions

6
Vagrantfile vendored
View File

@ -6,8 +6,8 @@ server_timezone = "UTC"
public_folder = "/vagrant" public_folder = "/vagrant"
Vagrant.configure(2) do |config| Vagrant.configure(2) do |config|
# Set server to Debian 10 / Buster 64bit # Set server to Debian 11 / Bullseye 64bit
config.vm.box = "debian/buster64" config.vm.box = "debian/bullseye64"
# Disable automatic box update checking. If you disable this, then # Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs # boxes will only be checked for updates when the user runs
@ -24,7 +24,7 @@ Vagrant.configure(2) do |config|
# Share a folder between host and guest # Share a folder between host and guest
# config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", owner: "www-data", group: "vagrant" # config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", owner: "www-data", group: "vagrant"
config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", owner: "www-data", group: "www-data" config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", owner: "www-data", group: "www-data", type: "virtualbox"
# Provider-specific configuration so you can fine-tune various # Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options. # backing providers for Vagrant. These expose provider-specific options.

View File

@ -82,7 +82,7 @@ echo ">>> Installing 'Local Only' postfix"
debconf-set-selections <<< "postfix postfix/mailname string friendica.local" debconf-set-selections <<< "postfix postfix/mailname string friendica.local"
debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Local Only'" debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Local Only'"
apt-get install -qq postfix mailutils libmailutils-dev apt-get install -qq postfix mailutils libmailutils-dev
echo -e "friendica1: vagrant\nfriendica2: vagrant\nfriendica3: vagrant\nfriendica4: vagrant\nfriendica5: vagrant" >> /etc/aliases && newaliases echo -e "$ADMIN_NICK: vagrant\n$USER_NICK: vagrant" >> /etc/aliases && newaliases
# Friendica needs git for fetching some dependencies # Friendica needs git for fetching some dependencies
echo ">>> Installing git" echo ">>> Installing git"
@ -93,13 +93,8 @@ echo ">>> Symlink /var/www to /vagrant"
rm -rf /var/www/ rm -rf /var/www/
ln -fs /vagrant /var/www ln -fs /vagrant /var/www
# install deps with composer # Setup Friendica
echo ">>> Installing php requirements"
apt install unzip
cd /var/www cd /var/www
php bin/composer.phar install
echo ">>> Setup Friendica" echo ">>> Setup Friendica"
# copy the .htaccess-dist file to .htaccess so that rewrite rules work # copy the .htaccess-dist file to .htaccess so that rewrite rules work
@ -120,10 +115,6 @@ bin/console user password "$ADMIN_NICK" "$ADMIN_PASSW"
bin/console user add "$USER_NICK" "$USER_NICK" "$USER_NICK@friendica.local" en bin/console user add "$USER_NICK" "$USER_NICK" "$USER_NICK@friendica.local" en
bin/console user password "$USER_NICK" "$USER_PASSW" bin/console user password "$USER_NICK" "$USER_PASSW"
# set the admin
bin/console config config admin_email ""$ADMIN_NICK@friendica.local""
# create cronjob - activate if you have enough memory in you dev VM # create cronjob - activate if you have enough memory in you dev VM
# cronjob runs as www-data user # cronjob runs as www-data user
echo ">>> Installing cronjob" echo ">>> Installing cronjob"

View File

@ -10,27 +10,27 @@ Getting started
No need to setup up a webserver, database etc. before actually starting. No need to setup up a webserver, database etc. before actually starting.
Vagrant creates a virtual machine for you that you can just run inside VirtualBox and start to work directly on Friendica. Vagrant creates a virtual machine for you that you can just run inside VirtualBox and start to work directly on Friendica.
It brings an Ubuntu Xenial (16.04) with PHP 7.0 and MySQL 5.7.16 It brings an Debian Bullseye with PHP 7.4 and MariaDB 10.5.11.
What you need to do: What you need to do:
1. Install VirtualBox and vagrant. 1. Install VirtualBox and vagrant.
Please use an up-to-date vagrant version from https://www.vagrantup.com/downloads.html. Please use an up-to-date vagrant version from https://www.vagrantup.com/downloads.html.
2. Git clone your Friendica repository. 2. Git clone your Friendica repository.
Inside, you'll find a "Vagrantfile" and some scripts in the utils folder. Inside, you'll find a `Vagrantfile` and some scripts in the `bin/dev` folder.
3. Run "vagrant up" from inside the friendica clone: Pull the PHP requirements with `bin/composer install`.
$> vagrant up 3. Run `vagrant up` from inside the friendica clone.
Be patient: When it runs for the first time, it downloads an Ubuntu Server image. This will start the virtual machine.
4. Run "vagrant ssh" to log into the virtual machine to log in to the VM: Be patient: When it runs for the first time, it downloads a Debian Server image and installs Friendica.
$> vagrant ssh 4. Run `vagrant ssh` to log into the virtual machine to log in to the VM in case you need to debug something on the server.
5. Open you test installation in a browser. 5. Open you test installation in a browser.
Go to 192.168.22.10. Go to friendica.local (or 192.168.22.10).
friendica.local is using a self-signed TLS certificate, so you will need to add an exception to trust the certificate the first time you are visiting the page.
The mysql database is called "friendica", the mysql user and password both are "friendica". The mysql database is called "friendica", the mysql user and password both are "friendica".
6. Work on Friendica's code in your git clone on your machine (not in the VM). 6. Work on Friendica's code in your git clone on your machine (not in the VM).
Your local working directory is set up as a shared directory with the VM (/vagrant). Your local working directory is set up as a shared directory with the VM (/vagrant).
7. Check the changes in your browser in the VM. 7. Check the changes in your browser in the VM.
Debug via the "vagrant ssh" login. Find the Friendica log file `/vagrant/logfile.out` on the VM or in the `logfile.out` in you local Friendica directory.
Find the Friendica log file /vagrant/logfile.out.
8. Commit and push your changes directly back to Github. 8. Commit and push your changes directly back to Github.
If you want to stop vagrant after finishing your work, run the following command If you want to stop vagrant after finishing your work, run the following command
@ -46,13 +46,24 @@ This will not delete the virtual machine.
to make sure that you can start from scratch with another "vagrant up". to make sure that you can start from scratch with another "vagrant up".
The vagrant Friendica instance contains a test database. Default User Accounts
You will then have the following accounts to login: ---------------------
By default the provision script will setup two user accounts.
* admin, password admin * admin, password admin
* friendica1, password friendica1 * friendica, password friendica
* friendica2, password friendica2 and so on until friendica5
* friendica1 is connected to all others. friendica1 has two groups: group1 with friendica2 and friendica4, group2 with friendica3 and friendica5. Trouble Shooting
* friendica2 and friendica3 are connected. friendica4 and friendica5 are connected. ----------------
If you see a version mis-match for the _VirtualBox Guest Additions_ between host and guest during the initial setup of the Vagrant VM, you will need to install an addon to Vagrant (ref. [Stack Overflow](https://stackoverflow.com/a/38010683)).
Stop the Vagrant VM and run the following command:
$> vagrant plugin install vagrant-vbguest
On the next Vagrant up, the version problem should be fixed.
If `friendica.local` is not resolved, you may need to add an entry to the `/etc/hosts` file (or similar configuration depending on the OS you are using).
For further documentation of vagrant, please see [the vagrant*docs*](https://docs.vagrantup.com/v2/). For further documentation of vagrant, please see [the vagrant*docs*](https://docs.vagrantup.com/v2/).