Skip to content

Development Setup

Pieter Kokx edited this page Feb 14, 2020 · 8 revisions

There are various setups which you can use for local development of gewisweb. Which method you choose will depend on your personal preference and current setup. For instance if you already have a local webserver you may prefer to use a local setup rather than vagrant or docker. It is recommended to read this page carefully and the choose the method which suits you best.

It's probably most easy to use a Linux virtual machine in combination with the Docker method below.

Method #1 Docker

  • Install docker and docker-compose
  • Run docker-compose up -d (possibly with sudo)
  • Run ./dockerexec composer install
  • Copy ./config/autoload/doctrine.local.development.php.dist to ./config/autoload/doctrine.local.php
  • Copy ./config/autoload/local.php.dist to ./config/autoload/local.php
  • Make sure the ./config/autoload/doctrine.local.php contains the following values:
                    'host'     => 'webmysql',
                    'port'     => '3306',
                    'user'     => 'gewis',
                    'password' => 'gewis',
                    'dbname'   => 'gewis',
  • Run ./dockerexec ./web orm:schema-tool:create

If you need testdata run the following commands

./dockerexec ./web testdata user
./dockerexec ./web testdata activity
./dockerexec ./web testdata decision
./dockerexec ./web testdata education
./dockerexec ./web testdata page
./dockerexec ./web testdata photo
./dockerexec ./web testdata poll

Method #2 Vagrant

  • Install VirtualBox and Vagrant
  • Run vagrant up
  • You now have a fully functional website at http://192.168.41.42/ or http://webdev.gew.is/ Testdata is included automatically and a PhpMyAdmin install can be found at /pma

Method #3 Local

  • Install dependencies using composer: php composer.phar install
  • Create a new MySQL database.
  • Copy config/autoload/doctrine.local.php.dist to config/autoload/doctrine.local.php and configure the database settings in it.
  • Copy ./config/autoload/local.php.dist to ./config/autoload/local.php
  • Give the webserver's user read and write permissions to the data/ and public/data/ directories.
  • Run ./web orm:schema-tool:create to populate the database.
  • Copy config/autoload/local.php.dist to config/autoload/local.php
  • Set the environment variable APP_ENV to development in your webserver configuration

Configuration for scss editing

If you need to edit stylesheets, you need to be able to compile scss files locally. For that, you will need nodejs and npm installed. To generate the css files:

  • Execute npm install
  • Execute npm run scss

That will create a production build however. For development, you can run npm run watch which automatically regenerates the css files when you modify them.