Deploying Server Side Swift to Digital Ocean

The third in my “Deploying Server Side Swift” series, now I’m going to demonstrate deploying a Server Side Swift app to Digital Ocean Droplet.

There are three prerequisites if you want to follow along: the Perfect Assistant application, a working Docker application on your Mac, and a Digital Ocean account.

Server Setup

The first step is going to be setting up a new Digital Ocean Droplet.

In your Digital Ocean console, Click the “Create Droplet” button. Select the Ubuntu 16.0.2.x64 distribution, the size you need, the datacenter location, and any other specific options you will need.

You’re returned to the list of your Droplets, with the new one listed. Once it’s created, you’ll see the IP address. Copy this, and in Terminal enter

ssh root@<ip address>

Your root password would have arrived in your email, use this to log in. You’ll be immediately asked to change your password — this is a security feature and means that only you now know the password.

Now we want to get Swift and all the right dependencies installed.

Go to and copy the contents of ‘’

Next, create the install file and edit it:

nano -w

Paste the contents fo the clipboard, then press ctrl-x and enter to save.

Then we want to make it executable and run it:

chmod +x
./ --sure

When this is finished, your system will be ready to go for Swift and Perfect!

Compiling the code

If you’ve followed the previous installment in my Server Side Swift Deployment series, you may notice the next sections are virtually identical. That’s because they are…

Switching now to the Perfect Assistant, lets grab the “Perfect App Template” from GitHub. On the Welcome screen, click on “Create New Project”, the “Custom Repository URL”. Find a home for your project by clicking “Browse” next to the location, and then paste in the URL for the template: “"

Leave the “Integrate Linux builds with Xcode project” checked, as we are targeting Linux deployment in this phase.

Once you click “Save” the system will start it’s initial clone of the project for the macOS side.

Doing a Linux build is as simple as clicking the “BUILD: Linux” button. What this is doing behind the scenes is getting a Docker container ready, cloning the project’s dependencies into a sandboxed location, and doing a Linux build that is sandboxed as well.

Once it’s finished, you should see the last 3 lines as something like:

Compile Swift Module ‘Perfect_App_Template’ (10 sources)
Linking ./.build_lin/release/Perfect-App-Template

This shows you the location of the executable we just built. Using the Assistant to open our project directory, open the .build_linux/releasedirectory. This is made much easier if you have enabled the view of hidden files in the Finder.

There are a lot of files in here, most of which we can ignore.


Open your favourite SFTP app… I personally like and use Transmit.

Open a new SFTP configuration, and enter the IP address of your new Droplet, as well as the username (root) and password, then connect.

Once Transmit has connected, go to the root of the disk, and create a new directory called “perfect-deployed”. Inside that make a directory for our app, “Perfect-App-Deployed”.

Copy into this new directory the following files:

Go up a couple of levels in the Finder, and copy into the app dir in SFTP the config and webfoot directories.

Create a new file called “perfect-app-template.service”, and copy the code from

Description=Perfect deployed perfect-app-template

Now you have all the pieces in place, lets start it up!

Back in the console session in Terminal, execute the following two commands to enable the service, and reload the services controller:

systemctl enable /perfect-deployed/Perfect-App-Template/perfect-app-template.service 
systemctl daemon-reload

Now, start the app!

service perfect-app-template start

Now, back in the browser, hit http://(youripaddress):8104/ and you should see “Hello, World!”

Next Steps

For examples visit — there is an ever growing library of examples and demos there.

And of course if you’re looking for live help from our awesome community, join our Slack channel via

Thanks for being with us today, don’t forget to say Hi on Slack!

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.