{"id":17283611,"url":"https://github.com/choefele/swift-server-app","last_synced_at":"2025-09-19T17:38:45.890Z","repository":{"id":71496076,"uuid":"65842355","full_name":"choefele/swift-server-app","owner":"choefele","description":"Server app with Swift and Docker","archived":false,"fork":false,"pushed_at":"2017-08-22T16:35:55.000Z","size":191,"stargazers_count":20,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-14T10:13:30.860Z","etag":null,"topics":["docker","kitura","swift","swift-server"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/choefele.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-16T18:03:58.000Z","updated_at":"2023-12-17T05:07:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"59bed563-86f5-488f-a289-3de0d1934762","html_url":"https://github.com/choefele/swift-server-app","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/choefele/swift-server-app","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/choefele%2Fswift-server-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/choefele%2Fswift-server-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/choefele%2Fswift-server-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/choefele%2Fswift-server-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/choefele","download_url":"https://codeload.github.com/choefele/swift-server-app/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/choefele%2Fswift-server-app/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275976818,"owners_count":25563227,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-19T02:00:09.700Z","response_time":108,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","kitura","swift","swift-server"],"created_at":"2024-10-15T09:51:46.410Z","updated_at":"2025-09-19T17:38:45.850Z","avatar_url":"https://github.com/choefele.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\" \u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/choefele/swift-server-app/master/swift%2Bdocker.png\" alt=\"Swift + Docker\" title=\"Swift + Docker\"\u003e\n\u003c/p\u003e\n\n# Swift Server App\nTemplate to build a server app with Swift and Docker\n\n[![Build Status](https://travis-ci.org/choefele/swift-server-app.svg?branch=master)](https://travis-ci.org/choefele/swift-server-app)\n\n## Tools\n- Xcode\n - Download from [Xcode 8](https://developer.apple.com/download/)\n - Select Xcode 8 as default `sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer/`\n- `swiftenv` (optional since Swift built into Xcode 8 is the currently the latest version)\n - Install `swiftenv` via [Homebrew](https://swiftenv.fuller.li/en/latest/installation.html#via-homebrew)\n - `swiftenv rehash`, `swiftenv install \u003cversion\u003e` (see `.swift-version`)\n- Docker\n - Install from [Docker website](https://www.docker.com/products/overview)\n - Consider installing [Kitematic](https://www.docker.com/products/docker-kitematic) to simplify Docker management\n\n## Build \u0026 Run with Swift Package Manager\n- Run `swift build` in root folder, wait until dependencies have been downloaded and server has been built\n- Run dependent services `docker-compose -f docker-compose-dev.yml up`\n- Run server `./.build/debug/SwiftServer`\n- Test server by executing `curl http://localhost:8090/ping`\n- Test DB with `curl -X POST localhost:8090/items`, `curl http://localhost:8090/items`\n- Run unit tests with `swift test`\n\n## Build \u0026 Run with Xcode\n- Run `swift package fetch` in root folder to update dependencies\n- Generate Xcode project with `swift package generate-xcodeproj`\n- Run dependent services `docker-compose -f docker-compose-dev.yml up`\n- Open `SwiftServer.xcodeproj` in Xcode and Run `SwiftServer` scheme\n- Test server by executing `curl http://localhost:8090/ping`\n- Test DB with `curl -X POST localhost:8090/items`, `curl http://localhost:8090/items`\n- Run unit tests with CMD-U\n\n## Build \u0026 Run in Docker\n- Build image with `docker-compose -f docker-compose-ci.yml build`; tests a run as part of the build process\n- Run with `docker-compose -f docker-compose-ci.yml up [-d]` (stop: `docker-compose down [-v]`, logs: `docker-compose logs -f`)\n- Test server by executing `curl http://localhost:8090/ping`\n- Test DB with `curl -X POST localhost:8090/items`, `curl http://localhost:8090/items`\n\n### Connect `mongo` to database server\n- `docker-compose run --rm db mongo mongodb://db` to connect to database\n-- `use test`, `db.items.insert({})`, `db.items.find()` to create sample data\n- Restart db instance to see that data persists in volume container\n\n### Handle managed volumes\n- `docker inspect -f \"{{json .Mounts}}\" swiftserver_db_1` to find out mount point\n- `docker volume ls -f dangling=true` to find orphaned managed volumes\n- `docker volume rm $(docker volume ls -qf dangling=true)` to remove orphaned volumes\n\n### Provision on Digital Ocean\n- `docker-machine create --driver digitalocean --digitalocean-access-token \u003ctoken\u003e SwiftServer`\n- `eval \"$(docker-machine env SwiftServer)\"`, `eval \"$(docker-machine env -u)\"`\n- `docker-machine ssh SwiftServer` to ssh into new machine\n- Export/import ssh setup: `https://github.com/bhurlow/machine-share`\n- `docker compose -f docker-compose-prod.yml up` to start services\n\n## Integration tests\n- Install `newman` with `npm install newman --global`\n- Run `./run-integration-tests.sh`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchoefele%2Fswift-server-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchoefele%2Fswift-server-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchoefele%2Fswift-server-app/lists"}