Creating a new virtual host
This page describes how to create a new Elentra vhost instance locally, in order to avoid switching versions in the same vhost (and the mayhem that typically ensues)
Creating a separate virtual host (vhost), with its own clone of the elentra-1x-me
repository, and its own database, can be very useful because it allows you to keep the same version (e.g. release/1.26
), without needing to switch between versions when you need to work on a different Elentra version.
By setting up additional vhosts, you can have local Elentra instances for multiple versions of Elentra, for example your institution's branded edition and the consortium version, or previously-supported releases.
Steps
Change to the
elentra-developer
directory:cd ~/Documents/elentra-developer
Create a new Apache configuration file for the new vhost:
cp resources/vhosts/elentra-1x-me.localhost.conf resources/vhosts/uni-elentra.localhost.conf
Modify the new
resources/vhosts/uni-elentra.localhost.conf
file to use a different source code path and hostname, for example the following:# Disable so that CSS/JS will refresh properly. EnableSendfile On <VirtualHost *:80> ServerName uni-elentra.localhost # <- CHANGE # Required because of /etc/httpd/conf.d/php.conf hardcoded defaults <IfModule mod_php7.c> php_value session.save_handler redis php_value session.save_path "tcp://redis:6379?auth=password" </IfModule> DocumentRoot /var/www/vhosts/uni-elentra-1x-me/www-root # <- CHANGE <Directory "/var/www/vhosts/uni-elentra-1x-me/www-root"> # <- CHANGE Options FollowSymLinks Require all granted AllowOverride all </Directory> <FilesMatch \.(php|phar)$> SetHandler "proxy:unix:/var/run/php-fpm/www.sock|fcgi://localhost" </FilesMatch> ProxyPass "/app/" "ws://localhost:${WEBSOCKET_PORT}/app/" ProxyPassReverse "/app/" "ws://localhost:${WEBSOCKET_PORT}/app/" ProxyPass "/apps/" "http://localhost:${WEBSOCKET_PORT}/apps/" ProxyPassReverse "/apps/" "http://localhost:${WEBSOCKET_PORT}/apps/" </VirtualHost>
If your new instance will run a version of Elentra ME that uses an older version of PHP (e.g. 7.4), then you may want to hard code the the version of the PHP in the sock file used. This way, you won't have to manually switch PHP versions when developing on multiple versions at the same time:
<FilesMatch \.(php|phar)$> SetHandler "proxy:unix:/var/opt/php/7.4/run/php-fpm/www.sock|fcgi://localhost" </FilesMatch>
For the new changes to take effect, restart the docker container:
./developer down ./developer up
Add an entry to the
/etc/hosts
file for the new vhost:127.0.0.1 uni-elentra.localhost
Clone the
elentra-1x-me
andelentra-1x-api
repositories from your remote, for example:cd ~/Sites git clone [email protected]:MyUni/elentra-1x-me.git uni-elentra-1x-me git clone [email protected]:MyUni/elentra-1x-api.git uni-elentra-1x-api
Set up the composer dependencies as per the Getting Started section.
./developer shell cd /var/www/vhosts/uni-elentra-1x-me composer install npm install npm run build
Create an empty database (or optionally import/scrub from staging)
CREATE DATABASE uni_elentra_auth; CREATE DATABASE uni_elentra_me; CREATE DATABASE uni_elentra_me_clerkship; CREATE DATABASE uni_elentra_cbe; GRANT ALL PRIVILEGES ON uni_elentra_auth.* TO elentra; GRANT ALL PRIVILEGES ON uni_elentra_me.* TO elentra; GRANT ALL PRIVILEGES ON uni_elentra_me_clerkship.* TO elentra; GRANT ALL PRIVILEGES ON uni_elentra_cbe.* TO elentra;
Run the setup script by visiting http://uni-elentra.localhost/.
Update the hostname to be
http://uni-elentra.localhost
instead of the default.Update the database to be
uni_elentra_me
,uni_elentra_auth
, etc. instead of the defaults.
Run the database migrations in the
elentra-1x-me
directory:php elentra migrate --up
Last updated