Developing on Pantheon can be slow
Pantheon provides a convenient environment for developing and hosting WordPress and Drupal sites. For each Pantheon site, you are provided with a development, test and live (production) environment. The development environment offers a convenient method for testing code changes.
However, on first glance, deploying code changes to the development environment may seem terribly inconvenient. So much so, I imagine most developers set up a local development environment for developing on. Of course, this relegates Pantheon’s development environment to being a mere gateway for getting your code into the test and live environments.
The reason developing in Pantheon environment is inconvenient is because it uses SFTP and Git as the means to upload your code modifications to the development environment. That means, every time you make code modifications which you would like to test, you must save them in your IDE locally, then use an SFTP or Git client to upload your (likely small) changes to the development environment. Using Git for this seems out of the question, since it would mean a commit for each minor modification you make during development, but a conventional SFTP client would be to slow because every time you save your changes, you would have to switch to your SFTP client, select and upload the changed files, wait for the transmission to complete, then test the changes.
Luckily, there is a faster way.
SSHFS allows you to mount an SFTP site just like you would mount any other drive. You can install it using the following.
sudo apt-get install sshfs
Instruction for installing on Mac and Windows can be found at here.
Get you SFTP connection information by going to your development site’s Pantheon Dashboard and click on the Connection Info button.
Create a directory for the mount.
Now mount the SFTP site,
sshfs <user-name-from-dashboard>@<host-name-from-dashboard>: ~/mnt/dev-jesse-hogan.com -p
sshfs will request the SFTP password which is also obtainable from the Pantheon Dashboard.
If all goes well, you should be able to enter that mount directory and begin editing your source files.
$ sshfs <username>@<hostname>: ~/mnt/jesse-hogan.com/ -p 2222 <username>@<hostname>'s password: $ cd ~/mnt/jesse-hogan.com/ $ ls bin cache certs chef.stamp code files fusedav.conf htpasswd includes logs metadata.json mime.types nginx.conf php php-fpm.conf php.ini run stunnel tmp $ cd code $ ls index.php readme.html wp-activate.php wp-blog-header.php wp-config.php wp-content wp-includes wp-load.php wp-mail.php wp-signup.php xmlrpc.php license.txt README.md wp-admin wp-comments-post.php wp-config-sample.php wp-cron.php wp-links-opml.php wp-login.php wp-settings.php wp-trackback.php
As you can see above, when you first enter the mount, there are no WordPress file presented – only config files, logs for the web server’s environment. You must go into the
code/ directory to view the WordPress files (not sure about Drupal). From here, you can edit your WordPress themes and plugins as if you were on the development site itself.