This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/tests/setup_test_env.sh

56 lines
1.3 KiB
Bash
Raw Normal View History

#!/bin/bash
#
# Set up the Travis-CI test environment for Shimmie.
# (this script should be run as root via sudo)
#
2014-02-18 21:59:07 +00:00
# @author jgen <jeffgenovy@gmail.com>
# @license http://opensource.org/licenses/GPL-2.0 GNU General Public License v2
#
# Exit immediately if a command exits with a non-zero status.
set -e
# Install the necessary packages
2014-02-19 05:40:16 +00:00
sudo apt-get install -y nginx php5-fpm php5-mysql realpath --fix-missing
# Stop the daemons
sudo service nginx stop
sudo /etc/init.d/php5-fpm stop
2014-02-18 04:18:00 +00:00
# shimmie needs to be able to create directories for images, etc.
# (permissions of 777 are bad, but it definitely works)
2014-02-18 06:11:39 +00:00
sudo chmod -R 0777 $1
2014-02-18 04:18:00 +00:00
NGINX_CONF="/etc/nginx/sites-enabled/default"
# nginx configuration
echo "
server {
2014-02-18 05:50:57 +00:00
listen 80;
server_name localhost 127.0.0.1 \"\";
2014-02-20 01:50:00 +00:00
server_tokens off;
2014-02-18 06:30:27 +00:00
root $1;
2014-02-18 06:11:39 +00:00
index index.php;
2014-02-19 23:45:28 +00:00
location / {
index index.php;
# For the Nice URLs in Shimmie.
if (!-e \$request_filename) {
2014-02-19 23:45:28 +00:00
rewrite ^(.*)\$ /index.php?q=\$1 last;
break;
}
}
2014-02-18 05:06:58 +00:00
2014-02-19 23:45:28 +00:00
location ~ \.php\$ {
try_files \$uri =404;
2014-02-18 05:06:58 +00:00
fastcgi_index index.php;
2014-02-18 06:30:27 +00:00
fastcgi_pass 127.0.0.1:9000;
2014-02-18 05:37:07 +00:00
include fastcgi_params;
}
}
" | sudo tee $NGINX_CONF > /dev/null
# Start daemons
sudo /etc/init.d/php5-fpm start
sudo service nginx start