Skip to content

Installing RuneManager (Linux) (MySQL) (Nginx)

Simon Konglevoll Lønnestad edited this page Jun 2, 2019 · 2 revisions

Step 0: Setting up and configuring the database

Log into the database root administrative account.

mysql -u root -p

Create a new database for RuneManager.

CREATE DATABASE <name of database>;

Create a new user that will be allowed to access this database.

GRANT ALL ON <name of database>.* TO '<database user>'@'localhost' IDENTIFIED BY '<database user password>';

Flush the privileges to notify the MySQL server of the changes.

FLUSH PRIVILEGES;

Exit MySQL.

EXIT;

Step 1: Setting up the Laravel application

Create a directory which will hold the application.

sudo mkdir -p /var/www/html/runemanager

Change the ownership of the newly created directory to your current user, so that you will be able to work with the files inside without using sudo.

sudo chown $USER:$USER /var/www/html/runemanager

Move to the new directory.

cd /var/www/html/runemanager

Clone RuneManager via Git to the current folder.

git clone https://github.com/Zlimon/RuneManager-OSRS.git .

Next, install the RuneManager dependencies with: Composer globally:

composer install

Composer locally:

php composer.phar install

The somewhat lengthy output will show the installation progress for all project dependencies, and when succeded it will output this:

Package manifest generated successfully.

Clean up the installation files.

php artisan clear-compiled

Step 2: Configure RuneManager environment

Copy the example environment file

cp .env-example .env

And then edit the .env file with your favourite editor

sudo nano .env

You will be presented different environment variables. Edit the following changes to the file: APP_NAME=<name of your clan> APP_ENV=production APP_KEY= APP_DEBUG=false APP_URL=http://<URL to your web server>

DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=<name of database> DB_USERNAME=<database user> DB_PASSWORD=<database user password> . . .

Save the file and exit.

Generate an encryption key for the application.

php artisan key:generate

Create a symbolic link to the storage folder (this is where newspost images are stored).

php artisan storage:link

Navigate to the ../public/storage folder and place any image of your own choice called default.png. This is the default newspost image if no other image is applied.

Populate the database with the necassery tables and relations

php artisan migrate:fresh

If successful, this message should show:

Migration table created successfully.

Finally, create a crontab job schedule so the hiscores on the website are regularly updated

crontab -e

Fill in this at the end of the file: * * * * * php /var/www/runemanager/artisan schedule:run This is a hourly schedule. If you want to change the schedule, you can read more about this here.

Save the file and exit.

Step 3: Configure Nginx

Change the group ownership of the storage and bootstrap/cache directories to www-data.

sudo chgrp -R www-data storage bootstrap/cache

Then recursively grant all permissions, including write and execute, to the group.

sudo chmod -R ug+rwx storage bootstrap/cache

When permissions are set, you will have to set up the Nginx configurations. First create your own copy of the default configuration (replace example.com with your own domain name).

sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/example.com

Edit the newly copied configuration file with your favourite editor.

sudo nano /etc/nginx/sites-available/example.com

Make the following changes:

server {
    listen 80;
    listen [::]:80;

    . . .

    root /var/www/html/runemanager/public;
    index index.php index.html index.htm index.nginx-debian.html;

    server_name example.com www.example.com;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    . . .
}

Save and exit.

Enable the new configuration file by creating a symbolic link from this file to the sites-enabled directory.

sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/

And finally reload Nginx to apply the changes.

sudo systemctl reload nginx

Your RuneManager application should now be set up!