skiedude / evestructures

An ESI/SSO backed website enabling Eve Online Corporations to view and manage all their owned Structures in New Eden
https://structures.eveskillboard.com
MIT License
22 stars 12 forks source link
ccp gaming laravel sso

AS OF 11/6/19 EveStructures IS CURRENTLY RECEIVING LIMITED UPDATES

EveStructures

This provides a consolidated view of all your structures across multiple Eve Online Corporations. Gathers and displays important data like fuel, services, locations, states and much more.

Join Our Discord!

EveStrucutures is built with the Laravel PHP Framework. For more info on Laravel

Prequisite Installs

Eve Developers Site

Eve Online Developer - You will need to setup your own developer application that uses

Install

Databases

We need 1 database created.

create database evestructures

Create one user and give it privileges.

Git Repo

Pull down the repo and Run (I made composer a global binary by following binary )

composer install

Environment File

We need to update/add some values to the .env file. (If one is not created, copy the .env.example to be .env Update the following in the .env file (add if missing) REMOVE THE //COMMENTS

APP_NAME=  //used in the emails
APP_ENV=prod  //use prod
APP_KEY= //generate yourself if not already set
APP_URL= //url of your website for the emails
SITE_NAME= //used in disclaimer

DB_DATABASE= // database you created 
DB_USERNAME= // username that has access to both databases
DB_PASSWORD= // password for ^ user
QUEUE_DRIVER= //use database if you intend to use supervisord

//I use gmail to handle password resets
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=ADDRESS_HERE@gmail.com
MAIL_PASSWORD=PASSWORD HERE
MAIL_ENCRYPTION=tls
MAIL_FROM_NAME=NAME_HERE
MAIL_FROM_ADDRESS=ADDRESS_HERE@gmail.com

USERAGENT= //used for the HTTP requests
CALLBACK_URL=https://URL_GOES_HERE.COM/sso/callback  //update the URL there in the middle, adjust for non https
CLIENT_ID=  //retrieved from your developer account
SECRET_KEY= // retrieved from your developer account

In some cases you will need to generate your own APP_KEY, you can do so by running php artisan key:generate and pasting that value in the .env file for APP_KEY

Web Service

I won't go in depth on how to configure apache for each OS type. But you need to point the home directory to the public folder of your installation. Make Sure you update the paths to files in these to your install
Here is an example httpd conf file (CentOS7) https://pastebin.com/F71CCb1e
Here is an example nginx conf file (CentOS7) https://pastebin.com/7xy5dtJn

Database Migrations

Run the php artisan migration command to set create your database tables

php artisan migrate

Logs

Laravel requires special permissions on the the sub folders in storage, you can set everything to 777, but I'd warn against that. I wrote a bash alias that fixes this for me. You will need to adjust this based off the user your web service runs under. https://stackoverflow.com/a/37266353 . I put this as a cron for the root user to run as *

alias fixstorage='sudo chgrp -R USER_HERE storage bootstrap/cache && sudo chmod -R ug+rwx storage bootstrap/cache'

Supervisord

Supervisord takes care of running the jobs as they enter the queue. Supervisord Setup Instructions.
For Centos7 my files in conf.d needed to be .ini
Example config that I use

[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /UPDATE_PATH_TO_INSTALL/artisan queue:work --sleep=3 --tries=3 --timeout=10
autostart=true
autorestart=true
user=UPDATE_TO_YOUR_USER
numprocs=2
redirect_stderr=true
stdout_logfile=/UPDATE_PATH_TO_INSTALL/worker.log

Cron

Updating Structures every 3 hours, and checking for Fuel Notifications to send are run via the Schedule feature of Laravel. This requires running a cron once a minute to see if there are any tasks to schedule (this also schedules the jobs that get passed to supervisord).

Create a cron with the following entry Laravel Scheduler

* * * * * php /path-to-your-project/artisan schedule:run >> /dev/null 2>&1

From here you should be able to hit your Website in the browser, and play around with it.

Commands

Custom Commands (Some of these already run on a schedule, but can be ran manually):

php artisan update:structures //Kick off a Job for each Character to update their structure data from ESI
php artisan check:fuel //Run the Fuel check and send notifications if required
php artisan check:orphans //Checks for structures with no matching characters of the same corporation_id (cleans up old data)
php artisan check:unanchor //Checks for structures unanchoring and sends notifications if its the right time left
php artisan extraction:daily //Sends a message for the extractions coming up in the next 7 days
php artisan strct:state {structure_id} {old_state} {new_state} //Sends a notification that the State of a Structure changed
php artisan check:fracture {character_name} // name is optional, checks for moon extraction fractures
php artisan update:character // updates characters public info  (ie corporation)

Private Hosting

To hide some of the more public features for private installs you can add the following variables to the .env:

Hides the Tools drop down in the menu
PRIVATE_INSTALL=1

Hides the register link (still works if manually navigated to)
DISABLE_REGISTER=1

License

This project is licensed under the MIT License - see the LICENSE.md file for details