Skip to content

Instantly share code, notes, and snippets.

@cballenar
cballenar / 00-starting-with-laravel.md
Last active February 18, 2016 22:10
Starting with Laravel

Starting with Laravel on Mac OSX

Installation

Install composer

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
@cballenar
cballenar / _setting-up-mt-self-managed-vps.md
Last active August 29, 2015 14:26
Walkthrough for setting up MediaTemple's self managed server with VirtualMin and getting your websites running.

Setting up MediaTemple Self Managed VPS

I recently moved from MediaTemple's Legacy (dv) 4.0 VPS server to their new Self Managed DV server. You get to save up some money at the expense of all the software that comes pre installed on a server. All you get when you rent one of these badboys is an empty box with your choice of OS. Sounds exciting!? You bet your ass it does! It can also be a bitch if you're not as familiar with how things work in a web server. Getting this setup helped me understand servers unlike never before and having full control over everything that happens in your box does feel kinda nice.

Installing VirtualMin

The best free application I found for managing websites is Webmin + VirtualMin. Though I would like to mention Ajenti, which looks pretty badass and seems to be in active development.

I come from Plesk which was definitely a superior tool but so far I envy noth

@cballenar
cballenar / better-server-permissions.md
Last active November 6, 2015 22:09
Avoid having to manually change the permissions after adding files as root or another user. These commands have to be ran as root. After running these commands the files and directories inside www will inherit the ownership and permission given.
# add user to www-data
gpasswd -a user www-data

# change ownership
chown -R user:www-data /var/www/

# find all files, set permissions to rw-r-----
find /var/www -type f -exec chmod 0640 {} \;

NCurses Disk Usage (aka: ncdu)

Use it like ncdu -x -q if you're invoking it remotely (e.g. via ssh) and ncdu -x otherwise.

ncdu 1.10 ~ Use the arrow keys to navigate, press ? for help
--- / --------------------------------------------------------
    6.2GiB [##########] /home  
    1.9GiB [##        ] /var
 1.0GiB [# ] /usr

Safely updating a Craft installation

1. Download correct version

2. Backup database

  • Craft usually backsup the database on update but I've found that if you have a large database, this can cause the update script to timeout.
  • Craft should be set to 'backupDbOnUpdate' => false
  • This means that you'll be responsible for updating previous to updating
https://gist.github.com/jerry-gdd/d3ccbf01b4d5cde3db54a1b502d04b36
https://github.com/johanneslamers/craft-workflow/blob/master/install.sh
https://askubuntu.com/questions/866985/phpenmod-mcrypt-and-phpenmod-mbstring-return-errors
http://stackoverflow.com/questions/23921117/disable-only-full-group-by/31058962#31058962

Notes regarding VPS setup

Making Craft Play Nicely With MySQL 5.7.5+

Create /etc/mysql/conf.d/sql_mode.cnf

[mysqld]
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

Source: Craft Cook Book

@cballenar
cballenar / Vagrant.bootstrap.sh
Created July 3, 2017 14:16 — forked from asmerkin/Vagrant.bootstrap.sh
A simple LAMP Vagrantfile and Bootstrap file for Vagrant and ubuntu/trusty64 box. It uses mpm-workers and php5-fpm + some extra tools like grunt, gulp and composer.
#!/usr/bin/env bash
# ---------------------------------------
# Virtual Machine Setup
# ---------------------------------------
# Adding multiverse sources.
cat > /etc/apt/sources.list.d/multiverse.list << EOF
deb http://archive.ubuntu.com/ubuntu trusty multiverse
deb http://archive.ubuntu.com/ubuntu trusty-updates multiverse