Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Spin up a D8 droplet
  2. ssh into the IP address assigned: ssh root@IPADDRESS
  3. Move your user mysql config file (it messes with drush and isn't needed)

    Code Block
    mv ~/.my.cnf ~/.my.cnf.bak


  4. Install PHP 7.x

    Code Block
    sudo add-apt-repository ppa:ondrej/php
    sudo apt-get update
    sudo apt-get install php7.1-fpm php7.1-curl php7.1-gd php7.1-xml php7.1-mysql php7.1-json php7.1-mbstring php7.1-opcache php7.1-zip
    sudo nano /etc/nginx/sites-enabled/drupal


  5. Once in the nginx hosts file change the following

    Code Block
    #fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;


  6. At the top of the nginx hosts file add this right above the error page entry:

    Code Block
    gzip on;
    gzip_http_version 1.1;
    gzip_disable "msie6";
    gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;


  7. Extra: If you are doing a composer build, make sure to change your root in your ngnix hosts file to the following:

    Code Block
    #root /var/www/html/drupal;
    root /var/www/html/drupal/web;


  8. reboot the server or restart nginx, either or works.
  9. If you are deploying a repo from github, add a ssh key with: ssh-keygen -t rsa and paste the public key into the repos → settings → deploy keys section.  reboot the server.
  10. Install composer with:

    Code Block
    php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
    php -r "if (hash_file('SHA384', 'composer-setup.php') === '669656bab3166a7aff8a7506b8cb2d1c292f042046c5a994c43155c0be6190fa0355160742ab2e1c88d40d5be660b410') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
    php composer-setup.php
    php -r "unlink('composer-setup.php');"
    mv composer.phar /usr/local/bin/composer


  11. Install Drush
    1. Edit your ~/.bashrc and put this at the end: export PATH="$HOME/.composer/vendor/bin:$PATH" and exit out of the server then ssh back in
    2. Run this command: composer global require drush/drush
  12. Grab the DB settings from /var/www/html/drupal/sites/default/settings.php
    1. Apply the DB connection string to your repos settings.
  13. Make sure to change the sync directory to what is on your current sites settings.php
  14. Run the following commands:

    Code Block
    cd /var/www/html/drupal
    drush sql-drop
    cd ..
    sudo rm -rf drupal
    sudo apt-get install git
    git clone YOUR-REPO drupal
    sudo chown www-data:www-data -R drupal


  15. Copy in your local DB and files via scp or FTP or whatever method you use. 
  16. Import the DB and files, you may need to run: sudo chown www-data:www-data -R drupal again
  17. Make sure your tmp folder is correct in admin/config/media/file-system
  18. Check the status report for any issues and address them if need be.
  19. Highly Recommend using the site with CloudFlare to help mitigate DDoS attacks and CDN management.  Drupal Instructions.
  20. If you want to optimize PHP & MySQL: check out this page
  21. If you want to optimize the server: check out this page

...