Skip to content

Installation

Stan Cardinaels edited this page Nov 28, 2022 · 38 revisions

Why do we need this page?

The reason we need this page is quite simple. This project is more than just php code. It requires more than just access to the php code. The database has to be created, the web server user (www-data on most Linux distributions) needs permission to read all the code and permission to write to parts of it. This page tells you what you need to do to install the Litus software, besides simply checking out the code.

Step 1: Install

The Litus projects requires quite a few programs to be installed.

  • Caddy (or any other web server with PHP)
  • PHP7.2 or later (backwards compatible with PHP5.6)
  • NPM with LESS (install node from https://github.com/nodesource/distributions, then run sudo npm install -g less@1.7.5)
  • PostgreSQL
  • Redis
  • FOP (optional, but needed to generate PDFs)
  • pgweb (optional, but it's advised to install this if you want to access the database yourself)

We also require a few PHP extensions (install these either using your package manager, or if not available, through PECL or PEAR).

  • php-imagick
  • php-mailparse
  • php-redis
  • php7.2-curl
  • php7.2-intl
  • php7.2-pgsql
  • php7.2-soap
  • php7.2-xml
  • php7.2-zip

To install these, please look for tutorials on the internet.

Step 2: Configuration

Navigate to the config/ directory. Here, you will the following configuration files. For each of these, you need to make a copy, omitting the .dist extension.

  • database.config.php.dist
  • google.config.php.dist
  • proxy.config.php.dist
  • redis.config.php.dist
  • session.config.php.dist
  • sentry.config.php.dist

In redis.config.php: set 'host' => 'localhost'

In session.config.php: remove vtk.be from cookie domain

Step 3: Fix Permissions

The user Apache user needs write permissions on the following directories. This can be done via either ACLs or just by chowning the directory to that user. Note that chowning may cause problems when pulling changes to any of those directories.

data/banner/images
data/br/files
data/cache
data/calendar/posters
data/cudi/files
data/hydrators
data/page/files
data/proxies
public/_assetic
public/_br/img
public/_common/profile
public/_gallery/albums
public/_publications/html
public/_publications/pdf

It can be easier to use ACLs for development builds, as these still allow you to edit the files yourself.

On linux you can use the setfacl utility provided by the acl package. Make sure your FS supports ACLs out of the box (e.g. XFS) or that the filesystem is mounted with the appropriate options (add acl to the options in /etc/fstab for EXT{2,3,4}).

setfacl -mu:www-data:rwx -md:u:www-data:rwx \
    data/banner/images \
    data/br/files \
    data/cache \
    data/calendar/posters \
    data/cudi/files \
    data/hydrators \
    data/page/files \
    data/proxies \
    public/_assetic \
    public/_br/img \
    public/_common/profile \
    public/_gallery/albums \
    public/_publications/html \
    public/_publications/pdf

On OS X, "simply" run

chmod -R +a "_www allow read,write,execute,delete,append,readattr,writeattr,readextattr,writeextattr,readsecurity,list,search,add_file,add_subdirectory,delete_child,directory_inherit,file_inherit" \
    data/banner/images \
    data/br/files \
    data/cache \
    data/calendar/posters \
    data/cudi/files \
    data/hydrators \
    data/page/files \
    data/proxies \
    public/_assetic \
    public/_br/img \
    public/_common/profile \
    public/_gallery/albums \
    public/_publications/html \
    public/_publications/pdf

Step 4: Initialize Database

Use the following command to create the structure of the database in PostgreSQL.

php bin/doctrine.php orm:schema-tool:create

or

php bin/doctrine.php orm:schema-tool:update --force

We finally need to tell Doctrine about all existing migrations.

php bin/doctrine.php migrations:version --add --all --no-interaction

When you change the database structure (e.g., by creating a new entity or adding a column), run the following command to generate a new migration version.

php bin/doctrine.php migrations:diff

Step 5: Install Bundles

The structure of your database will be created by Doctrine, but Doctrine doesn't have default values. To install these, execute the following command.

php bin/console.php install:all

Future: Updating

In the future you will have to update the database schema regularly. While you can simply run

php bin/doctrine.php migrations:migrate --no-interaction

this will only work for some changes. Other changes (renaming of a column, adding a column, …) cannot automatically be performed by Doctrine. That's why you should always use

bin/update.sh

to update your database schema to the latest version. This script also runs install:all again to make sure everything is configured properly. It also rebuilds all assets used by Assetic.

Clone this wiki locally