Baker Cloud Console (CE) and REST API


Baker Cloud Console (CE) is an Open Source complement to Baker that extends the basic functionality of the framework with additions such as a full web based administration interface with database backend, REST API and more in order to support full functionality for Free and Paid Subscriptions and Issues.

Thanks for downloading Baker Cloud Console (CE)! 

Baker Cloud Console (CE) is a complete solution for enabling a robust server side backend to complement the Baker Framework.  For release 1.1, Baker Cloud Console (CE) will fully support all required features to enable both Paid In-App Purchases and Paid Subscriptions for the Baker 4.2 release.

This help documentation will walk you through setting up your Baker Cloud Console (CE) and API installation.

For reference, the following diagram depicts the components required for this implementation.  As you can see, there is an API layer that is used by the iOS Shelf application that acts as a broker to the backend database as well as the Apple Receipt Validation API.  The administration website is used to configure and maintain the data in the DB which is then consumed by the Shelf via the API.  Pretty straightforward!

Components

  1. Your branded Baker iOS Newsstand Application
  2. MySQL database
  3. Baker Cloud Console (CE) API layer
  4. Baker Cloud Console (CE) Administration Console

Prerequisites

You will need a hosting account that supports the following minimum requirements.

We will assume a pattern of using 2 multiple subdomains for setting up the two server based components.  You can set these up however you like, but we are only going to deal with this variation in the documentation for simplicity.

Please note that there are two separate frameworks being used by Baker Cloud Console (CE).  We are using both the amazing CodeIgniter Framework for the Administration Console as well as the Slim Framework for the API.  Both of these frameworks represent (in our opinion) the best frameworks for building upon.  There are active communities supporting both and they are easy to use and understand.  They are both based on PHP and coupled with the MYSQL database are a common platform that you can easily setup on most LAMP (Linux, Apache, MySQL, PHP) web hosting accounts.

While you might be able to get away with using a shared webhosting provider, we recommend using a VPS (Virtual Private Server).  If your Newsstand magazine is popular, you might soon find yourself in a bind with a shared hosting account.  We recommend Knownhost , WiredTree or Digital Ocean! Do check them out and use the links if you decide to sign up.  Yes we do get a tiny bit of affiliate earnings, but hey you didn't pay anything for Baker Cloud Console (CE)! :)

 

The first step in setting up Baker Cloud Console (CE) is to create an empty MySQL database.  This database will house the tables necessary for both the API and Cloud Console.  The steps required for setting up the database differ from web host to web host.  If you require help in setting up the database portion of this installation - your best bet is to contact your web host or view their help documentation on MySQL databases.

  1. Use your webhost's control panel to create a new MySQL database.
  2. Create a new database user that has FULL access to the MySQL database.
  3. Make note of the following items:  DB Name, DB Username, DB Password

For this documentation we are going to assume that our database information was setup as follows:

Database Name:  bakerc_cloudce

Username:  bakerc_ce

Password:  baker

At this point you should have a blank database with a username and password.  When you install the Baker Cloud Console (CE), it will automatically add the required database tables and sample data.

Installing the Baker Cloud Console (CE) should be fairly straightforward.  We've built an installer that executes as part of the setup that will connect to the database that you setup in the previous installation step and automatically create the necessary database tables as well as sample data...  You're welcome!

 

1.  Create a Subdomain (or folder location)

Create a subdomain on your webhosting account for whatever domain name you have or prefer.  You can also set this application up in a subfolder, however because of the way that CodeIgniter works, it might be simpler to use a subdomain.  Here we will use http://app.yourdomain.com

 

2.  DB Configuration Settings

You will need to edit the following file.  bakercloud-ce-console/source/application/config/database.php and modify the settings to match your configuration settings created in the MySQL Database Setup step.  In most cases you can use localhost for the hostname.  However we've seen some instances where the webhost requires something different to be setup.  If you run into issues with the hostname, double check with your webhost.  Example "mysqlinstance.myhost.com:3306" where a qualified hostname and port are required.

$db['default']['hostname'] = 'localhost';           // for pdo: mysql:host=localhost
$db['default']['username'] = 'bakerc_ce';           // DB Username
$db['default']['password'] = 'baker';               // DB Username Password
$db['default']['database'] = 'bakerc_cloudce';      // DB Name
$db['default']['dbdriver'] = 'mysqli';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;

3.  Copy the Source Files

Using a FTP client, copy the contents of the bakercloud-ce-console/source folder to the root of the subdomain or folder you created in Step 1.

 

4.  Run Baker Cloud Console (CE) Installer

After you've copied the Baker Cloud Console (CE) source files to your website, you will need to now run the installer.

Fire up a web browser and navigate to your Baker Cloud Console (CE) install.  Since we used http://app.yourdomain.com, let's pretend that is where we are headed to.  When you navigate to your install location, the following page should load provided you've done everything right up to this point.

 

Make sure that you make the Config Folder writable.  You can do this via your FTP program.  The installer will warn you and won't let you continue until this is correctly configured.  For the install to run, it generally seems that you need to give 777 flags to the folder.  You should be able to change this to 775 after the installation is complete.  Also, if your database credentials are not correct you may get another error - or the page might not even load.  So double check that as well.

If you've got everything correct, you should be able to hit Install Baker Cloud Console (CE) v1.1

If everything worked you will see the following page.

 

 

5.  Done!  Baker Cloud Console (CE) Login

If you get to the confirmation page, you can now login to Baker Cloud Console (CE) with the username and default password given.

Username:  user

Password:  123456

The login page will look like this.  You should be able to successfully log in.

 

6.  Dashboard View After Logging In

If everything is setup correctly, after logging in you should see the following Baker Cloud Console (CE) Dashboard page.