Simple backend for Skate-Budapest iOS app using Swift with Vapor web framework.
- See the API Documentation (Swagger with ReDoc)
- Preview spec version for branch
[gh-pages]
Install Xcode 11.4 or greater from the Mac App Store. Vapor 4 requires Swift 5.2 or greater.
Install PostgreSQL and pgAdmin with Homebrew:
brew install --cask pgadmin4
brew install [email protected]
Start PostgreSQL service:
brew services start [email protected]
Create separate user and database for development
and testing
environments with pgAdmin. See dotenv configurations as an example.
Steps:
- create new server called
skate-budapest-local
- host: localhost
- port: 5432
- maintenance database: postgres
- username:
whoami
(check default user)
- create a new user for both environments (without password) and with
Login privileges
only - create a new database for both environments, set it's owner user
Grant privileges to the new user with pgAdmin:
- right click on the database >
Grant Wizard...
- select all tables
- set
grantee
: owner user,privileges
: all,grantor
: default user - do it on both environment
Execute seed data/migration sql scripts into the databases from the /Resources
folder.
Clone the project, then open Package.swift
in Xcode. It will download the dependencies and prepare the targets with Swift Package Manager.
If you're running the service from Xcode, make sure to add a custom working directory:
SkateBudapestVapor > Edit Scheme... > Run > Options > Use custom working directory > 'browse project root here...'
It's needed to load dotenv files properly.
See this guide how I managed to host the service on Ubuntu with Google Cloud on a Compute Engine instance.
Using Uptime Robot with endpoint checks in every minute, see public status page.
Sends e-mail notification/SMS if the endpoints are down.