Ariel Rin 95f72c854d Minor Documentation Update (#1019)
Gunicorn needs to be run whilist in the folder for context, folder path is not enough
Correct static path, note to check nginx user
Capitalization of services and small typos
Service examples updated to their latest versions and download links
Expanded /var/www chowns for Nginx and Apache examples
Add in a troubleshooting note for no images being displayed (permissions issue) and gunicorn not execting (file path context)
Correct formatting. Reword a few parts. Remove "new in 1.15".
2018-04-17 18:55:18 -04:00

3.7 KiB

Alliance Market

Dependencies

Alliance Market requires PHP installed in your web server. Apache has mod_php, NGINX requires php-fpm.

Prepare Your Settings

In your auth project's settings file, do the following:

  • Add 'allianceauth.services.modules.market', to your INSTALLED_APPS list

  • Append the following to the bottom of the settings file

    Alliance Market

    MARKET_URL = '' DATABASES['market'] = { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'alliance_market', 'USER': 'allianceserver-market', 'PASSWORD': 'password', 'HOST': '127.0.0.1', 'PORT': '3306', }

Setup Alliance Market

Alliance Market needs a database. Create one in MySQL/MariaDB. Default name is alliance_market:

mysql -u root -p
create database alliance_market;
grant all privileges on alliance_market . * to 'allianceserver'@'localhost';
exit;

Install required packages to clone the repository:

sudo apt-get install mercurial meld

Change to the web folder:

cd /var/www

Now clone the repository

sudo hg clone https://bitbucket.org/krojew/evernus-alliance-market

Make cache and log directories

sudo mkdir evernus-alliance-market/app/cache
sudo mkdir evernus-alliance-market/app/logs
sudo chmod -R 777 evernus-alliance-market/app/cache
sudo chmod -R 777 evernus-alliance-market/app/logs

Change ownership to apache

sudo chown -R www-data:www-data evernus-alliance-market

Enter directory

cd evernus-alliance-market

Set environment variable

export SYMFONY_ENV=prod

Copy configuration

sudo cp app/config/parameters.yml.dist  app/config/parameters.yml

Edit, changing the following:

  • database_name to alliance_market
  • database_user to your MySQL user (usually allianceserver)
  • database_password to your MySQL user password
  • email settings, eg Gmail/Mailgun etc.

Edit app/config/config.yml and add the following:

services:
    fos_user.doctrine_registry:
        alias: doctrine

Install composer as per these instructions.

Update dependencies.

sudo php composer.phar update --optimize-autoloader

Prepare the cache:

sudo php app/console cache:clear --env=prod --no-debug

Dump assets:

sudo php app/console assetic:dump --env=prod --no-debug

Create DB entries

sudo php app/console doctrine:schema:update --force

Install SDE:

sudo php app/console evernus:update:sde

Configure your web server to serve alliance market.

A minimal Apache config might look like:

<VirtualHost *:80>
    ServerName market.example.com
    DocumentRoot /var/www/evernus-alliance-market/web
    <Directory "/var/www/evernus-alliance-market/web/">
        DirectoryIndex app.php
        Require all granted
        AllowOverride all
    </Directory>
</VirtualHost>

A minimal Nginx config might look like:

server {
    listen 80;
    server_name  market.example.com;
    root   /var/www/evernus-alliance-market/web;
    index  app.php;
    access_log  /var/logs/market.access.log;

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass   unix:/tmp/php.socket;
        fastcgi_index  app.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

Once again, set cache permissions:

sudo chown -R www-data:www-data app/

Add a user account through auth, then make it a superuser:

sudo php app/console fos:user:promote your_username --super

Now edit your auth project's settings file and fill in the web URL to your market as well as the database details.

Finally run migrations and restart Gunicorn and Celery.