How to migrate local WordPress to Amazon Lightsail

Amazon LightSail + WordPress Deployment – The Definitive Guide

If you’re like me, you’re always looking for better, faster, web hosting and you don’t want to pay for expensive managed WordPress hosting like WP Engine and Siteground. So you’ve been considering Amazon Lightsail. Not too long ago I was in the same position and want to share my experience with moving a client’s local development project you’ve been working on to Lightsail.

Let’s get into it!

The following steps assume you’ve already signed up for an Amazon Lightsail account.
It also assumes you have experience manually moving a WordPress site from your localhost to a remote web host like GoDaddy, Hostgator, WPEngine, etc….
This means you should know how to export / import your database, connect with FTP to upload your files to the web host and everything else that goes along with setting up a WordPress website.

  • Step 1. – Create an InstanceAmazon Lightsail WordPress Migration - Step 1
    Amazon Lightsail WordPress Migration - Step 2Select the plan you want and give your instance a name. I usually use
    my domain name for easy reference but you can use whatever you want.
  • Step 2. – Create a static IP

    Click the Networking Link /Tab


    Click “Create Static IP”

    In this section you will select the instance you just created and attach the IP to the instance and you give your IP address a name: Again, I am choosing to use my domain name but this time I am using the full name with .com at the end.

    You could call it whatever you want but it’s easier if you keep instance name and the IP name coupled together.

  • Step 3 – Create SSH Keys & Download PEM File

    The PEM file contains the necessary security credentials to allow your computer to connect to Amazon’s servers. You are creating what is called an SSH-Tunnel. This will
    allow you access your database manager: PHPMYADMIN.In the upper right corner, click on account and then click “Create New”.

    Again, I would name your SSH Key Pair the same name as your domain name.

    After you click create, you can click the Download link. This will download your
    PEM file to your PC.

    Get your application’s password.

    Click the Connect using SSH button. This will launch a terminal in the browser window. At this point you’re using your server’s terminal.

    With the terminal window open, click the clipboard icon. With the clipboard window open, copy and paste this command into the window:

    cat bitnami_application_password

    Enter this command to disable the Bitnami banner on your wordpress site. 
    sudo /opt/bitnami/apps/wordpress/bnconfig –disable_banner 1

    After you have pasted this command into the window. Click the in the terminal window. This will close the clipboard area. Then RIGHT CLICK in the terminal window. This will paster the command in. Now press enter.

    Next you will see your application’s password. This password give you access to
    FTP, PHPMYADMIN and the WordPress Admin. In the terminal, highlight the password and click the clipboard icon. Now you have your application’s password.

  • Step 4 Connect to PHPMYADMIN

    In this step you’re going to create an SSH Tunnel and it’s going to require the use of a terminal (Mac) / command line (Windows). The step is going to require the use of the PEM file you downloaded. Open a terminal / command line and change directories to where your PEM file is. Then you enter this command: make sure you replace the colored text with the name of your pem file and the ip of your instance.
    ssh -N -L 8888:127.0.0.1:80 -i mydomain.pem bitnami@18.214.93.114
    Once you have entered this in the terminal and pressed enter you will notice nothing
    happens but your terminal / command line will look like the screenshot below.

    Even though it looks like nothing has happened, if you don’t see an error you’ve successfully created and SSH tunnel. Now leave the terminal window open and go to your browser window. In your browser window go to the following address:
    http://127.0.0.1:8888/phpmyadmin
    The user is: root and the password is your application password.
    At this point you should know what to do with PHPMYADMIN. The point of this post is how to connect to PHPMYADMIN so you can import your DB.

  • Step 5. Move your theme and plugins up to your instance via FTP.

    In your FTP client, use your server IP in the HOST field.
    You need to use SFTP. Username is bitnami. You will need to use your PEM file.
    Please see the screen shot below. I am using FileZilla but you can use another FTP client.

    After you’ve connected navigate to your instance’s WordPress install.

    If you have any trouble with permissions and transferring files via FTP, go back to your terminal (See step 3) and in following the copy – paste instractions, enter the following
    commands in the terminal:

    sudo chown -R bitnami:daemon /home3/athlon76/comfychair.biz/wp-content

    sudo chmod -R g+w /home3/athlon76/comfychair.biz/wp-content

    From this point you should be able to handle the rest. Again, the point of this article was to help you transfer your database and files to Amazon Lighsail and save you the frustration I went through getting this setup. Please feel free to email me with any questions you might have. Happy coding. boardley@gmail.com

P.S., If you are using contact forms or want to send any form from your site, you need this free plugin.

WP Mail SMTP

This plugin is easy to configure and works like a charm.

Local Drupal 8 development with PHP OPCache & without MAMP or XAMPP

Recently I’ve been contracted to develop a client site with Drupal 8. One thing I have found is the recommended ways to install Drupal are to use “one-click installers” from your web host or use tools like MAMP or XAMPP for local development.

But, what if you’re a minimalist like me and want to use the LAMP stack natively in OSX without those tools? Well, you can do it but there is an issue that I found while attempting to install Drupal 8 without these tools.

That roadblock was Zend OPCache.

I won’t go into all of the specifics of what OPcache is or does but suffice it to say, Drupal 8 Highly Recommends that you have it running in your PHP configuration.

After reading a bunch online, the solution seemed simple. Just edit your php.ini file and change the value from 0 to 1.

[opcache]
;Determines if Zend OPCache is enabled
opcache.enable=1

This seems easy enough. I opened a terminal, edited and saved the file. I restart Apache and refresh my info.php file in the browser. Nothing. No matter what I did, it wouldn’t work.

After trying a bunch of things, I noticed the date and timezone were different and I remembered I changed that info in a file called:
99-liip-developer.ini.

After some research, I found this version of PHP contains additional files that override parts of php.ini

If you look at the top of your info.php file and you see php-osx.liip.ch, you will be affected by this issue as well. After more digging I determined in order to enable Zend Opcache on a native PHP install that is using this version, you need to edit this file:

20-extension-opcache.ini. This is the file that loads Opcache extension for your local PHP installation and will allow you to install Drupal 8 without issues or warnings.

I am posting because it took me many hours to figure this out and I am hoping this will save someone else a great deal of time. Thanks for reading

Parallels: Show OSX Dock in Fullscreen Mode

Recently I’ve been spending a lot of time in Windows 7 via Parallels because Adobe’s Creative Cloud Apps run better on Windows than they do on OSX.  I know, blasphemy.  Anyway, I need to be in full-screen mode to utilize my dual monitors while in Windows but I also need to access  OSX’s Dock & Programs without exiting Parallels Full-Screen mode. So after playing around I figured out how to accomplish this and want to share it. The keyboard shortcuts are as follows:

  • Parallels Enter Full-screen Mode: CTL + COMMAND + F
  • Show OSX Doc while in Full-screen Mode: CTL + D + Alt/Option

The trick with this shortcut is you don’t press all three keys at once. You press and hold each key one after the other. So that’s it! I hope this was quick, to the point and helpful for you.

Tags: , , , ,

LESS in 4 Steps. (A designer’s guide)

Whether you’ve used CSS for years or just got a handle on CSS, you’re probably hearing talk about LESS, SASS, CSS pre-processors, mix-ins and wondering where and how to get started. If you’re like me, you learn by seeing it demonstrated versus reading a technical explanation of how it works.

Because of this, we’re going to skip all of the technical mumbo jumbo and dive in to creating CSS from LESS files. My belief is once you learn this critical piece, you will be able to learn all of the technical stuff as you go along. So let’s get to it!

  1. Download & install Koala.
    This is easy to use app creates CSS from your LESS files.
  2. Download example files and unzip them.
  3. Step 3. Launch Koala.
    easy-less-screen1
    You can either Drag & Drop the unzipped example files you downloaded onto the app which will add all of the files to the app or you can click the plus button in the upper left corner, browse to the downloaded files, select the less folder and CLICK UPLOAD(mac) or Ok(windows).
    easy-less-screen2
    You should now have 3 files listed in Koala: base.less, colors.less and style.less. If you’re on Windows you’ll see the path to the file and it will not show you the name of the actual file because the file path is soo long. Just know they are in the order listed above.
    easy-less-screen3
  4. CLICK on the last file listed. It will be style.less. When you click the file, a panel will slide out from the right.
    easy-less-screen
    Click COMPILE. You will see a SUCCESS message. You will also notice you now have a folder called css with a file in it called style.css. That’s it!

Final Thoughts. This is a whirlwind example to get you started. Take some time to explore with the above .less files. I placed comments in each one so you get a better sense of how.less works. If you enjoyed this post, please drop me a line.