pompdelux / hanzo

hanzo revisited
0 stars 0 forks source link

Hanzo - PDL shop v2.

Build Status

Requirements:

First off, the same requirements as symfony2, besides this, we have these addons:

  1. redis must be installed and working
  2. cdn must be setup (this is the same repos as hanzo see docs/vhost.cdn.conf)
  3. Apache or Nginx must be setup up (Apache with mod_rewrite)
  4. PHP version > 5.5
  5. PHP modules needed
    • Zend OPcache
    • PDO (mysql)
    • Curl
    • Imagick
    • phpredis native c extension til at kører sessions i redis, kræver også NativeSession til symfony.
  6. Beanstalkd must be instaled

These are only required on dev servers:

  1. Compass and Sass compass
  2. Grunt must be installed

Install:

  1. git clone git@github.com:bellcom/hanzo.git
  2. cd hanzo
  3. Copy app/config/parameters.ini.dist to app/config/parameters.ini
    1. Change any settings necessary to connect to your database
  4. Get at least the _dk database from testpompdelux from @mmh and load that
    1. the one from live is too big, so don't try ;)
  5. php bin/vendors install
  6. Setup apache, see dosc/vhost.conf for an example
  7. Install grunt depenencies
    1. npm install
  8. Run grunt watch in a shell to keep files up2date

Configuration:

Note, to ease the flow, we use app_dev.php as "index" on locale dev and test_dev.php on test - so you do not use the environment files directly.

To access a dev page, the structure is as follows, {locale} is one of the configured locales: http://yourdomain.tld/{locale} or http://yourdomain.tld/app_test.php/{locale} prod is never used, well - in production but else...

At the moment da_DK, sv_SE, nb_NO, nl_NL, en_GB, de_DE, de_CH and de_AT is configured.

Please notice, you need to have all the utf8 locales for these languages installed (ex: da_DK.utf8) !

Misc

symfony console:

Note the env parameter, this is important, stuff vill break if not ... oh! and run the command as the web user

redis:

Currently we use redis for:

On dev we only use one redis server, so here the port number is 6379 (default)

Themes

Assets for themes are located under web/fx/THEME/

Create a new theme with compass:

  1. cd web/fx
  2. compass create THEME_NAME --css-dir "css" --javascripts-dir "scripts" --images-dir "images"

--

Styles are grouped in seperate .scss files. e.g. Payment styles are located in _payment.scss and importet in style.scss (@import "payment"). All sub .scss files which should be imported into another instead of being a independet css file, should be prepended with a _ like _account.scss. This way they wont be compiled themself.

The directory of a theme will look like this when built with compass (note that compass only generates the sass and css folders):

Follow the best practices

--

All assets (css and js) are compiled using grunt, all assets needed by a theme are added to the file resources.json in the theme folder, eks: app/Resources/themes/2013s1/resources.json

Vagrant

There is a vagrant box provider, it requires:

To use, simply cd to the root directory of the project and do a

$ vagrant up

It will take forever (the first time) - when done, you should be able to go to http://pdl.dev/ and http://c.pdl.dev/

To ssh into the box, do a:

$ vagrant ssh

To shut it down:

$ vagrant halt

If the page returns a "nginx - bad gateway" error run the following commands:

$ vagrant ssh
$ sudo chown www-data. /var/run/php5-fpm*

Beanstalkd

Is for processing orders, so they are send "to ax" in dev mode - and you get your confirmation emails.

To run the beanstalk jobs you do:

$ php app/console hanzo:ax:pheanstalk-worker --limit=10 --verbose --env=dev_dk

where --limit=10 can be anything, its the number of jobs executes before quitting - remember not to set it to 100.000, php does not handle memory that well...

also, you should always remember to restart the jobs when changing any related code.

Supervisord

There is a config file for supervisord in docs/supervisord-hanzo.conf - this is a copy of the configuration currently in production.