-
Notifications
You must be signed in to change notification settings - Fork 12
Server Setup
Outlined below are instructions on setting up a server to host voldb
The following command examples are all using Debian 9. Use whichever relevant package manager your distro uses.
You'll need sudo privileges.
Update your package lists:
sudo apt update
We need the build essentials for npm package installations:
sudo apt-get install build-essential
sudo apt-get install nginx
sudo apt-get install mysql-server
Make sure to secure the installation:
sudo mysql_secure_installation
Follow the instructions, but generally you should answer y to all of the questions.
Now we need to do a few things:
Open the mysql prompt: mysql
Create a database that voldb will use: CREATE DATABASE 'database';
Now we need to make a user for the database.
Type the following commands, replacing the relevant text with your own:
CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON 'database' . * TO 'user'@'localhost';
Remember these for when you edit the .env file in the laravel folder for VolDB!
sudo apt-get install php-fpm php-mysql php-mbstring php-xml php-zip
As of the time of writing, php 7.2 isn't default on Debian 9, here's how I fixed that
sudo apt-get install ca-certificates apt-transport-https
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
echo "deb https://packages.sury.org/php/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list
sudo apt-get install php7.2-fpm php7.2-mysql php7.2-mbstring php7.2-xml php7.2-zip
Now we have to configure an nginx server block to use php and point to your voldb installation.
Make a folder to hold your website, this should be the folder you pull voldb into.
sudo mkdir /home/your_website/volunteers
note: you can replace /home/your_website directories with whatever you want, it's just an example.
Open a nginx block config file:
sudo nano /etc/nginx/sites-available/your_website
paste the following.
server {
listen 80;
listen [::]:80;
root /home/your_website/volunteers/laravel/public;
index index.php index.html index.htm;
server_name your_website_url;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Activate the config:
sudo ln -s /etc/nginx/sites-available/your_website /etc/nginx/sites-enabled/
Restart nginx:
sudo systemctl restart nginx
Well done, you've set up the core web server stuff!
curl -sL https://deb.nodesource.com/setup_11.x | bash -
sudo apt-get install -y nodejs
sudo apt-get install composer
Now we have to git clone to our directory we used in the nginx config:
cd /home/your_website/
git clone https://github.com/playasoft/volunteers.git
Follow the instructions on the main repository under "Installing" from step 2 https://github.com/playasoft/volunteers/blob/master/README.md
Note: You'll probably encounter permission errors, I'm not sure this is the place to explain how to fix that but..
If you're only going to be running one website on your server:
Edit /etc/php/7.2/fpm/pool.d/www.conf and change the lines
user = www-data
group = www-data
to whichever user and group owns the /home/your_website directory.
systemctl restart php7.2-fpm.service
Everything should now be up and running, if there's any issues please create an Issue.