Skip to content

balazs630/Skate-Budapest-Vapor

Repository files navigation

API Template

Documentation Team Chat MIT License Continuous Integration Swift 5.2

Skate-Budapest Vapor Backend

Simple backend for Skate-Budapest iOS app using Swift with Vapor web framework.

Specification

Installation

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 postgresql@9.6

Start PostgreSQL service:

brew services start postgresql@9.6

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.

Deployment

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.

Uptime check

Using Uptime Robot with endpoint checks in every minute, see public status page.

Sends e-mail notification/SMS if the endpoints are down.

About

Backend for Skate-Budapest app with Server Side Swift

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published