├── .gitignore ├── CONTRIBUTING.md ├── README.md ├── Vagrantfile └── config └── salt ├── config.sls ├── config ├── mysql │ └── my.cnf ├── nginx │ ├── default │ └── nginx.conf ├── php5-fpm │ ├── php.ini │ └── www.conf ├── postfix │ └── main.cf ├── start_conf ├── wp_cli_completion ├── zsh-themes │ └── joeyhoyle.zsh-theme └── zshrc ├── memcached.sls ├── minions └── vagrant.conf ├── mysql.sls ├── nginx.sls ├── node.sls ├── php_fpm.sls ├── postfix.sls ├── tools.sls ├── tools ├── python.sls └── ruby.sls ├── top.sls └── vagrant.sls /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .vagrant 3 | Customfile 4 | /wp-cli 5 | /pantheon-cli 6 | /config/salt/local.sls 7 | /projects 8 | /logs 9 | /databases 10 | /config/salt/config/local 11 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Contribution guidelines ## 2 | 3 | ## Workflow ## 4 | 5 | * Develop on a feature branch and send a pull request for review 6 | * Assign the pull request to one of the following contacts: 7 | * Primary: Joe Hoyle ([@joehoyle](https://github.com/joehoyle)) 8 | * Secondary: Daniel Bachhuber ([@danielbachhuber](https://github.com/danielbachhuber)) 9 | 10 | ## Coding Standards ## 11 | 12 | Please follow these recommendations: [http://codex.wordpress.org/WordPress_Coding_Standards](http://codex.wordpress.org/WordPress_Coding_Standards). 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Salty WordPress 2 | 3 | A flavorful way to manage your entire WordPress stack. Built and maintained by [Human Made](http://hmn.md/). 4 | 5 | **Coming soon**: Provisioning production servers with Salty WordPress. 6 | 7 | ### Getting Building 8 | 9 | Salty WordPress uses three great technologies: [Salt](http://saltstack.com/), [Vagrant](http://www.vagrantup.com/), and [WordPress](http://wordpress.org/). It's intended to get you building amazing projects as quickly and effectively as possible. 10 | 11 | Here's how to get building: 12 | 13 | 1. Clone the repo: `cd ~/; git clone git@github.com:humanmade/Salty-WordPress.git`. 14 | 1. Install the latest version of [Vagrant](https://www.vagrantup.com/downloads.html) and version 4.2.12 of [Virtual Box](https://www.virtualbox.org/wiki/Download_Old_Builds_4_2). 15 | 1. Salty WordPress can also be used with VMWare 6.x instead of Virtualbox. There is a known issue where you'll need to install `nfs-common` in the VM before your shared directories will work. Keep in mind that, because the shared folders aren't mounted, your first provision will look like this: `vagrant up --provider=vmware_fusion; vagrant ssh; sudo apt-get install nfs-common; exit; vagrant halt; vagrant up --provision;` This will be fixed in Vagrant 1.5. 16 | 1. Change into the Salty WordPress directory and run `vagrant up`. This will take some time. Behind the scenes, Vagrant and Salt are downloading all of the system utilities (e.g. Nginx, PHP5-FPM, Memcached, etc.) to run your virtual machine. 17 | 1. In your `/etc/hosts` file, point any domains you plan to work on to `192.168.50.10`. The virtual machine is configured to handle all requests to `*.dev`. The WordPress develop install, for instance, should be `wordpress-develop.dev`. 18 | 1. Access your virtual machine with `vagrant ssh`. Windows users: You will see an output of the SSH info and the location of the key file instead. Feed this information into any SSH program, but not cmd.exe. Vagrant [suggests PuTTY](http://docs-v1.vagrantup.com/v1/docs/getting-started/ssh.html). 19 | 20 | Navigate to [http://wordpress-develop.dev](http://wordpress-develop.dev) in your browser to see a fully-functional WordPress install, powered by Salty WordPress. The default admin username/password is `wordpress/wordpress`. 21 | 22 | ## Neat Tricks 23 | 24 | Make your Salty WordPress experience even more awesome with these neat tricks. 25 | 26 | ### CLI Hacks 27 | 28 | - Deserialize data with `$~ serialize '[php serialized code]'` 29 | - Display a timestamp as a human readable string `$~ timestamp 1143123342` [ouputs "2006-03-23T14:15:42+00:00"] 30 | 31 | 32 | ### Open Remote Files in Sublime Text 33 | 34 | Using couple of neat tools, [rsub](https://github.com/henrikpersson/rsub) and [rmate](https://github.com/textmate/rmate), you can open files located in Vagrant in Sublime Text. We've even bound `subl` so the syntax is similar to what you have in your local machine. 35 | 36 | However, for this functionality to work properly, you'll need to SSH into Vagrant using SSH (and port forwarding), not `vagrant ssh`. Use `vagrant ssh-config` ([ref](http://docs.vagrantup.com/v2/cli/ssh_config.html)) to generate what you need to put in `~/.ssh/config`. Then, add `RemoteForward 52698 127.0.0.1:52698` to the entry ([ref](https://github.com/henrikpersson/rsub#ssh-tunneling)). 37 | 38 | Now, when you SSH into Vagrant, you'll automatically set up a connection for rmate to communicate to rsub (a Sublime Text plugin). 39 | 40 | ### Localize Your Environment 41 | 42 | Salty WordPress lets you localize your environment without having to edit tracked files. Create a local Salt file at `config/salt/local.sls` and Vagrant will include any declarations in the next provision. 43 | 44 | Alternatively, customize your Vagrantfile by including a `Customfile` in Salty WordPress' base directory. You can include many declarations you might normally put in your Vagrantfile. 45 | 46 | For instance, to more easily contribute to WP-CLI, use the following in your `Customfile` to have WP-CLI loaded from a shared directory: 47 | 48 | `config.vm.synced_folder "wp-cli", "/home/vagrant/.wp-cli", :nfs => true` 49 | 50 | If you'd like to persist your databases between each destroy, you might want to put them in a mapped directory: 51 | 52 | `config.vm.synced_folder "databases", "/var/lib/mysql"` 53 | 54 | Note: You'll need to do an initial provision, then copy all of the files in `/var/lib/mysql` to a "databases" directory in your local machine. 55 | 56 | If you have the [Vagrant Hosts Updater](https://github.com/cogitatio/vagrant-hostsupdater) plugin installed you can add any additional hosts without having to edit `/etc/hosts`. You may have to reload the VM to see the changes. 57 | 58 | ``` 59 | if defined?(VagrantPlugins::HostsUpdater) 60 | config.hostsupdater.aliases = [ "wordpress-develop.dev", ... ] 61 | end 62 | ``` 63 | 64 | ## Contribution guidelines ## 65 | 66 | For more information on how to contribute to this project, go [here](CONTRIBUTING.md). 67 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # 'projects' and 'logs' directories are ignored in the repo, so let's make sure they exist 5 | FileUtils.mkdir_p(File.dirname(__FILE__)+'/projects') 6 | FileUtils.mkdir_p(File.dirname(__FILE__)+'/projects/default') 7 | FileUtils.mkdir_p(File.dirname(__FILE__)+'/logs') 8 | 9 | Vagrant.configure("2") do |config| 10 | 11 | vagrant_version = Vagrant::VERSION.sub(/^v/, '') 12 | 13 | config.vm.provider :virtualbox do |v| 14 | v.customize ["modifyvm", :id, "--memory", 1024] 15 | v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] 16 | end 17 | 18 | config.vm.box = "1404-64bit-virtualbox" 19 | config.vm.box_url = "http://hmn-uploads.s3.amazonaws.com/salty-wordpress/salty-wordpress-14-04-vbox-2014-07-12.box" 20 | config.vm.provider "vmware_fusion" do |v, override| 21 | override.vm.box = "1404-64bit-vmware" 22 | override.vm.box_url = "http://hmn-uploads.s3.amazonaws.com/salty-wordpress/salty-wordpress-14-04-vmware-2014-07-12.box" 23 | end 24 | 25 | config.vm.hostname = "salty-wordpress" 26 | config.vm.network :private_network, ip: "192.168.50.10" 27 | 28 | config.ssh.forward_agent = true 29 | 30 | config.vm.synced_folder "config", "/home/vagrant/config" 31 | config.vm.synced_folder "logs", "/srv/logs" 32 | config.vm.synced_folder "config/salt", "/srv/salt" 33 | 34 | config.vm.synced_folder "projects", "/srv/www" 35 | 36 | if File.exists?(File.join(File.dirname(__FILE__),'Customfile')) then 37 | eval(IO.read(File.join(File.dirname(__FILE__),'Customfile')), binding) 38 | end 39 | 40 | config.vm.provision :salt do |salt| 41 | salt.verbose = true 42 | salt.bootstrap_options= "-F -c /tmp -P" 43 | salt.minion_config = 'config/salt/minions/vagrant.conf' 44 | salt.run_highstate = true 45 | end 46 | 47 | end 48 | -------------------------------------------------------------------------------- /config/salt/config.sls: -------------------------------------------------------------------------------- 1 | start_conf: 2 | file.managed: 3 | - name: /etc/init/salty-wordpress.conf 4 | - source: salt://config/start_conf 5 | 6 | zshrc: 7 | file.managed: 8 | - name: /home/{{ grains['user'] }}/.zshrc 9 | - source: salt://config/zshrc 10 | 11 | zsh_theme: 12 | file.managed: 13 | - name: /home/{{ grains['user'] }}/.oh-my-zsh/themes/joeyhoyle.zsh-theme 14 | - source: salt://config/zsh-themes/joeyhoyle.zsh-theme 15 | - require: 16 | - git: oh_my_zsh 17 | 18 | {{ grains['user'] }}: 19 | user.present: 20 | - shell: /bin/zsh 21 | 22 | github.com: 23 | ssh_known_hosts: 24 | - present 25 | - user: {{ grains['user'] }} 26 | - fingerprint: 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48 27 | -------------------------------------------------------------------------------- /config/salt/config/mysql/my.cnf: -------------------------------------------------------------------------------- 1 | # 2 | # The MySQL database server configuration file. 3 | # 4 | # You can copy this to one of: 5 | # - "/etc/mysql/my.cnf" to set global options, 6 | # - "~/.my.cnf" to set user-specific options. 7 | # 8 | # One can use all long options that the program supports. 9 | # Run program with --help to get a list of available options and with 10 | # --print-defaults to see which it would actually understand and use. 11 | # 12 | # For explanations see 13 | # http://dev.mysql.com/doc/mysql/en/server-system-variables.html 14 | 15 | # This will be passed to all mysql clients 16 | # It has been reported that passwords should be enclosed with ticks/quotes 17 | # escpecially if they contain "#" chars... 18 | # Remember to edit /etc/mysql/debian.cnf when changing the socket location. 19 | [client] 20 | port = 3306 21 | socket = /var/run/mysqld/mysqld.sock 22 | 23 | # Here is entries for some specific programs 24 | # The following values assume you have at least 32M ram 25 | 26 | # This was formally known as [safe_mysqld]. Both versions are currently parsed. 27 | [mysqld_safe] 28 | socket = /var/run/mysqld/mysqld.sock 29 | nice = 0 30 | 31 | [mysqld] 32 | # 33 | # * Basic Settings 34 | # 35 | user = mysql 36 | pid-file = /var/run/mysqld/mysqld.pid 37 | socket = /var/run/mysqld/mysqld.sock 38 | port = 3306 39 | basedir = /usr 40 | datadir = /var/lib/mysql 41 | tmpdir = /tmp 42 | lc-messages-dir = /usr/share/mysql 43 | skip-external-locking 44 | # 45 | # Instead of skip-networking the default is now to listen only on 46 | # localhost which is more compatible and is not less secure. 47 | bind-address = 127.0.0.1 48 | # 49 | # * Fine Tuning 50 | # 51 | key_buffer = 16M 52 | max_allowed_packet = 16M 53 | thread_stack = 192K 54 | thread_cache_size = 8 55 | # This replaces the startup script and checks MyISAM tables if needed 56 | # the first time they are touched 57 | myisam-recover = BACKUP 58 | #max_connections = 100 59 | #table_cache = 64 60 | #thread_concurrency = 10 61 | # 62 | # * Query Cache Configuration 63 | # 64 | query_cache_limit = 1M 65 | query_cache_size = 16M 66 | # 67 | # * Logging and Replication 68 | # 69 | # Both location gets rotated by the cronjob. 70 | # Be aware that this log type is a performance killer. 71 | # As of 5.1 you can enable the log at runtime! 72 | #general_log_file = /var/log/mysql/mysql.log 73 | #general_log = 1 74 | # 75 | # Error log - should be very few entries. 76 | # 77 | log_error = /var/log/mysql/error.log 78 | # 79 | # Here you can see queries with especially long duration 80 | #log_slow_queries = /var/log/mysql/mysql-slow.log 81 | #long_query_time = 2 82 | #log-queries-not-using-indexes 83 | # 84 | # The following can be used as easy to replay backup logs or for replication. 85 | # note: if you are setting up a replication slave, see README.Debian about 86 | # other settings you may need to change. 87 | #server-id = 1 88 | #log_bin = /var/log/mysql/mysql-bin.log 89 | expire_logs_days = 10 90 | max_binlog_size = 100M 91 | #binlog_do_db = include_database_name 92 | #binlog_ignore_db = include_database_name 93 | 94 | # 95 | # * Security Features 96 | # 97 | # Read the manual, too, if you want chroot! 98 | # chroot = /var/lib/mysql/ 99 | # 100 | # For generating SSL certificates I recommend the OpenSSL GUI "tinyca". 101 | # 102 | # ssl-ca=/etc/mysql/cacert.pem 103 | # ssl-cert=/etc/mysql/server-cert.pem 104 | # ssl-key=/etc/mysql/server-key.pem 105 | 106 | 107 | 108 | [mysqldump] 109 | quick 110 | quote-names 111 | max_allowed_packet = 16M 112 | 113 | [mysql] 114 | #no-auto-rehash # faster start of mysql but no tab completition 115 | 116 | [isamchk] 117 | key_buffer = 16M 118 | 119 | # 120 | # * IMPORTANT: Additional settings that can override those from this file! 121 | # The files must end with '.cnf', otherwise they'll be ignored. 122 | # 123 | !includedir /etc/mysql/conf.d/ -------------------------------------------------------------------------------- /config/salt/config/nginx/default: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80 default_server; 3 | 4 | set $root $host; 5 | 6 | # for subdomains we want the document root to be the root domain only (e.g. notify.hmn.md > hmn.md) 7 | # but only if the subdomain isn't also a folder in the server root 8 | # Since we can't do nested ifs in nginx, this is a bit complicated 9 | set $strip_sub 0; 10 | set $new_domain 0; 11 | if ( !-d /srv/www/$root ) { 12 | set $strip_sub 1; 13 | } 14 | 15 | if ( $host ~* "(.+)\.(?(.+)\.([a-z]+|co\.uk))$" ) { 16 | set $strip_sub "${strip_sub}1"; 17 | } 18 | 19 | if ( $strip_sub = 11 ) { 20 | set $root $new_domain; 21 | } 22 | # end subdomain striping 23 | 24 | 25 | client_max_body_size 50M; 26 | 27 | if ( !-d /srv/www/$root ) { 28 | set $root 'default'; 29 | } 30 | 31 | # For WordPress develop. 32 | if ( -d /srv/www/$root/src ) { 33 | set $root $root/src; 34 | } 35 | 36 | include /srv/vhosts/nginx-additions*.conf; 37 | 38 | root /srv/www/$root; 39 | 40 | index index.php index.html; 41 | 42 | # rewrite for multiple sub-domain sets 43 | if ( -d /srv/www/$root/wordpress ) { 44 | rewrite ^(/wp-(admin|includes)/(.*))$ /wordpress$1 last; 45 | rewrite ^(/wp-[^/]*\.php)$ /wordpress$1 last; 46 | } 47 | 48 | # rewrite for multisite in subdirs, e.g. example.com/subsite1/ 49 | # if the file doest exist for wp-admin/* or wp-*.php, try looking in the parent dir 50 | if ( !-e $request_filename ) { 51 | rewrite /wp-admin$ $scheme://$host$uri/ permanent; 52 | rewrite ^(/[^/]+)?(/wp-.*) /wordpress$2 last; 53 | rewrite ^(/[^/]+)?(/.*\.php) /wordpress$2 last; 54 | } 55 | 56 | # wordpress multisite files handler (this is technically legacy but 57 | # still used on a lot of mutlisite installs) 58 | location ~ ^(/[^/]+/)?files/(.+) { 59 | try_files $uri /wp-includes/ms-files.php?file=$2 ; 60 | access_log off; log_not_found off; expires max; 61 | } 62 | 63 | 64 | # Block all web requests to hidden directories 65 | location ~ /\. { 66 | deny all; 67 | } 68 | 69 | # Block access to build scripts. 70 | location ~* /(Gruntfile\.js|package\.json|node_modules) { 71 | deny all; 72 | return 404; 73 | } 74 | 75 | location / { 76 | try_files $uri $uri/ /index.php?$args; 77 | } 78 | 79 | # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 80 | location ~ \.php$ { 81 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 82 | # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini 83 | 84 | # With php5-cgi alone: 85 | fastcgi_pass 127.0.0.1:9000; 86 | # With php5-fpm: 87 | fastcgi_index index.php; 88 | include fastcgi_params; 89 | 90 | # Set server name 91 | fastcgi_param SERVER_NAME $host; 92 | } 93 | 94 | } 95 | -------------------------------------------------------------------------------- /config/salt/config/nginx/nginx.conf: -------------------------------------------------------------------------------- 1 | {% if grains['user'] == 'vagrant' %} 2 | user vagrant; 3 | {% else %} 4 | user www-data; 5 | {% endif %} 6 | worker_processes 4; 7 | pid /run/nginx.pid; 8 | 9 | events { 10 | worker_connections 768; 11 | # multi_accept on; 12 | } 13 | 14 | http { 15 | 16 | ## 17 | # Basic Settings 18 | ## 19 | 20 | # sendfile doesn't work well on vagrant - caching side effects 21 | sendfile off; 22 | 23 | tcp_nopush on; 24 | tcp_nodelay on; 25 | keepalive_timeout 65; 26 | types_hash_max_size 2048; 27 | # server_tokens off; 28 | 29 | # server_names_hash_bucket_size 64; 30 | # server_name_in_redirect off; 31 | 32 | include /etc/nginx/mime.types; 33 | default_type application/octet-stream; 34 | 35 | ## 36 | # Logging Settings 37 | ## 38 | 39 | access_log /var/log/nginx/access.log; 40 | error_log /var/log/nginx/error.log; 41 | 42 | ## 43 | # Gzip Settings 44 | ## 45 | 46 | gzip on; 47 | gzip_disable "msie6"; 48 | 49 | # gzip_vary on; 50 | # gzip_proxied any; 51 | # gzip_comp_level 6; 52 | # gzip_buffers 16 8k; 53 | # gzip_http_version 1.1; 54 | # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; 55 | 56 | ## 57 | # Virtual Host Configs 58 | ## 59 | 60 | log_format logstash_json '{ "@timestamp": "$time_iso8601",' 61 | '"project": "{{ grains['project'] }}",' 62 | '"role": "{{ grains['role'] }}",' 63 | '"domain": "$host",' 64 | '"url": "$uri",' 65 | '"client": "$remote_addr",' 66 | '"user": "$remote_user",' 67 | '"size": $body_bytes_sent,' 68 | '"responsetime": $request_time,' 69 | '"status": "$status",' 70 | '"request": "$request",' 71 | '"method": "$request_method",' 72 | '"http_referrer": "$http_referer",' 73 | '"http_user_agent": "$http_user_agent"' 74 | '}'; 75 | 76 | access_log /var/log/nginx/access.json logstash_json; 77 | 78 | include /etc/nginx/conf.d/*.conf; 79 | include /etc/nginx/sites-enabled/*; 80 | } -------------------------------------------------------------------------------- /config/salt/config/php5-fpm/php.ini: -------------------------------------------------------------------------------- 1 | [PHP] 2 | 3 | ; Recommended that short tags - - are not used. 4 | ; Default Value: On 5 | ; Development Value: Off 6 | ; Production Value: Off 7 | ; http://php.net/short-open-tag 8 | short_open_tag = Off 9 | 10 | ; If you pass a value by reference at function call time... 11 | ; Default Value: On (Suppress warnings) 12 | ; Development Value: Off (Issue warnings) 13 | ; Production Value: Off (Issue warnings) 14 | ; http://php.net/allow-call-time-pass-reference 15 | allow_call_time_pass_reference = Off 16 | 17 | ; Maximum execution time of each script, in seconds 18 | ; http://php.net/max-execution-time 19 | ; Note: This directive is hardcoded to 0 for the CLI SAPI 20 | max_execution_time = 30 21 | 22 | ; Maximum amount of memory a script may consume (128MB) 23 | ; http://php.net/memory-limit 24 | memory_limit = 128M 25 | 26 | ; Common Values: 27 | ; E_ALL & ~E_NOTICE (Show all errors, except for notices and coding standards warnings.) 28 | ; E_ALL & ~E_NOTICE | E_STRICT (Show all errors, except for notices) 29 | ; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors) 30 | ; E_ALL | E_STRICT (Show all errors, warnings and notices including coding standards.) 31 | ; Default Value: E_ALL & ~E_NOTICE 32 | ; Development Value: E_ALL | E_STRICT 33 | ; Production Value: E_ALL & ~E_DEPRECATED 34 | ; http://php.net/error-reporting 35 | {% if grains['user'] == 'vagrant' %} 36 | error_reporting = E_ALL | E_STRICT 37 | {% else %} 38 | error_reporting = E_ALL & ~E_DEPRECATED 39 | {% endif %} 40 | 41 | ; Should PHP output errors. If so, where? 42 | ; Possible Values: 43 | ; Off = Do not display any errors 44 | ; stderr = Display errors to STDERR (affects only CGI/CLI binaries!) 45 | ; On or stdout = Display errors to STDOUT 46 | ; Default Value: On 47 | ; Development Value: On 48 | ; Production Value: Off 49 | ; http://php.net/display-errors 50 | {% if grains['user'] == 'vagrant' %} 51 | display_errors = On 52 | {% else %} 53 | display_errors = Off 54 | {% endif %} 55 | 56 | ; Besides displaying errors, PHP can also log errors to locations such as a 57 | ; server-specific log, STDERR, or a location specified by the error_log 58 | ; directive found below. While errors should not be displayed on productions 59 | ; servers they should still be monitored and logging is a great way to do that. 60 | ; Default Value: Off 61 | ; Development Value: On 62 | ; Production Value: On 63 | ; http://php.net/log-errors 64 | log_errors = On 65 | 66 | ; Set maximum length of log_errors. In error_log information about the source is 67 | ; added. The default is 1024 and 0 allows to not apply any maximum length at all. 68 | ; http://php.net/log-errors-max-len 69 | log_errors_max_len = 1024 70 | 71 | ; Do not log repeated messages. Repeated errors must occur in same file on same 72 | ; line unless ignore_repeated_source is set true. 73 | ; http://php.net/ignore-repeated-errors 74 | ignore_repeated_errors = Off 75 | 76 | ; Ignore source of message when ignoring repeated messages. When this setting 77 | ; is On you will not log errors with repeated messages from different files or 78 | ; source lines. 79 | ; http://php.net/ignore-repeated-source 80 | ignore_repeated_source = Off 81 | 82 | ; Store the last error/warning message in $php_errormsg (boolean). Setting this value 83 | ; to On can assist in debugging and is appropriate for development servers. It should 84 | ; however be disabled on production servers. 85 | ; Default Value: Off 86 | ; Development Value: On 87 | ; Production Value: Off 88 | ; http://php.net/track-errors 89 | track_errors = Off 90 | 91 | ; Display HTML links to docs related to the error? 92 | ; Default Value: On 93 | ; Development Value: On 94 | ; Production value: Off 95 | ; http://php.net/html-errors 96 | html_errors = 1 97 | 98 | ; String to output before an error message. PHP's default behavior is to leave 99 | ; this setting blank. 100 | ; http://php.net/error-prepend-string 101 | ; Example: 102 | ;error_prepend_string = "" 103 | 104 | ; String to output after an error message. PHP's default behavior is to leave 105 | ; this setting blank. 106 | ; http://php.net/error-append-string 107 | ; Example: 108 | ;error_append_string = "" 109 | 110 | ; Log errors to specified file. PHP's default behavior is to leave this value 111 | ; empty. 112 | ; http://php.net/error-log 113 | ; Example: 114 | error_log = /var/log/php.log 115 | 116 | ; Maximum size of POST data that PHP will accept. 117 | ; http://php.net/post-max-size 118 | post_max_size = 50M 119 | 120 | ; Maximum allowed size for uploaded files. 121 | ; http://php.net/upload-max-filesize 122 | upload_max_filesize = 50M 123 | 124 | ; Maximum number of files that can be uploaded via a single request 125 | max_file_uploads = 20 126 | 127 | ; Default timeout for socket based streams (seconds) 128 | ; http://php.net/default-socket-timeout 129 | default_socket_timeout = 60 130 | 131 | {% if grains['user'] == 'vagrant' %} 132 | ; Enable XDebug debugging 133 | xdebug.profiler_aggregate = off 134 | xdebug.profiler_append = off 135 | xdebug.profiler_enable = off 136 | xdebug.profiler_enable_trigger = on 137 | xdebug.idekey = "vagrant" 138 | xdebug.remote_autostart = on 139 | xdebug.remote_connect_back = on 140 | xdebug.remote_cookie_expire_time = 3600 141 | xdebug.remote_enable = on 142 | xdebug.remote_port = 9000 143 | xdebug.remote_host = "192.168.50.10" 144 | xdebug.overload_var_dump = 0 145 | {% endif %} -------------------------------------------------------------------------------- /config/salt/config/php5-fpm/www.conf: -------------------------------------------------------------------------------- 1 | ; Start a new pool named 'www'. 2 | ; the variable $pool can we used in any directive and will be replaced by the 3 | ; pool name ('www' here) 4 | [www] 5 | 6 | ; Per pool prefix 7 | ; It only applies on the following directives: 8 | ; - 'slowlog' 9 | ; - 'listen' (unixsocket) 10 | ; - 'chroot' 11 | ; - 'chdir' 12 | ; - 'php_values' 13 | ; - 'php_admin_values' 14 | ; When not set, the global prefix (or /usr) applies instead. 15 | ; Note: This directive can also be relative to the global prefix. 16 | ; Default Value: none 17 | ;prefix = /path/to/pools/$pool 18 | 19 | ; Unix user/group of processes 20 | ; Note: The user is mandatory. If the group is not set, the default user's group 21 | ; will be used. 22 | 23 | {% if grains['user'] == 'vagrant' %} 24 | user = vagrant 25 | group = vagrant 26 | {% else %} 27 | user = www-data 28 | group = www-data 29 | {% endif %} 30 | 31 | ; The address on which to accept FastCGI requests. 32 | ; Valid syntaxes are: 33 | ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on 34 | ; a specific port; 35 | ; 'port' - to listen on a TCP socket to all addresses on a 36 | ; specific port; 37 | ; '/path/to/unix/socket' - to listen on a unix socket. 38 | ; Note: This value is mandatory. 39 | listen = 127.0.0.1:9000 40 | 41 | ; Set listen(2) backlog. 42 | ; Default Value: 128 (-1 on FreeBSD and OpenBSD) 43 | ;listen.backlog = 128 44 | 45 | ; Set permissions for unix socket, if one is used. In Linux, read/write 46 | ; permissions must be set in order to allow connections from a web server. Many 47 | ; BSD-derived systems allow connections regardless of permissions. 48 | ; Default Values: user and group are set as the running user 49 | ; mode is set to 0666 50 | ;listen.owner = www-data 51 | ;listen.group = www-data 52 | ;listen.mode = 0666 53 | 54 | ; List of ipv4 addresses of FastCGI clients which are allowed to connect. 55 | ; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original 56 | ; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address 57 | ; must be separated by a comma. If this value is left blank, connections will be 58 | ; accepted from any ip address. 59 | ; Default Value: any 60 | listen.allowed_clients = 127.0.0.1 61 | 62 | ; Specify the nice(2) priority to apply to the pool processes (only if set) 63 | ; The value can vary from -19 (highest priority) to 20 (lower priority) 64 | ; Note: - It will only work if the FPM master process is launched as root 65 | ; - The pool processes will inherit the master process priority 66 | ; unless it specified otherwise 67 | ; Default Value: no set 68 | ; priority = -19 69 | 70 | ; Choose how the process manager will control the number of child processes. 71 | ; Possible Values: 72 | ; static - a fixed number (pm.max_children) of child processes; 73 | ; dynamic - the number of child processes are set dynamically based on the 74 | ; following directives. With this process management, there will be 75 | ; always at least 1 children. 76 | ; pm.max_children - the maximum number of children that can 77 | ; be alive at the same time. 78 | ; pm.start_servers - the number of children created on startup. 79 | ; pm.min_spare_servers - the minimum number of children in 'idle' 80 | ; state (waiting to process). If the number 81 | ; of 'idle' processes is less than this 82 | ; number then some children will be created. 83 | ; pm.max_spare_servers - the maximum number of children in 'idle' 84 | ; state (waiting to process). If the number 85 | ; of 'idle' processes is greater than this 86 | ; number then some children will be killed. 87 | ; ondemand - no children are created at startup. Children will be forked when 88 | ; new requests will connect. The following parameter are used: 89 | ; pm.max_children - the maximum number of children that 90 | ; can be alive at the same time. 91 | ; pm.process_idle_timeout - The number of seconds after which 92 | ; an idle process will be killed. 93 | ; Note: This value is mandatory. 94 | pm = dynamic 95 | 96 | ; The number of child processes to be created when pm is set to 'static' and the 97 | ; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. 98 | ; This value sets the limit on the number of simultaneous requests that will be 99 | ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. 100 | ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP 101 | ; CGI. The below defaults are based on a server without much resources. Don't 102 | ; forget to tweak pm.* to fit your needs. 103 | ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' 104 | ; Note: This value is mandatory. 105 | pm.max_children = 5 106 | 107 | ; The number of child processes created on startup. 108 | ; Note: Used only when pm is set to 'dynamic' 109 | ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 110 | pm.start_servers = 2 111 | 112 | ; The desired minimum number of idle server processes. 113 | ; Note: Used only when pm is set to 'dynamic' 114 | ; Note: Mandatory when pm is set to 'dynamic' 115 | pm.min_spare_servers = 1 116 | 117 | ; The desired maximum number of idle server processes. 118 | ; Note: Used only when pm is set to 'dynamic' 119 | ; Note: Mandatory when pm is set to 'dynamic' 120 | pm.max_spare_servers = 3 121 | 122 | ; The number of seconds after which an idle process will be killed. 123 | ; Note: Used only when pm is set to 'ondemand' 124 | ; Default Value: 10s 125 | ;pm.process_idle_timeout = 10s; 126 | 127 | ; The number of requests each child process should execute before respawning. 128 | ; This can be useful to work around memory leaks in 3rd party libraries. For 129 | ; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. 130 | ; Default Value: 0 131 | ;pm.max_requests = 500 132 | 133 | ; The URI to view the FPM status page. If this value is not set, no URI will be 134 | ; recognized as a status page. It shows the following informations: 135 | ; pool - the name of the pool; 136 | ; process manager - static, dynamic or ondemand; 137 | ; start time - the date and time FPM has started; 138 | ; start since - number of seconds since FPM has started; 139 | ; accepted conn - the number of request accepted by the pool; 140 | ; listen queue - the number of request in the queue of pending 141 | ; connections (see backlog in listen(2)); 142 | ; max listen queue - the maximum number of requests in the queue 143 | ; of pending connections since FPM has started; 144 | ; listen queue len - the size of the socket queue of pending connections; 145 | ; idle processes - the number of idle processes; 146 | ; active processes - the number of active processes; 147 | ; total processes - the number of idle + active processes; 148 | ; max active processes - the maximum number of active processes since FPM 149 | ; has started; 150 | ; max children reached - number of times, the process limit has been reached, 151 | ; when pm tries to start more children (works only for 152 | ; pm 'dynamic' and 'ondemand'); 153 | ; Value are updated in real time. 154 | ; Example output: 155 | ; pool: www 156 | ; process manager: static 157 | ; start time: 01/Jul/2011:17:53:49 +0200 158 | ; start since: 62636 159 | ; accepted conn: 190460 160 | ; listen queue: 0 161 | ; max listen queue: 1 162 | ; listen queue len: 42 163 | ; idle processes: 4 164 | ; active processes: 11 165 | ; total processes: 15 166 | ; max active processes: 12 167 | ; max children reached: 0 168 | ; 169 | ; By default the status page output is formatted as text/plain. Passing either 170 | ; 'html', 'xml' or 'json' in the query string will return the corresponding 171 | ; output syntax. Example: 172 | ; http://www.foo.bar/status 173 | ; http://www.foo.bar/status?json 174 | ; http://www.foo.bar/status?html 175 | ; http://www.foo.bar/status?xml 176 | ; 177 | ; By default the status page only outputs short status. Passing 'full' in the 178 | ; query string will also return status for each pool process. 179 | ; Example: 180 | ; http://www.foo.bar/status?full 181 | ; http://www.foo.bar/status?json&full 182 | ; http://www.foo.bar/status?html&full 183 | ; http://www.foo.bar/status?xml&full 184 | ; The Full status returns for each process: 185 | ; pid - the PID of the process; 186 | ; state - the state of the process (Idle, Running, ...); 187 | ; start time - the date and time the process has started; 188 | ; start since - the number of seconds since the process has started; 189 | ; requests - the number of requests the process has served; 190 | ; request duration - the duration in µs of the requests; 191 | ; request method - the request method (GET, POST, ...); 192 | ; request URI - the request URI with the query string; 193 | ; content length - the content length of the request (only with POST); 194 | ; user - the user (PHP_AUTH_USER) (or '-' if not set); 195 | ; script - the main script called (or '-' if not set); 196 | ; last request cpu - the %cpu the last request consumed 197 | ; it's always 0 if the process is not in Idle state 198 | ; because CPU calculation is done when the request 199 | ; processing has terminated; 200 | ; last request memory - the max amount of memory the last request consumed 201 | ; it's always 0 if the process is not in Idle state 202 | ; because memory calculation is done when the request 203 | ; processing has terminated; 204 | ; If the process is in Idle state, then informations are related to the 205 | ; last request the process has served. Otherwise informations are related to 206 | ; the current request being served. 207 | ; Example output: 208 | ; ************************ 209 | ; pid: 31330 210 | ; state: Running 211 | ; start time: 01/Jul/2011:17:53:49 +0200 212 | ; start since: 63087 213 | ; requests: 12808 214 | ; request duration: 1250261 215 | ; request method: GET 216 | ; request URI: /test_mem.php?N=10000 217 | ; content length: 0 218 | ; user: - 219 | ; script: /home/fat/web/docs/php/test_mem.php 220 | ; last request cpu: 0.00 221 | ; last request memory: 0 222 | ; 223 | ; Note: There is a real-time FPM status monitoring sample web page available 224 | ; It's available in: ${prefix}/share/fpm/status.html 225 | ; 226 | ; Note: The value must start with a leading slash (/). The value can be 227 | ; anything, but it may not be a good idea to use the .php extension or it 228 | ; may conflict with a real PHP file. 229 | ; Default Value: not set 230 | pm.status_path = /status 231 | 232 | ; The ping URI to call the monitoring page of FPM. If this value is not set, no 233 | ; URI will be recognized as a ping page. This could be used to test from outside 234 | ; that FPM is alive and responding, or to 235 | ; - create a graph of FPM availability (rrd or such); 236 | ; - remove a server from a group if it is not responding (load balancing); 237 | ; - trigger alerts for the operating team (24/7). 238 | ; Note: The value must start with a leading slash (/). The value can be 239 | ; anything, but it may not be a good idea to use the .php extension or it 240 | ; may conflict with a real PHP file. 241 | ; Default Value: not set 242 | ;ping.path = /ping 243 | 244 | ; This directive may be used to customize the response of a ping request. The 245 | ; response is formatted as text/plain with a 200 response code. 246 | ; Default Value: pong 247 | ;ping.response = pong 248 | 249 | ; The access log file 250 | ; Default: not set 251 | ;access.log = log/$pool.access.log 252 | 253 | ; The access log format. 254 | ; The following syntax is allowed 255 | ; %%: the '%' character 256 | ; %C: %CPU used by the request 257 | ; it can accept the following format: 258 | ; - %{user}C for user CPU only 259 | ; - %{system}C for system CPU only 260 | ; - %{total}C for user + system CPU (default) 261 | ; %d: time taken to serve the request 262 | ; it can accept the following format: 263 | ; - %{seconds}d (default) 264 | ; - %{miliseconds}d 265 | ; - %{mili}d 266 | ; - %{microseconds}d 267 | ; - %{micro}d 268 | ; %e: an environment variable (same as $_ENV or $_SERVER) 269 | ; it must be associated with embraces to specify the name of the env 270 | ; variable. Some exemples: 271 | ; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e 272 | ; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e 273 | ; %f: script filename 274 | ; %l: content-length of the request (for POST request only) 275 | ; %m: request method 276 | ; %M: peak of memory allocated by PHP 277 | ; it can accept the following format: 278 | ; - %{bytes}M (default) 279 | ; - %{kilobytes}M 280 | ; - %{kilo}M 281 | ; - %{megabytes}M 282 | ; - %{mega}M 283 | ; %n: pool name 284 | ; %o: ouput header 285 | ; it must be associated with embraces to specify the name of the header: 286 | ; - %{Content-Type}o 287 | ; - %{X-Powered-By}o 288 | ; - %{Transfert-Encoding}o 289 | ; - .... 290 | ; %p: PID of the child that serviced the request 291 | ; %P: PID of the parent of the child that serviced the request 292 | ; %q: the query string 293 | ; %Q: the '?' character if query string exists 294 | ; %r: the request URI (without the query string, see %q and %Q) 295 | ; %R: remote IP address 296 | ; %s: status (response code) 297 | ; %t: server time the request was received 298 | ; it can accept a strftime(3) format: 299 | ; %d/%b/%Y:%H:%M:%S %z (default) 300 | ; %T: time the log has been written (the request has finished) 301 | ; it can accept a strftime(3) format: 302 | ; %d/%b/%Y:%H:%M:%S %z (default) 303 | ; %u: remote user 304 | ; 305 | ; Default: "%R - %u %t \"%m %r\" %s" 306 | ;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" 307 | 308 | ; The log file for slow requests 309 | ; Default Value: not set 310 | ; Note: slowlog is mandatory if request_slowlog_timeout is set 311 | ;slowlog = log/$pool.log.slow 312 | 313 | ; The timeout for serving a single request after which a PHP backtrace will be 314 | ; dumped to the 'slowlog' file. A value of '0s' means 'off'. 315 | ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) 316 | ; Default Value: 0 317 | ;request_slowlog_timeout = 0 318 | 319 | ; The timeout for serving a single request after which the worker process will 320 | ; be killed. This option should be used when the 'max_execution_time' ini option 321 | ; does not stop script execution for some reason. A value of '0' means 'off'. 322 | ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) 323 | ; Default Value: 0 324 | ;request_terminate_timeout = 0 325 | 326 | ; Set open file descriptor rlimit. 327 | ; Default Value: system defined value 328 | ;rlimit_files = 1024 329 | 330 | ; Set max core size rlimit. 331 | ; Possible Values: 'unlimited' or an integer greater or equal to 0 332 | ; Default Value: system defined value 333 | ;rlimit_core = 0 334 | 335 | ; Chroot to this directory at the start. This value must be defined as an 336 | ; absolute path. When this value is not set, chroot is not used. 337 | ; Note: you can prefix with '$prefix' to chroot to the pool prefix or one 338 | ; of its subdirectories. If the pool prefix is not set, the global prefix 339 | ; will be used instead. 340 | ; Note: chrooting is a great security feature and should be used whenever 341 | ; possible. However, all PHP paths will be relative to the chroot 342 | ; (error_log, sessions.save_path, ...). 343 | ; Default Value: not set 344 | ;chroot = 345 | 346 | ; Chdir to this directory at the start. 347 | ; Note: relative path can be used. 348 | ; Default Value: current directory or / when chroot 349 | chdir = / 350 | 351 | ; Redirect worker stdout and stderr into main error log. If not set, stdout and 352 | ; stderr will be redirected to /dev/null according to FastCGI specs. 353 | ; Note: on highloaded environement, this can cause some delay in the page 354 | ; process time (several ms). 355 | ; Default Value: no 356 | ;catch_workers_output = yes 357 | 358 | ; Limits the extensions of the main script FPM will allow to parse. This can 359 | ; prevent configuration mistakes on the web server side. You should only limit 360 | ; FPM to .php extensions to prevent malicious users to use other extensions to 361 | ; exectute php code. 362 | ; Note: set an empty value to allow all extensions. 363 | ; Default Value: .php 364 | ;security.limit_extensions = .php .php3 .php4 .php5 365 | 366 | ; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from 367 | ; the current environment. 368 | ; Default Value: clean env 369 | ;env[HOSTNAME] = $HOSTNAME 370 | ;env[PATH] = /usr/local/bin:/usr/bin:/bin 371 | ;env[TMP] = /tmp 372 | ;env[TMPDIR] = /tmp 373 | ;env[TEMP] = /tmp 374 | 375 | ; Additional php.ini defines, specific to this pool of workers. These settings 376 | ; overwrite the values previously defined in the php.ini. The directives are the 377 | ; same as the PHP SAPI: 378 | ; php_value/php_flag - you can set classic ini defines which can 379 | ; be overwritten from PHP call 'ini_set'. 380 | ; php_admin_value/php_admin_flag - these directives won't be overwritten by 381 | ; PHP call 'ini_set' 382 | ; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. 383 | 384 | ; Defining 'extension' will load the corresponding shared extension from 385 | ; extension_dir. Defining 'disable_functions' or 'disable_classes' will not 386 | ; overwrite previously defined php.ini values, but will append the new value 387 | ; instead. 388 | 389 | ; Note: path INI options can be relative and will be expanded with the prefix 390 | ; (pool, global or /usr) 391 | 392 | ; Default Value: nothing is defined by default except the values in php.ini and 393 | ; specified at startup with the -d argument 394 | ;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com 395 | ;php_flag[display_errors] = off 396 | ;php_admin_value[error_log] = /var/log/fpm-php.www.log 397 | ;php_admin_flag[log_errors] = on 398 | ;php_admin_value[memory_limit] = 32M 399 | -------------------------------------------------------------------------------- /config/salt/config/postfix/main.cf: -------------------------------------------------------------------------------- 1 | # Managed by config management 2 | # See /usr/share/postfix/main.cf.dist for a commented, more complete version 3 | 4 | # Debian specific: Specifying a file name will cause the first 5 | # line of that file to be used as the name. The Debian default 6 | # is /etc/mailname. 7 | #myorigin = /etc/mailname 8 | 9 | smtpd_banner = $myhostname ESMTP $mail_name 10 | biff = no 11 | 12 | # appending .domain is the MUA's job. 13 | append_dot_mydomain = no 14 | 15 | # Uncomment the next line to generate "delayed mail" warnings 16 | #delay_warning_time = 4h 17 | 18 | readme_directory = no 19 | 20 | # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for 21 | # information on enabling SSL in the smtp client. 22 | 23 | myhostname = {{ grains['fqdn'] }} 24 | mydestination = {{ grains['fqdn'] }}, localhost 25 | relayhost = 26 | mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 27 | mailbox_size_limit = 0 28 | recipient_delimiter = + 29 | inet_interfaces = all -------------------------------------------------------------------------------- /config/salt/config/start_conf: -------------------------------------------------------------------------------- 1 | # salty-wordpress - necessary services at start 2 | 3 | description "necessary services for Salty WordPress" 4 | 5 | start on runlevel [2345] 6 | 7 | script 8 | #! /bin/bash 9 | service nginx start 10 | service php5-fpm start 11 | service memcached start 12 | service dnsmasq start 13 | # Hack becuz we need to wait for MySQL dir to be mounted https://github.com/mitchellh/vagrant/issues/1776#issuecomment-25181024 14 | COUNTER=0 15 | while [ $COUNTER -lt 900 ]; do 16 | sleep 5 17 | COUNTER=$(($COUNTER+1)) 18 | if [ "$(ls -A /var/lib/mysql)" ]; then 19 | service mysql start 20 | COUNTER=1000 21 | fi 22 | done 23 | end script -------------------------------------------------------------------------------- /config/salt/config/wp_cli_completion: -------------------------------------------------------------------------------- 1 | # bash completion for the `wp` command 2 | 3 | _wp_complete() { 4 | local cur=${COMP_WORDS[COMP_CWORD]} 5 | 6 | IFS=$'\n'; # want to preserve spaces at the end 7 | local opts="$(wp cli completions --line="$COMP_LINE" --point="$COMP_POINT")" 8 | 9 | if [[ "$opts" =~ \\s* ]] 10 | then 11 | COMPREPLY=( $(compgen -f -- $cur) ) 12 | elif [[ $opts = "" ]] 13 | then 14 | COMPREPLY=( $(compgen -f -- $cur) ) 15 | else 16 | COMPREPLY=( ${opts[*]} ) 17 | fi 18 | } 19 | complete -o nospace -F _wp_complete wp 20 | -------------------------------------------------------------------------------- /config/salt/config/zsh-themes/joeyhoyle.zsh-theme: -------------------------------------------------------------------------------- 1 | function get_host { 2 | 3 | if [ -f /etc/salt/grains ] 4 | then 5 | echo $( cat /etc/salt/grains | ack "project: (\S*)" --output='$1' )-$( echo `hostname` )'' 6 | fi 7 | 8 | if [ ! -f /etc/salt/grains ] 9 | then 10 | echo $( echo `hostname` )'' 11 | fi 12 | } 13 | 14 | PROMPT='%{$fg_bold[red]%}$(get_host) ➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}%{$fg_bold[blue]%} % %{$reset_color%}' 15 | 16 | ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" 17 | ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" 18 | ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" 19 | ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" 20 | -------------------------------------------------------------------------------- /config/salt/config/zshrc: -------------------------------------------------------------------------------- 1 | # Path to your oh-my-zsh configuration. 2 | ZSH=$HOME/.oh-my-zsh 3 | 4 | export EDITOR=vim 5 | export WP_TESTS_DIR=/srv/www/wordpress-develop.dev/tests/phpunit 6 | export WP_DEVELOP_DIR=/srv/www/wordpress-develop.dev 7 | 8 | alias ack=ack-grep 9 | alias git=hub 10 | alias subl=rmate 11 | 12 | serialize() { php -r "print_r( unserialize('$*') );" } 13 | timestamp() { php -r "echo @date( 'c', $* ) . \"\n\";" } 14 | 15 | # Set name of the theme to load. 16 | # Look in ~/.oh-my-zsh/themes/ 17 | # Optionally, if you set this to "random", it'll load a random theme each 18 | # time that oh-my-zsh is loaded. 19 | ZSH_CUSTOM=$HOME/config/zsh-themes 20 | ZSH_THEME="joeyhoyle" 21 | 22 | # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) 23 | # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ 24 | # Example format: plugins=(rails git textmate ruby lighthouse) 25 | plugins=(autojump) 26 | 27 | DISABLE_AUTO_UPDATE="true" 28 | 29 | [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" 30 | 31 | source $ZSH/oh-my-zsh.sh 32 | 33 | # Customize to your needs... 34 | export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/rvm/bin:/usr/local/rvm/bin: 35 | 36 | # WP-CLI Bash completions 37 | autoload bashcompinit 38 | bashcompinit 39 | source $HOME/.wp_cli_completion.bash 40 | -------------------------------------------------------------------------------- /config/salt/memcached.sls: -------------------------------------------------------------------------------- 1 | memcached: 2 | pkg: 3 | - installed 4 | service.running: 5 | - require: 6 | - pkg: memcached -------------------------------------------------------------------------------- /config/salt/minions/vagrant.conf: -------------------------------------------------------------------------------- 1 | file_client: local 2 | 3 | file_roots: 4 | base: 5 | - /srv/salt 6 | 7 | grains: 8 | roles: 9 | - webserver 10 | - memcached 11 | - vagrant 12 | user: vagrant 13 | project: salty-wordpress 14 | role: salt-minion 15 | 16 | state_output: mixed 17 | -------------------------------------------------------------------------------- /config/salt/mysql.sls: -------------------------------------------------------------------------------- 1 | mysql-server: 2 | pkg.installed: 3 | - name: mysql-server-5.5 4 | 5 | mysql: 6 | service.running: 7 | - name: mysql 8 | - require: 9 | - pkg: mysql-server 10 | - watch: 11 | - file: /etc/mysql/my.cnf 12 | 13 | /etc/mysql/my.cnf: 14 | file.managed: 15 | - source: salt://config/mysql/my.cnf 16 | - user: root 17 | - group: root 18 | - mode: 644 -------------------------------------------------------------------------------- /config/salt/nginx.sls: -------------------------------------------------------------------------------- 1 | # Make sure nginx is installed and up 2 | nginx: 3 | pkg: 4 | - installed 5 | service.running: 6 | - require: 7 | - pkg: nginx 8 | - watch: 9 | - file: /etc/nginx/nginx.conf 10 | - file: /etc/nginx/sites-enabled/default 11 | 12 | # Configuration files for nginx 13 | /etc/nginx/nginx.conf: 14 | file.managed: 15 | - source: salt://config/nginx/nginx.conf 16 | - user: root 17 | - group: root 18 | - mode: 644 19 | - template: jinja 20 | 21 | /etc/nginx/sites-enabled/default: 22 | file.managed: 23 | - source: salt://config/nginx/default 24 | - user: root 25 | - group: root 26 | - mode: 644 27 | 28 | {% if grains['user'] != 'vagrant' %} 29 | /srv/www: 30 | file.directory: 31 | - user: {{ grains['user'] }} 32 | - group: {{ grains['user'] }} 33 | - mode: 755 34 | - makedirs: True 35 | 36 | /srv/www/default/index.php: 37 | file.managed: 38 | - user: {{ grains['user'] }} 39 | - group: {{ grains['user'] }} 40 | - mode: 644 41 | - contents: "not found" 42 | {% endif %} -------------------------------------------------------------------------------- /config/salt/node.sls: -------------------------------------------------------------------------------- 1 | npm-repo: 2 | pkgrepo.managed: 3 | - ppa: chris-lea/node.js 4 | - require_in: 5 | - pkg: nodejs 6 | 7 | nodejs: 8 | pkg.installed 9 | 10 | sass: 11 | gem.installed: 12 | - name: sass 13 | 14 | grunt-cli: 15 | npm.installed: 16 | - name: grunt-cli 17 | - require: 18 | - pkg: nodejs -------------------------------------------------------------------------------- /config/salt/php_fpm.sls: -------------------------------------------------------------------------------- 1 | # PHP5 modules and configuration 2 | php_stack: 3 | pkg.installed: 4 | - name: php5-fpm 5 | service.running: 6 | - name: php5-fpm 7 | - require: 8 | - pkg: php5-fpm 9 | - pkg: php5-gd 10 | - pkg: php5-mysql 11 | - pkg: php5-json 12 | - pkg: php5-memcache 13 | - pkg: php5-memcached 14 | - pkg: php5-mcrypt 15 | - pkg: php5-curl 16 | - pkg: php5-cli 17 | - pkg: php-apc 18 | - pkg: mysql-client 19 | {% if grains['user'] == 'vagrant' %} 20 | - pkg: php5-xdebug 21 | {% endif %} 22 | - watch: 23 | - file: /etc/php5/fpm/php.ini 24 | - file: /etc/php5/fpm/pool.d/www.conf 25 | 26 | php_gd: 27 | pkg.installed: 28 | - name: php5-gd 29 | 30 | php_mysql: 31 | pkg.installed: 32 | - name: php5-mysql 33 | 34 | php_json: 35 | pkg.installed: 36 | - name: php5-json 37 | 38 | php_memcache: 39 | pkg.installed: 40 | - name: php5-memcache 41 | 42 | php_mcrypt: 43 | pkg.installed: 44 | - name: php5-mcrypt 45 | 46 | php_curl: 47 | pkg.installed: 48 | - name: php5-curl 49 | 50 | php_imagick: 51 | pkg.installed: 52 | - name: php5-imagick 53 | 54 | {% if grains['user'] == 'vagrant' %} 55 | php_xdebug: 56 | pkg.installed: 57 | - name: php5-xdebug 58 | {% endif %} 59 | 60 | # php5-imagick also requires imagemagick 61 | imagemagick: 62 | pkg.installed 63 | 64 | php_cli: 65 | pkg.installed: 66 | - name: php5-cli 67 | 68 | php_apc: 69 | pkg.installed: 70 | - name: php-apc 71 | 72 | mysql_client: 73 | pkg.installed: 74 | - name: mysql-client 75 | 76 | libssh2-1-dev: 77 | pkg.installed: 78 | - name: libssh2-1-dev 79 | 80 | libssh2-php: 81 | pkg.installed: 82 | - name: libssh2-php 83 | 84 | composer: 85 | cmd.run: 86 | - name: curl -sS https://getcomposer.org/installer | php; mv composer.phar /usr/local/bin/composer 87 | - unless: which composer 88 | - require: 89 | - pkg: php_cli 90 | 91 | # Configuration files for php5-fpm 92 | 93 | /etc/php5/fpm/php.ini: 94 | file.managed: 95 | - source: salt://config/php5-fpm/php.ini 96 | - user: root 97 | - group: root 98 | - template: jinja 99 | - mode: 644 100 | 101 | /etc/php5/fpm/pool.d/www.conf: 102 | file.managed: 103 | - source: salt://config/php5-fpm/www.conf 104 | - user: root 105 | - group: root 106 | - template: jinja 107 | - mode: 644 108 | 109 | {% if grains['user'] != 'vagrant' %} 110 | /var/log/php.log: 111 | file.managed: 112 | - user: www-data 113 | - group: www-data 114 | - mode: 644 115 | {% endif %} -------------------------------------------------------------------------------- /config/salt/postfix.sls: -------------------------------------------------------------------------------- 1 | postfix: 2 | pkg: 3 | - installed 4 | service.running: 5 | - enable: True 6 | - require: 7 | - pkg: postfix 8 | - watch: 9 | - file: /etc/postfix/main.cf 10 | 11 | # postfix main configuration file 12 | /etc/postfix/main.cf: 13 | file.managed: 14 | - source: salt://config/postfix/main.cf 15 | - user: root 16 | - group: root 17 | - mode: 644 18 | - template: jinja 19 | - require: 20 | - pkg: postfix -------------------------------------------------------------------------------- /config/salt/tools.sls: -------------------------------------------------------------------------------- 1 | # Editors 2 | 3 | vim: 4 | pkg.installed: 5 | - name: vim 6 | 7 | nano: 8 | pkg.installed: 9 | - name: nano 10 | 11 | 12 | # Make the CLI experience more awesome 13 | autojump: 14 | pkg.installed 15 | 16 | # Ensure server time is always in-sync 17 | ntp: 18 | pkg: 19 | - installed 20 | service: 21 | - running 22 | 23 | # Uncategorized 24 | 25 | curl: 26 | pkg.installed: 27 | - name: curl 28 | 29 | git-ppa: 30 | pkgrepo.managed: 31 | - humanname: Git Core PPA 32 | - name: deb http://ppa.launchpad.net/git-core/ubuntu/ precise main 33 | - ppa: git-core/ppa 34 | - require_in: 35 | - git 36 | 37 | git: 38 | pkg.installed 39 | 40 | svn: 41 | pkg.installed: 42 | - name: subversion 43 | 44 | tig: 45 | pkg.installed: 46 | - require: 47 | - pkg: git 48 | 49 | zip: 50 | pkg: 51 | - installed 52 | 53 | ack-grep: 54 | pkg: 55 | - installed 56 | 57 | zsh: 58 | pkg: 59 | - installed 60 | 61 | htop: 62 | pkg: 63 | - installed 64 | 65 | wp_cli: 66 | cmd.run: 67 | - name: curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli-nightly.phar; chmod +x wp-cli-nightly.phar; sudo mv wp-cli-nightly.phar /usr/bin/wp 68 | - user: {{ grains['user'] }} 69 | - require: 70 | - pkg: php5-cli 71 | - pkg: php5-json 72 | - pkg: git 73 | 74 | wp_cli_bash: 75 | file.managed: 76 | - name: /home/{{ grains['user'] }}/.wp_cli_completion.bash 77 | - source: salt://config/wp_cli_completion 78 | 79 | oh_my_zsh: 80 | git.latest: 81 | - name: git://github.com/robbyrussell/oh-my-zsh.git 82 | - rev: master 83 | - target: /home/{{ grains['user'] }}/.oh-my-zsh 84 | - runas: root 85 | - submodules: False 86 | - force: False 87 | - require: 88 | - pkg: zsh 89 | - pkg: git 90 | -------------------------------------------------------------------------------- /config/salt/tools/python.sls: -------------------------------------------------------------------------------- 1 | # Python is primarily used for our project provisioning 2 | 3 | python: 4 | pkg.installed: 5 | - name: python-dev 6 | 7 | python-mysqldb: 8 | pkg: 9 | - installed 10 | require: 11 | - pkg: python 12 | 13 | python-software-properties: 14 | pkg.installed -------------------------------------------------------------------------------- /config/salt/tools/ruby.sls: -------------------------------------------------------------------------------- 1 | # Ruby is primarily used for hub and rmate 2 | 3 | ruby: 4 | pkg.installed 5 | 6 | ruby-hub: 7 | cmd.run: 8 | - name: curl http://hub.github.com/standalone -sLo /usr/bin/hub && chmod +x /usr/bin/hub 9 | - unless: ls /usr/bin/hub 10 | require: 11 | - name: ruby 12 | 13 | ruby-rmate: 14 | gem.installed: 15 | - name: rmate 16 | 17 | ruby-compass: 18 | gem.installed: 19 | - name: compass -------------------------------------------------------------------------------- /config/salt/top.sls: -------------------------------------------------------------------------------- 1 | base: 2 | 3 | {% set states = salt['cp.list_states'](env) %} 4 | 5 | '*': 6 | - tools 7 | - config 8 | - nginx 9 | - php_fpm 10 | - postfix 11 | 12 | 'salty-wordpress': 13 | - vagrant 14 | - tools.ruby 15 | - tools.python 16 | - memcached 17 | - mysql 18 | - node 19 | 20 | {% if 'local' in states %} 21 | - local 22 | {% endif %} -------------------------------------------------------------------------------- /config/salt/vagrant.sls: -------------------------------------------------------------------------------- 1 | wordpress-develop: 2 | git.latest: 3 | - name: git://develop.git.wordpress.org/ 4 | - rev: master 5 | - target: /srv/www/wordpress-develop.dev 6 | - runas: vagrant 7 | - submodules: True 8 | - force: False 9 | - require: 10 | - pkg: git 11 | mysql_database.present: 12 | - name: wordpress_develop 13 | - require: 14 | - service: mysql 15 | - pkg: python-mysqldb 16 | cmd.run: 17 | - name: cd /srv/www/wordpress-develop.dev; wp core config --dbname=wordpress_develop --dbuser=root; wp core install --title="WordPress.org" --url=http://wordpress-develop.dev --admin_name=wordpress --admin_password=wordpress --admin_email=wordpress@wordpress.org 18 | - unless: cd /srv/www/wordpress-develop.dev; wp core is-installed 19 | - user: {{ grains['user'] }} 20 | - require: 21 | - cmd: wp_cli 22 | - git: git://develop.git.wordpress.org/ 23 | - mysql_database: wordpress_develop 24 | - service: mysql 25 | - pkg: php5-mysql 26 | 27 | wp-cli-tests-mysql: 28 | mysql_user.present: 29 | - name: wp_cli_test 30 | - password: password1 31 | - host: localhost 32 | - require: 33 | - service: mysql 34 | - pkg: python-mysqldb 35 | mysql_database.present: 36 | - name: wp_cli_test 37 | - require: 38 | - service: mysql 39 | - pkg: python-mysqldb 40 | mysql_grants.present: 41 | - grant: all privileges 42 | - database: wp_cli_test.* 43 | - user: wp_cli_test 44 | - require: 45 | - service: mysql 46 | - pkg: python-mysqldb 47 | 48 | 49 | php_phpunit: 50 | cmd.run: 51 | - name: wget https://phar.phpunit.de/phpunit-old.phar && chmod +x phpunit-old.phar && sudo mv phpunit-old.phar /usr/local/bin/phpunit 52 | - unless: which phpunit 53 | 54 | 55 | /var/log/php.log: 56 | file.symlink: 57 | - target: /srv/logs/php.log 58 | 59 | dnsmasq: 60 | pkg: 61 | - installed 62 | service.running: 63 | - name: dnsmasq 64 | - watch: 65 | - file: /etc/dnsmasq.conf 66 | file.managed: 67 | - name: /etc/dnsmasq.conf 68 | - contents: address=/.dev/192.168.50.10 69 | --------------------------------------------------------------------------------