[Use Case] How to connect ephemeric application to Digital Ocean droplet

1 Ephemeric cloud managed runtime

Ephemeric cloud managed runtime allows you to map remote services like MongoDB to ephemeric instances which looks like the services run locally with the applications on the same host. It allows developer not to put any configuration to the application code but to use default local settings (as services will be mapped to the application at runtime).

The Ephemeric Cloud runtime environment uses stunnel to create secure tunnel between the application and the resources thus making the communication secure. It becomes possible to map any remote services using the managed runtime environment.

This article shows how to connect your Ephemeric Pharo Image to MongoDB service hosted as droplet at Digital Ocean.

Please consider that the approach described here is versatile and you can connect your applications to any service provider or your own dedicated servers. Digital Ocean is used in this article just as an example.

2 Digital ocean droplet configuration

First, let's run a Digital Ocean droplet with MongoDB and configure secure tunnel server side on it.

1. Run a MongoDB droplet. I used the version available as one-click installation option.

2. Follow the instruction to configure stunnel on the droplet:

2.1. Use the following /etc/stunnel/stunnel.conf file on the droplet to have a tunnel to MongoDB server:

client = no
[mongo]
accept = 27018
connect = 127.0.0.1:27017
cert = /etc/stunnel/stunnel.pem

3. Copy the certificate you created (stunnel.pem) to your local computer.

3 Configuration of an ephemeric application

1. Create a client side stunnel.conf

cert = stunnel.pem
client = yes
[squid]
accept = 127.0.0.1:27017
connect = [Droplet’s Public IP]:27018

2. Create zip-archive with a Pharo Image, stunnel.conf and the certificate (stunnel.pem which was copied from the droplet).

For instance, archive file lists can be as follows:

Pharo.image
stunnel.conf
stunnel.pem

3. Publish the archive to ephemeric cloud.

Related topics

  1. About Ephemeric cloud
  2. Managed runtime environment for web applications with Ephemeric Cloud
  3. Pharo Smalltalk development process with Ephemeric cloud
  4. How to publish Smalltalk Image from Pharo Workspace
  5. How to build a Pharo web application and publish it online with a bash script