AuthorCarl

Why developers love Sylius E-commerce

Before we tell the world how much we love using Sylius, first off we should explain what exactly Sylius is.

sylius

Sylius

Sylius is an e-commerce platform built using the Symfony 2 framework.  It is still in it’s early days and as such it is not as feature rich as some other e-commerce platforms such as Magento, however it is getting there and does already have most of the features you would expect from an online shop.

Why we love it and you should too

Sylius is built on top of Symfony 2 and as such it is built in a much better decoupled way that other e-commerce platforms.  This makes development much more enjoyable and it allows you to easily plug in any number of thousands of Symfony 2 bundles into your project (as Sylius has already done).  As you can imagine this can speed up development time a lot.

Also Sylius has been built using BDD / TDD methodologies.  This make it great to learn from a developers perspective and it allows for faster development through automated tests.  As uncle bob says “The only way to go fast is to go well”.

With Sylius being so young, it is at a great point in its development to make some contributions.  Here and here are a couple I have made myself.  Easy once you are involved and enjoyable.  There is also plenty to get involved in with regards to new features.  Simply find the repository and get involved.

Sylius is also being used in production environments already.  One such project we have built using the framework is PrecisionCodeWorks, an e-commerce store for purchasing ECU tuning file credits.

Out of the box Sylius is also quick to setup.  If you compare it to the amounts of XML for example within Magento, it is much faster to get up and running.

 

 

WordPress Server Migrations

We often find ourselves setting up WordPress infrastructures and so I thought it would make a good article to discuss some of the processes we often go through in order to either setup a server or migrate an existing WordPress website.

migrations

WordPress Database Migration (MySQL)

There are many ways to get your data from one WordPress instance to another, however when we are migrating a WordPress install, we prefer the following.

We always access Linux servers via SSH.  This gives us access to the MySQL terminal client.  In order to get a database dump of the current website, we usually use a command such as the following, which create a database dump which we can use later on:

mysqldump -u liverpool -p liverpool wordpressdb > wordpressdb.sql

The above command will create a file containing the database dump of the “wordpressdb” database within MysQL.  The basics of the command are:

  1. mysqldump – command used to output a text SQL database dump.
  2. “u” flag – to specify your database username.  Some MySQL users may not have access to all databases so be sure you use the correct user.  Looking at the wp-config.php file within WordPress should reveal the MySQL user which you can use for this.
  3. “p” flag – to specify the password.  This is the password for the MySQL user.  It is good practice to not actually specify the password itself in the terminal (e.g. just type -p without the password).  This is because if you specify the password within the command, the other users may also be able to see the password within the BASH history (by typing “history”).  Leave the “p” blank will force the MySQL terminal client to prompt for the password and so it will not be saved in the bash history.
  4. “wordpressdb” – This is the database name within MySQL.   This can also be found within the wp-config.php file in the root of your WordPress install.
  5. “> wordpressdb.sql” – The chevron tells BASH to send the output of the mysqldump command to a file named wordpressdb.sql.  This file can be called anything you like.

One you have produced a MySQL dump for your WordPress website, depending on it’s size you may wish to compress it as we will be sending it over the internet to either your client machine or direct to the new server you are setting up.  To do this you could use a command such as the following:

gzip wordpressdb.sql

This will compress the file producing a file named wordpressdb.sql.gz .

Now we need to copy our file to our new server.  In order to do this we can use the “scp” command within BASH as long as you have SSH access to your new server also.

scp wordpressdb.sql.gz carl@123.44.55.66:~/

This command will send you file “wordpressdb.sql.gz” to your other server/environment specified by the user “carl” and the ip address “123.44.55.66”, in to the home directory of the “carl” user.

Once here we can then ssh into our second environment and import the database dump.  In order to do this we must first create an empty database to import our dump into:

mysql -u merseyside -p merseyside -e “create database wordpressdb”

Similar to the previous mysql command except this time we use the “-e” flag and specify some SQL to run.  In this case the SQL is simply to create a black database.

Now we can import our database dump into the database of our second server:

zcat wordpressdb.sql.gz | mysql -u merseyside -p merseyside  wordpressdb

The above command will output the wordpressdb.sql.gz file contents and we then “pipe” this output as input to the MySQL command.  Again this is similar to the previous MySQL commands.

At this point we have our database setup and if we have our wp-config.php file configured and in place, WordPress will use this database, however if you are changing domain name (or subdomain) you may also need to run some SQL to update all of the permalinks.  In order to do this you will need to login to MySQL via your terminal client and run some SQL.

use wordpressdb;
UPDATE wp_options SET option_value = replace(option_value, 'http://localhost:8888/', 'http://somesite.local/') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://localhost:8888/', 'http://somesite.local/');
UPDATE wp_posts SET post_content = replace(post_content, 'http://localhost:8888/', 'http://somesite.local/');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://localhost:8888/', 'http://somesite.local/');

 

The above SQL will search through all the WordPress posts etc and replace the old website links with your new links.  So for example the above will replace “http://localhost:8888/” with “http://somesite.local/” (or in other words old URL to new URL).  After doing this WordPress should now work as expected.  You can reference this SQL here.

WordPress Assets Migration

Again there are may ways to migrate your assets from one server to another, however the following is often how we do it.

scp -r wp-content/uploads merseyside@123.44.55.66:~/wordpress/wp-content/

Similar to how we copied the MySQL database dump from one server to another, we can also copy the assets in a similar fashion.  The “-r” flasg simly means to recursively copy files (all files and sub directories etc).

Conclusion

In conclusion, if you are familiar with SSH, BASH and MySQL this process should be very simple to replicate.  If however you are a non-techie, this article should help explain the processes involved.  If you feel you may need help with such a task, then please get in touch.  We are happy to help.