Skip to content
Alex Perfilov edited this page Oct 9, 2019 · 28 revisions

Local

MAC

  • (optional) If you're setting web server for the first time on your machine, make sure port 80 is not being used

    sudo lsof -i :80
    
  • To unload default OSX apache httpd

    sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
    
  • Install brew https://brew.sh/

  • Install nginx

    brew install nginx
    sudo ln -s /usr/local/var/log/nginx /var/log/nginx
    sudo ln -s /usr/local/etc/nginx /etc/nginx
    
  • Add checkbook config

    vim /etc/nginx/servers/checkbook.conf

    (replace your-path-to-Checkbook with correct one)

    upstream php{
      server 127.0.0.1:9000 fail_timeout=0;
    }
    
    server {
      listen 80;
      listen [::]:80;
    
      server_name checkbook.local;
    
      root /Users/your-path-to-Checkbook/source/webapp/;
      index index.php;
      autoindex on;
    
      location / {
          try_files $uri $uri/ /index.php?$args;
      }
    
      location ~ \.php$ {
          include fastcgi_params;
          try_files      $uri /index.html index.php;
          fastcgi_index index.php;
          fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
          # fastcgi_param PHP_VALUE "upload_max_filesize=5M;\n error_reporting=E_ALL;";
          fastcgi_read_timeout 606;
          fastcgi_pass php;
      }
    }
    
  • Install php

    brew install php
    
  • Set proper php cli version

    # From "brew" [email protected]
    export PATH="/usr/local/opt/[email protected]/bin:$PATH"
    export PATH="/usr/local/opt/[email protected]/sbin:$PATH"
    
  • Autostart nginx

    sudo cp /usr/local/opt/nginx/*.plist /Library/LaunchDaemons/
    sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
    
  • (optional) Test nginx

    wget localhost
    

    (it should at least return 500 Internal Server Error). If you get Connection refused, stop and fix your nginx. Just run nginx in console if you can't see anything in logs

  • Install memcached

    brew install memcached
    sudo cp /usr/local/opt/memcached/*.plist /Library/LaunchDaemons
    launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.memcached.plist
    
    brew install libmemcached
    brew install pkg-config
    pecl install memcached
    brew services restart php
    
  • Check if memcached is running

    echo stats | nc 127.0.0.1 11211
    
  • (optional) Install xdebug

    pecl install xdebug

    [xdebug]
    xdebug.remote_enable = 1
    xdebug.remote_connect_back=1
    xdebug.remote_port = 9001
    xdebug.scream=0
    xdebug.show_local_vars=1
    xdebug.idekey=PHPSTORM
    
  • Set up mysql user

    mysql -uroot

    CREATE USER 'ckbook'@'localhost' IDENTIFIED BY 'your-password';
    GRANT ALL PRIVILEGES ON * . * TO 'ckbook'@'localhost';
    FLUSH PRIVILEGES;
    
  • (optional) Set up adminer container (MySQL Administration UI)

    docker run --name mysql_adminer -d -p 8182:8080 arm32v6/adminer

  • Open http://localhost:8182/ in browser, use these credentials

    docker.for.mac.host.internal
    ckbook
    your-password
    
  • Make sure you have /var/log/drupal/drupal.log and php can write it

  • For transaction export install postgresql client.
    !! Do not start local server, it is not required for our installation !!

    brew install postgresql
    
  • Get Third-party Libraries Manually download a few third-party libraries used to render charts & widgets in our website (which cannot be hosted in our GitHub repository).

    ** High charts v7.1.1

    Download Link: https://code.highcharts.com/zips/Highcharts-7.1.1.zip

    Folder Location: webapp/sites/all/modules/custom/widget_framework/widget_highcharts/highcharts/7.1.1

    ** High stock v7.1.1

    Download Link: https://code.highcharts.com/zips/Highstock-7.1.1.zip

    Folder Location: webapp/sites/all/modules/custom/widget_framework/widget_highcharts/highstock/7.1.1

  • Install drush

    composer global require drush/drush "^7"