MongoLab Can Now Be CloudControlled in Europe!

Greetings, adventurers!

MongoLab is now available through Berlin-based European PaaS provider, cloudControl as an add-on. We're very excited to expand our services to include cloud-hosted databases for EU-hosted applications. As a user of cloudControl, your apps are hosted in Amazon EC2 Dublin. MongoLab will host your databases there too. You can develop and deploy a MongoDB + PHP application in the EU more easily than ever. And good news: MongoLab complies with the EU-SafeHarbor frameworks.

In this blog, I'll walk you through getting started with cloudControl and MongoLab using CCTRL, the command line client for working with cloudControl applications. It integrates well with git, which makes pushing code and deploying your app a breezy task. In the process, you'll see how easy it is to use. You'll also get a taste of the MongoLab web UI for administering your database, which lets you work with your data in the lightweight JSON syntax that makes MongoDB so attractive. We'll go through three stages:

  • Create a cloudControl account
  • Prepare the application
  • Seed the database from the MongoLab web UI
If you're already familiar with cloudControl, or if this isn't your first PaaS rodeo, you may benefit from this documentation, also.

Create a cloudControl Account

The cloudControl onboarding process guides you through some very simple steps to get your app up and running, and even provides demo code to use in the process. Here, just use the web interface to just create your account, (i.e. without the creating the demo app.) I'll walk you through using CCTRL to set up your application in the next stage.
  1. Install the CCTRL command-line client using cloudControl's instructions here.
  2. Open a browser and head to

  3. Click Sign up now to reach the sign up page, as shown below.

  4. Enter your desired user name, your email, and select password. Then, agree to the TOS and click Register.
  5. Check your email and follow the activation link to log in. The cloudControl onboarding process begins with adding your SSH key.

    Paste the contents of your file into this form and click Add my SSH key.  Then, head back to your Terminal, shell or Cmd window to use the CCTRL client from here on out. If you need guidance on SSH Keys in general, check this out.

Prepare the Application

Now we'll use CCTRL to set up our application and add the MongoLab add-on. Then we'll draw on and deploy a MongoDB + PHP sample app I've prepared. Finally, we'll deploy that sample code to cloudControl and visit our new webpage.
  1. To confirm activation success of your account, enter the below.  You will be prompted for your email and password. Use the cloudControl account email and password you just established:
    > cctrluser key

    (The hash displayed is an ID for administering the stored key, should you need to in the future.)

  2. Now let's create the app using the cctrlapp create command. The syntax is cctrlapp <app_name> create <type>, where <app_name> is the name of the new app, and <type> is the type of application (which in this case is PHP). In the rest of the examples below, replace 'mymongolabtest' with your own app name.
    > cctrlapp mymongolabtest create php
    Git configuration found! Using "Git" as repository type.

    This command also creates the default deployment for your app, in the form <app_name>/default. Use the fully-qualified deployment name going forward.

  3. Add the MongoLab add-on. You want the 240MB free MongoLab plan for this demo, so:
    >cctrlapp mymongolabtest/default addon.add

    Adding the MongoLab add-on immediately provisions a MongoLab database and sets the MONGOLAB_URI config variable in your cloudControl credential's file. I'll detail that shortly.

  4. Obtain the MongoLab/cloudControl PHP sample code here by typing:
    > git clone
    Cloning into 'mongolab_cloudcontrol_sample'...
    remote: Counting objects: 6, done.
    remote: Compressing objects: 100% (5/5), done.
    remote: Total 6 (delta 0), reused 6 (delta 0)
    Unpacking objects: 100% (6/6), done.

    (if you need to install git click here).

    Once the git clone is complete, navigate to the cloned repository.

    > cd mongolab_cloudcontrol_sample
  5. Take a look at index.php. You'll note two features:

    Credential File Access Code
    - CloudControl makes add-on provider configurations available in their CRED_FILE environment variable. We access the MONGOLAB_URI in CRED_FILE to get the MongoDB connection string populated by MongoLab.

    $credfile = file_get_contents($_ENV['CRED_FILE'], false);
    $credentials = json_decode($credfile, true);
    $uri = $credentials["MONGOLAB"]["MONGOLAB_URI"];

    The MONGOLAB_URI is of the form mongodb://<user>:<password>@<host>:<port>/<dbname>.

    Database Connection and Query Code - We use the URI we obtained to connect to and query the "cloudcontrolled" collection in our MongoDB database, and display all of the documents we find. Note that because we want to be as deft as possible, we're parsing the db name from the end of the URI.

    $dbname = substr($uri, strrpos($uri, "/")+1)
    $m = new Mongo($uri);
    $db = $m->selectDB($dbname);
    $col = new MongoCollection($db, "cloudcontrolled");
    $cursor = $col->find();
    foreach ($cursor as $doc) {
        echo json_encode($doc);
        echo "</br>";
  6. This small bit of code is all you need to get started. Let's push it! The command is: cctrlapp <app_name>/default push. So, without changing directories:
    > cctrlapp mymongolabtest/default push
    Counting objects: 6, done.
    Delta compression using up to 8 threads.
    Compressing objects: 100% (5/5), done.
    Writing objects: 100% (6/6), 1.48 KiB, done.
    Total 6 (delta 0), reused 0 (delta 0)
    >> Receiving push
    >> Compiling PHP
    >> Building image
    >> Uploading image (4.0K)
    To ssh://
    * [new branch] master -> master
  7. When CCTRL is run from a git repository directory, it automatically picks up your code.
  8. Next, we deploy our app with the command: cctrlapp <app_name>/default deploy.
    > cctrlapp mymongolabtest/default deploy
  9. Within a a moment, your deployment will complete and your app will be available on the internet at <app_name>

Seed the Database

This is a rather empty page though. Wasn't the code getting documents out of a collection? Ah! Since our MongoLab database is brand-new, we need to add some data! The MongoLab web UI is a great place to drop a few seed documents, and it's available through SSO (single-sign-on) on your cloudControl console.

  1. Head to and log in. You'll start with a menu:
  2. The cloudControl console is still in alpha, so mind the continual improvements and click Applications -> <app_name> to reach your application landing page. Then in the Deployments section, select your default deployment <app_name>/default. Take a moment to familiarize yourself with the page and then click Add-Ons.
  3. Click Login next to your add-on, bypassing any pop-up blocking you have set up, and you will be redirected to the MongoLab web UI!

    The MongoLab Web UI is a lightweight JSON document editor and database management tool. Remember from the sample code above that you're selecting from the "cloudcontrolled" collection.
  4. Since there isn't a "cloudcontrolled" collection, click Add next to the Collections heading to create one.
  5. Now, click on your new collection in the Collections list to view it.
  6. Click Add next to the Documents heading to create one. You can copy and paste some JSON into this editor, or enter it yourself. MongoLab uses strict JSON, so be sure to quote your key names.
  7. When you're finished with your doc, click Save and go back to return to the collection page. Add a few more if you are so inclined.
  8. Now, refresh your app page and you should see the new documents printed below "Hello World"

There you have it. Now you're free to drop some of your own code to build out your MongoDB application while using the MongoLab web UI to help add initial data to your database. cloudControl and MongoLab hope you enjoy our services! As always, if you have any questions about this blog, or if something doesn't work the way you'd expect, email us at We'll be happy to assist.

Keep your wits about you, and remember, the world still  needs adventurers.


36 Responses to MongoLab Can Now Be CloudControlled in Europe!

  1. is motor club america scam 04/01/2017 at 9:10 am #

    302726 332685Nice read, I just passed this onto a friend who was doing some research on that. And he just bought me lunch as I found it for him smile Therefore let me rephrase that: Thank you for lunch! 323184

  2. Best Best Online News 04/06/2017 at 12:30 pm #

    767802 729647You ought to experience a contest personally with the finest blogs on-line. Im going to suggest this page! 976228

  3. Best News Website in World 04/06/2017 at 3:54 pm #

    213836 931409have to do initial? Most entrepreneurs are so overwhelmed with their online business plans that 773536

  4. Best Best Online News in the World 04/06/2017 at 5:26 pm #

    807051 373469An incredibly interesting examine, I may possibly not concur entirely, but you do make some very valid points. 409581

  5. Best Best Online News in the World 04/07/2017 at 9:14 am #

    437964 878447Youre the very best, Its posts like this that keep me coming back and checking this website regularly, thanks for the info! 603

  6. Best Best Online News in the World 04/07/2017 at 4:38 pm #

    872720 780778I respect your piece of function, appreciate it for all of the intriguing content material . 434150

  7. Best Best Online News in the World 04/07/2017 at 10:17 pm #

    946251 188415Do you wear boxers or biefs? I wana bui em. 755535

  8. Best Best Online News in the World 04/08/2017 at 12:56 am #

    279441 599656Im positive your publish and internet web site is extremely constructed 591511

  9. GVK BIO 04/08/2017 at 11:12 am #

    282409 190934I want reading by way of and I conceive this internet site got some genuinely utilitarian stuff on it! . 273402

  10. Best Best Online News in the World 04/08/2017 at 2:16 pm #

    449498 660418Glad to be one of numerous visitants on this awful web website : D. 540119

  11. Best Best Online News in the World 04/08/2017 at 5:18 pm #

    441655 486670Hiya! Great blog! I happen to be a every day visitor to your website (somewhat much more like addict ) of this web site. Just wanted to say I appreciate your blogs and am searching forward for much more to come! 537959

  12. UK Chat Rooms 04/08/2017 at 8:33 pm #

    280260 425948Sorry for the huge review, but Im actually loving the new Zune, and hope this, as properly as the superb reviews some other folks have written, will aid you decide if it is the correct choice for you. 769120

  13. GVK Biosciences 04/09/2017 at 4:17 am #

    475660 734565The the next time I just read a blog, I really hope that this doesnt disappoint me approximately brussels. Get real, Yes, it was my option to read, but I really thought youd have some thing intriguing to say. All I hear is usually a couple of whining about something that you could fix when you werent too busy searching for attention. 278032

  14. 800613 622066As I internet web site possessor I believe the content material matter here is rattling magnificent , appreciate it for your hard function. You ought to maintain it up forever! Finest of luck. 251791

  15. Switch Energy Supplier 04/21/2017 at 1:00 am #

    995770 431890I was trying to locate this. Actually refreshing take on the details. Thanks a whole lot. 667683

  16. VaporSOUL 04/30/2017 at 7:02 pm #

    133331 450415Music began playing anytime I opened this web site, so irritating! 768032

  17. 161283 150791If running proves to be a dilemma then it could be wise to uncover alternative exercises such as circuit training, weight training, swimming or cycling. 295356

  18. KelEncono 06/24/2017 at 4:44 pm #

    Online Paharmcy Canada No Perscription Prices Kamagra Tuenti Con Propecia

  19. KelEncono 06/28/2017 at 10:46 am #

    Priligy Eczanelerde online pharmacy Cytotec 200 Posologie

  20. KelEncono 07/01/2017 at 6:31 am #

    Canada Pharmacy Viagra Overnight viagra Achat Viagra Pour Homme

  21. KelEncono 07/06/2017 at 2:14 pm #

    Viagra 50mg Sale cialis Prilosec

  22. ChasFuetty 07/07/2017 at 4:43 am #

    Amoxil Tablette cialis price Where To Buy Kamagra Oral Jelly

  23. KennUttede 07/07/2017 at 4:47 am #

    Medicare Part D And Cialis viagra Tadacip 20 India

  24. KelEncono 07/10/2017 at 5:45 am #

    Cialis In Gelsenkirchen cialis price Cialis Dosage Directions

  25. ChasFuetty 07/11/2017 at 11:15 am #

    Kamagra Online Thailand viagra online Viagra Ohne Rezept Apotheke Kaufen

  26. KennUttede 07/11/2017 at 2:21 pm #

    Finasteride Versus Propecia viagra cialis Acheter Du Viagra Gratuit

  27. KelEncono 07/16/2017 at 3:00 pm #

    Cialis Tadalafil 20mg Lilly viagra cialis Cheap Ed Meds Uk

  28. ChasFuetty 07/17/2017 at 4:16 am #

    Viagra Generika Wirkung viagra cialis Buy Lasix 40 Mg

  29. KennUttede 07/17/2017 at 4:44 am #

    Buy Celebrex 200 Mg cialis Generic Tadalafil

  30. ChasFuetty 07/31/2017 at 3:19 am #

    Viagra Et Performance cialis Le Viagra Ordonnance

  31. KelEncono 07/31/2017 at 7:46 am #

    Tretinoin Cream U.S.P viagra Cialis Generique France

  32. casino 08/26/2017 at 8:02 am #

    play dragon baccarat online
    real money casino facebook

  33. levitra 20 mg 09/01/2017 at 8:10 pm #

    buy cialis levitra viagra
    levitra 20 mg
    cialis viagra levitra sale

  34. generic viagra 09/06/2017 at 3:23 am #

    buy viagra online
    generic viagra
    viagra buy in singapore

  35. generic viagra trusted pharmacy 09/13/2017 at 7:51 am #

    how to buy viagra online in the uk
    generic viagra trusted pharmacy
    buy viagra goa

  36. buy cialis pakistan 09/21/2017 at 4:33 am #

    buy cialis online usa
    splitting cialis pills
    order cialis from india
    buy cialis online mastercard
    buy cialis online with american express
    buy cialis in canada
    buy cialis online australia
    can i buy cialis over the counter in canada
    buy cialis delhi

Leave a Reply