Installing SyncServerII Server on an AWS EC2 Instance

This describes installing a server on AWS. If you can install the Swift compiler on it, you may be able to stand the server up on other hosts as well. Note that this is not the currently recommended way to install the server, but I include it for historical reference and in case someone finds it useful. The recommended way is via a Docker image. See the main documentation page.

  1. My process in this was very much a "roll your own" venture, starting from a fresh EC2 instance running Ubuntu 16.04.
  2. So you know the context, I had already gotten SyncServer running on Ubuntu on my local computer, and my need was to get it running on a remote server. The following takes place at the Ubuntu command line on the EC2 instance.
  3. First, download updated package lists
  4. sudo apt-get update
  5. Install Swift-related dependencies.
    1. See this for the rationale for these first two
    2. sudo apt-get install libpython2.7
      sudo apt-get install libcurl3
    3. Following the Linux installation instructions you need to do:
    4. sudo apt-get install clang libicu-dev
    5. Then, following this you need to do:
    6. sudo apt-get install uuid-dev
    7. Due to some complaints when building, I did:
    8. sudo apt-get install openssl libssl-dev
      sudo apt-get install libcurl4-openssl-dev
  6. Now we need to download and install Swift itself
  7. The following downloads Swift 3.1.1. You can, of course, update this to download a different Swift version.
    wget https://swift.org/builds/swift-3.1.1-release/ubuntu1604/swift-3.1.1-RELEASE/swift-3.1.1-RELEASE-ubuntu16.04.tar.gz
  8. Next, untar that baby:
  9. tar -xzf swift-3.1.1-RELEASE-ubuntu16.04.tar.gz
  10. I then moved it into my local "bin" directory:
  11. mkdir ~/bin
    mv swift-3.1.1-RELEASE-ubuntu16.04 ~/bin
  12. And I put Swift into my PATH by adding the following line to my .bashrc
  13. export PATH=~/bin/swift-3.1.1-RELEASE-ubuntu16.04/usr/bin:"${PATH}"
  14. Since SyncServer uses a mySQL database, I did a few extra steps:
  15. sudo apt-get install libmysqlclient-dev
  16. Setup your mySQL database.
  17. I did it using AWS RDS.
  18. There are then various steps you'll need to go through to create a user for your database, and create your specific schema's. I'll leave that to your inventiveness. :).
  19. Download SyncServer:
  20. git clone https://github.com/crspybits/SyncServerII.git
  21. SSL and SyncServer.
  22. You'll need to setup a Server.json configuration file.
  23. The structure of this file is implicit in the Constants.swift file on the server, but I need to document it!
  24. SyncServer has a run.sh script to build and start it up.