Skip to content

Self Hosting ESIKnife

David Davaham edited this page Aug 6, 2018 · 4 revisions

ESIKnife is built on top of Laravel and with this fact in mind, it should be fairly easy to get up and running. There are however a few additional requirements. There is no compromising these requirements. They are the bare minimum. If you have any trouble with the install, you can join the ESISpace discord and I'll attempt to assist you with setting the application up, but I cannot guarantee anything.

Follow the steps in order with the examples and you should be able to easily get the application up and running.

DISCLAIMER: This walkthrough assumes that you have an understanding of how to modify files from the command line and install packages. If you don't know how to do these things, then please consider using the hosted version of this application located at https://beta.esiknife.space/

Let's get started

Install Platform Packages

ESIKnife using the process manager Supervisor to monitor the Laravel Job Queue. Install using the following

apt install supervisor

ESIKnife uses JSON and an HTML/XML parser call Tidy throughout the application. Install using the following

apt install php7.1-tidy php7.1-json

Allow any dependencies of either of these packages to install as well.

ESIKnife needs git and composer to get the application and its dependencies onto the server

apt install git

To install composer, follow the guide on composers website here to download and here to install globally

Clone the repository

Navigate to the root of the web server and clone the ESIKnife repository. In my case, this is /var/www.

cd /var/www
git clone https://github.com/ddavaham/esiknife.git

Move into the directory and install the composer dependencies

cd /var/www/esiknife
composer install

Create and Setup the .env file

Laravel's use dotenv to manage and interact with the .env file. This allows you to securely store DB Credentials and API Keys and Secrets

cp .env.example .env
nano .env

Setup Site URL. This is the url of where the site will be hosted.

APP_URL=http://exampleknife.space

Setup the DB Connection Details

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

Finally, setup you API Credentials with CCP.

  1. You can do this by going to the CCP Developer Site.

  2. Log in and create a new application.

  3. Set the connection type for your application to Authentication & API Access

  4. Go ahead and select all of the scopes from the scope list. This allows ESIKnife the ability to request any scope we need to without worrying about whether the application is authorized to request with CCP.

  5. Set the callback URL to your APP_URL with /sso/callback on the end. This is the route that will be sent to CCP when a user gets sent off to Authenticate with the SSO.

After clicking on Create Application at the bottom of this page, you will be redirected to the application list. Navigate back into your application. You will see you Client ID and Client Secret listed there. Copy and paste these into the .env that you have open.

EVESSO_CLIENT_ID=
EVESSO_CLIENT_SECRET=
  1. Generate an Application Encryption Key
php artisan key:generate

Setup Supervisor to monitor the job queue

cd /etc/supervisor/conf.d
nano esiknife.conf

Copy and Paste the following

[program:esiknife]
command=php /path/to/esiknife/installation/artisan queue:listen --sleep=10 --tries=2
process_name=worker-%(process_num)02d
numprocs=10 <-- Enter any number here. Advised to keep this at or below 10.
autostart=true
autorestart=true
stopasgroup=true
stderr_logfile=/path/to/esiknife/installation/storage/logs/workers.log
stdout_logfile=/path/to/esiknife/installation/storage/logs/workersOther.log
stdout_logfile_maxbytes=100KB
stdout_logfile_backups=3
stderr_logfile_maxbytes=100KB
stderr_logfile_backups=3
priority=998

Take a Break

We are done modifying file now. Now we get to sit back and let computers do some work

Register Supervisor Configuration with Supervisor

Supervisor has a CLI that you can use to interact with the process manager. Use this anytime you need to stop the worker. This can be because an error is being thrown repeatedly, or anything.

supervisorctl
You should see this:
supervisor>
status <-- Should be blank
reread
update
stop all

reread tells the process to load the configuration that we enter update tells supervisor to create and start the workers stop all tells supervisor to stop the workers that we created. We don't need them yet

Insert your migrations into the database

Navigate back to the directory holding your installation of ESIKnife

Make sure that laravel artisan works by typing php artisan

If the command list of Artisan, then we are on the right track

Type the command php artisan migrate --step The --step makes it easy to rollback a migration if need be. This should execute all the migrations with no issue.

Import SDE and Ship Types

Type the command php artisan import:sde

You should see some text dump to the command line. It is importing portions of the CCP's SDE that ESIKnife uses. Noticed I said portions? Thank Squizz Caphinator for his SDE to JSON tool. This is what makes it possible to host only portions of the site instead of an entire copy.

When this is done, type the command php artisan import:ships

You should see a progress bar start to progress across the screen. This will happen twice. Once for ship groups, another for the actual ship types.

Once this is done, you should have a functioning, self-hosted version of ESIKnife. If I missed anything, let me know about it by creating an issue in this repo, or you can hit me up on Discord. Check the homepage of this wiki for a link.