$(eval sql_password := $(shell pwgen -1 -s 50))
apache_sites = '/etc/apache2/sites-available'
project_dir = `pwd`/${name}
-host = ${name}.localhost
+host = ${name}
+host_conf = ${name}.conf
help:
echo "Usage: prj-site OPERATION NAME [type] "
echo "> Setting group permissions of {project}/www to www-data, need root permissions to do that."
sudo chgrp -R www-data ${project_dir}/www
-${apache_sites}/${host}:
+${apache_sites}/${host_conf}:
echo "> Creating project's site configuration"
- sudo cp ${apache_sites}/dummy.localhost ${apache_sites}/${host}
+ sudo cp ${apache_sites}/dummy.conf ${apache_sites}/${host_conf}
-create-vhost: ${apache_sites}/${host}
- sudo sed -e "s/dummy/${name}/g" -i ${apache_sites}/${host}
- sudo sed -e "s@/var/www/${name}@${project_dir}/www@" -i ${apache_sites}/${host}
+create-vhost: ${apache_sites}/${host_conf}
+ sudo sed -e "s/dummy/${name}/g" -i ${apache_sites}/${host_conf}
+ sudo sed -e "s@/var/www/${name}@${project_dir}/www@" -i ${apache_sites}/${host_conf}
sudo a2ensite ${host}
sudo service apache2 reload
sudo rm -r ${project_dir}
remove-vhost:
- if test -f ${apache_sites}/${host}; then \
+ if test -f ${apache_sites}/${host_conf}; then \
echo "> Removing apache configuration file"; \
- sudo rm ${apache_sites}/${host}; \
+ sudo rm ${apache_sites}/${host_conf}; \
fi;
enable: enable-${type}
echo "[+] Enabling ${name}"
- if test -f /etc/apache2/sites-available/${host}; then \
+ if test -f ${apache_sites}/${host_conf}; then \
echo "> Enabling project's vhost..."; \
sudo a2ensite ${host}; \
sudo service apache2 reload; \
cd ${project_dir} && php composer.phar install
chmod -R 777 ${project_dir}/app/cache
chmod -R 777 ${project_dir}/app/logs
- sudo sed -e "s@${project_dir}/www@${project_dir}/web@" -i ${apache_sites}/${host}
+ sudo sed -e "s@${project_dir}/www@${project_dir}/web@" -i ${apache_sites}/${host_conf}
create-drupal: create-directories
echo "[+] Drupal installation begins..."