All Projects → choefele → swift-server-app

choefele / swift-server-app

Licence: MIT license
Server app with Swift and Docker

Programming Languages

swift
15916 projects
shell
77523 projects

Projects that are alternatives of or similar to swift-server-app

Kitura-HelloWorld-iOS
A Hello World example of running Kitura on iOS
Stars: ✭ 55 (+205.56%)
Mutual labels:  kitura
kitura-cli
⌨️ Kitura command-line interface
Stars: ✭ 13 (-27.78%)
Mutual labels:  kitura
KituraKit
Swift client library for using Codable routes with Kitura
Stars: ✭ 58 (+222.22%)
Mutual labels:  kitura
MicroExpress
A micro web server framework on top of Swift NIO
Stars: ✭ 125 (+594.44%)
Mutual labels:  swift-server
swift-nio-redis
A high performance Redis protocol (RESP) implementation for SwiftNIO
Stars: ✭ 27 (+50%)
Mutual labels:  swift-server
now-swift-example
Example for use Kitura framework and swift lang with https://zeit.co/now.
Stars: ✭ 18 (+0%)
Mutual labels:  kitura
redi-s
A performant Redis server implemented in SwiftNIO.
Stars: ✭ 69 (+283.33%)
Mutual labels:  swift-server
swift-lambda-runtime
⚠️ Deprecated AWS Lambda Runtime - please use https://github.com/swift-server/swift-aws-lambda-runtime instead
Stars: ✭ 68 (+277.78%)
Mutual labels:  swift-server
Kitura-NIO
A networking library for Kitura, based on SwiftNIO
Stars: ✭ 35 (+94.44%)
Mutual labels:  kitura
Bytes
Swift Library for working with sequences of Bytes (aka [UInt8])
Stars: ✭ 35 (+94.44%)
Mutual labels:  swift-server
Swift-FFDB
a Object/Relational Mapping (ORM) support to iOS and MacOS .Since SwiftFFDB is build on top of FMDB.
Stars: ✭ 22 (+22.22%)
Mutual labels:  swift-server
Kitura
A Swift web framework and HTTP server.
Stars: ✭ 7,533 (+41750%)
Mutual labels:  kitura
Kitura-GraphQL
Swift GraphQL HTTP Middleware for Kitura
Stars: ✭ 28 (+55.56%)
Mutual labels:  kitura
Kitura-CouchDB
CouchDB adapter for Kitura
Stars: ✭ 50 (+177.78%)
Mutual labels:  kitura
Swift Log
A Logging API for Swift
Stars: ✭ 2,579 (+14227.78%)
Mutual labels:  swift-server
Swift Nio
Event-driven network application framework for high performance protocol servers & clients, non-blocking.
Stars: ✭ 6,777 (+37550%)
Mutual labels:  swift-server
vapor-queues-fluent-driver
A Fluent implementation for https://github.com/vapor/queues (Vapor4)
Stars: ✭ 17 (-5.56%)
Mutual labels:  swift-server
swift-extras-base64
Base64 encode and decode without the use of Foundation in pure Swift.
Stars: ✭ 65 (+261.11%)
Mutual labels:  swift-server

Swift + Docker

Swift Server App

Template to build a server app with Swift and Docker

Build Status

Tools

  • Xcode
  • Download from Xcode 8
  • Select Xcode 8 as default sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer/
  • swiftenv (optional since Swift built into Xcode 8 is the currently the latest version)
  • Install swiftenv via Homebrew
  • swiftenv rehash, swiftenv install <version> (see .swift-version)
  • Docker
  • Install from Docker website
  • Consider installing Kitematic to simplify Docker management

Build & Run with Swift Package Manager

  • Run swift build in root folder, wait until dependencies have been downloaded and server has been built
  • Run dependent services docker-compose -f docker-compose-dev.yml up
  • Run server ./.build/debug/SwiftServer
  • Test server by executing curl http://localhost:8090/ping
  • Test DB with curl -X POST localhost:8090/items, curl http://localhost:8090/items
  • Run unit tests with swift test

Build & Run with Xcode

  • Run swift package fetch in root folder to update dependencies
  • Generate Xcode project with swift package generate-xcodeproj
  • Run dependent services docker-compose -f docker-compose-dev.yml up
  • Open SwiftServer.xcodeproj in Xcode and Run SwiftServer scheme
  • Test server by executing curl http://localhost:8090/ping
  • Test DB with curl -X POST localhost:8090/items, curl http://localhost:8090/items
  • Run unit tests with CMD-U

Build & Run in Docker

  • Build image with docker-compose -f docker-compose-ci.yml build; tests a run as part of the build process
  • Run with docker-compose -f docker-compose-ci.yml up [-d] (stop: docker-compose down [-v], logs: docker-compose logs -f)
  • Test server by executing curl http://localhost:8090/ping
  • Test DB with curl -X POST localhost:8090/items, curl http://localhost:8090/items

Connect mongo to database server

  • docker-compose run --rm db mongo mongodb://db to connect to database -- use test, db.items.insert({}), db.items.find() to create sample data
  • Restart db instance to see that data persists in volume container

Handle managed volumes

  • docker inspect -f "{{json .Mounts}}" swiftserver_db_1 to find out mount point
  • docker volume ls -f dangling=true to find orphaned managed volumes
  • docker volume rm $(docker volume ls -qf dangling=true) to remove orphaned volumes

Provision on Digital Ocean

  • docker-machine create --driver digitalocean --digitalocean-access-token <token> SwiftServer
  • eval "$(docker-machine env SwiftServer)", eval "$(docker-machine env -u)"
  • docker-machine ssh SwiftServer to ssh into new machine
  • Export/import ssh setup: https://github.com/bhurlow/machine-share
  • docker compose -f docker-compose-prod.yml up to start services

Integration tests

  • Install newman with npm install newman --global
  • Run ./run-integration-tests.sh
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].