From 97d9d394f6c10623874ce106c87fe3b7862bba11 Mon Sep 17 00:00:00 2001 From: Paul Schmiedmayer Date: Tue, 24 Aug 2021 14:19:21 +0200 Subject: [PATCH] Update to Apodini 0.4.0, Make REUSE compliant (#1) --- .github/pull_request_template.md | 22 +- .github/release-drafter.yml | 20 +- .github/workflows/build-and-test.yml | 53 +- .github/workflows/docker-compose.yml | 8 + .github/workflows/docker.yml | 14 +- .github/workflows/release-drafter.yml | 10 +- .github/workflows/release.yml | 10 +- .github/workflows/reuseaction.yml | 22 + .github/workflows/spm-update.yml | 48 ++ .github/workflows/swiftlint.yml | 17 +- .gitignore | 23 +- .swiftlint.yml | 54 +- CONTRIBUTORS.md | 15 + .../Example.xcodeproj/project.pbxproj.license | 6 + .../swiftpm/Package.resolved.license | 6 + .../xcschemes/Example.xcscheme.license | 6 + Client/Example/ExampleApp.swift | 8 + Client/Example/Views/ConnectView.swift | 11 +- Client/Example/Views/ContentView.swift | 8 + Client/Example/Views/ErrorView.swift | 11 +- Client/Example/Views/LoadingView.swift | 8 + Client/ExampleUITests/ExampleUITests.swift | 8 + Database/.dockerignore | 8 + .../contents.xcworkspacedata | 7 - .../xcschemes/DatabaseWebService.xcscheme | 88 ---- Database/Dockerfile | 12 +- Database/Package.resolved | 466 +++++++++++++++++ Database/Package.resolved.license | 6 + Database/Package.swift | 24 +- .../DatabaseWebService.swift | 11 +- .../URL+ExpressibleByArgument.swift | 8 + .../Handler/CreateUserLocationHandler.swift | 8 + .../Handler/ReadUserLocationHandler.swift | 8 + .../DatabaseWebService/Model/Coordinate.swift | 10 +- .../Model/DatabaseService.swift | 11 +- .../Model/UserLocationModel.swift | 14 +- .../DatabaseWebServiceTests/AppTests.swift | 8 + Database/prometheus-development.yml | 8 + Database/prometheus.yml | 8 + Example.xcworkspace/contents.xcworkspacedata | 3 - .../contents.xcworkspacedata.license | 6 + .../IDEWorkspaceChecks.plist.license | 6 + .../xcshareddata/swiftpm/Package.resolved | 475 ++++++++++++++++++ .../swiftpm/Package.resolved.license | 6 + Gateway/.dockerignore | 8 + .../contents.xcworkspacedata | 7 - .../xcschemes/GatewayWebService.xcscheme | 88 ---- Gateway/Dockerfile | 12 +- Gateway/Package.resolved | 439 ++++++++++++++++ Gateway/Package.resolved.license | 6 + Gateway/Package.swift | 20 +- .../ConnectionService/Coordinate.swift | 8 + .../RemoteConnectionService.swift | 10 +- .../Extensions/EventLoopFuture+Combine.swift | 8 + .../URL+ExpressibleByArgument.swift | 8 + .../GatewayWebService/GatewayWebService.swift | 8 + .../Handler/CreateUserLocationHandler.swift | 8 + .../Handler/ReadHotsportsHandler.swift | 8 + .../GatewayWebService/Jobs/MetricsJob.swift | 8 + .../MetricsService/Analyst+Extensions.swift | 8 + .../GatewayPresenterService.swift | 160 +++--- .../GatewayWebServiceTests/AppTests.swift | 8 + Gateway/prometheus-development.yml | 8 + Gateway/prometheus.yml | 8 + LICENSE => LICENSES/MIT.txt | 2 +- Processing/.dockerignore | 8 + .../contents.xcworkspacedata | 7 - .../xcschemes/ProcessingWebService.xcscheme | 88 ---- Processing/Dockerfile | 14 +- Processing/Package.resolved | 448 +++++++++++++++++ Processing/Package.resolved.license | 6 + Processing/Package.swift | 20 +- .../DatabaseService/Coordinate.swift | 10 +- .../RemoteDatabaseService.swift | 10 +- .../URL+ExpressibleByArgument.swift | 8 + .../Handler/ReadHotsportsHandler.swift | 8 + .../Processing/DefaultProcessingService.swift | 15 +- .../ProcessingWebService.swift | 8 + .../ProcessingWebServiceTests/AppTests.swift | 8 + Processing/prometheus-development.yml | 8 + Processing/prometheus.yml | 8 + README.md | 10 + docker-compose-development.yml | 8 + docker-compose-locally.yml | 8 + docker-compose.yml | 8 + 85 files changed, 2673 insertions(+), 464 deletions(-) create mode 100644 .github/workflows/reuseaction.yml create mode 100644 .github/workflows/spm-update.yml create mode 100644 CONTRIBUTORS.md create mode 100644 Client/Example.xcodeproj/project.pbxproj.license create mode 100644 Client/Example.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved.license create mode 100644 Client/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme.license delete mode 100644 Database/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata delete mode 100644 Database/.swiftpm/xcode/xcshareddata/xcschemes/DatabaseWebService.xcscheme create mode 100644 Database/Package.resolved create mode 100644 Database/Package.resolved.license create mode 100644 Example.xcworkspace/contents.xcworkspacedata.license create mode 100644 Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist.license create mode 100644 Example.xcworkspace/xcshareddata/swiftpm/Package.resolved create mode 100644 Example.xcworkspace/xcshareddata/swiftpm/Package.resolved.license delete mode 100644 Gateway/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata delete mode 100644 Gateway/.swiftpm/xcode/xcshareddata/xcschemes/GatewayWebService.xcscheme create mode 100644 Gateway/Package.resolved create mode 100644 Gateway/Package.resolved.license rename LICENSE => LICENSES/MIT.txt (92%) delete mode 100644 Processing/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata delete mode 100644 Processing/.swiftpm/xcode/xcshareddata/xcschemes/ProcessingWebService.xcscheme create mode 100644 Processing/Package.resolved create mode 100644 Processing/Package.resolved.license diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 7fe840d..d06b6da 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,16 +1,24 @@ + + # *Name of the PR* -## :recycle: Current situation +## :recycle: Current situation & Problem *Describe the current situation (if possible with and exemplary (or real) code snippet and/or where this is used)* ## :bulb: Proposed solution -*Describe the solution (if possible with and exemplary (or real) code snippet)* - -### Problem that is solved -*Provide a description and link issues that are solved* +*Describe the solution and how this affects the project and internal structure* -### Implications -*Describe the implications, e.g. refactoring* +## :gear: Release Notes +*Add a short summary of the feature as well as possible migration guides if this is a breaking change so this section can be added to the release notes.* +*Include code snippets that provide examples of the feature implemented if it appends or changes the public interface.* ## :heavy_plus_sign: Additional Information *Provide some additional information if possible* diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index b20e968..584687a 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,20 +1,30 @@ +# +# This source file is part of the Collector-Analyst-Presenter Example open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + branches: [release] name-template: '$NEXT_PATCH_VERSION' tag-template: '$NEXT_PATCH_VERSION' categories: - - title: '🚀 Features' + - title: 'Semantic Version Major' + labels: + - 'needs version bump' + - title: 'Semantic Version Minor' labels: - 'feature' - 'enhancement' - - title: '🐛 Bug Fixes' + - title: 'Other Changes' labels: - 'fix' - 'bugfix' - 'bug' - - title: '🧰 Maintenance' - label: 'chore' + - 'documentation' change-template: '- $TITLE @$AUTHOR (#$NUMBER)' template: | ## Changes - $CHANGES + $CHANGES \ No newline at end of file diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 7f82223..3b9807f 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -1,3 +1,11 @@ +# +# This source file is part of the Collector-Analyst-Presenter Example open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + name: Build and Test on: @@ -7,14 +15,12 @@ on: pull_request: branches: - develop + workflow_dispatch: jobs: macosclient: name: macOS Client runs-on: macos-11 - defaults: - run: - working-directory: ./Client steps: - uses: actions/checkout@v2 - uses: maxim-lobanov/setup-xcode@v1.1 @@ -27,34 +33,46 @@ jobs: - name: Build and test run: xcodebuild test -scheme Example -destination 'platform=iOS Simulator,OS=15.0,name=iPhone 12' macoswebservices: - name: macOS ${{ matrix.webservice }} + name: macOS ${{ matrix.webservice }} ${{ matrix.configuration }} runs-on: macos-11 strategy: + fail-fast: false matrix: webservice: [Gateway, Database, Processing] + configuration: [debug, release] defaults: run: working-directory: ./${{ matrix.webservice }} steps: - uses: actions/checkout@v2 - - uses: maxim-lobanov/setup-xcode@v1.1 + - uses: maxim-lobanov/setup-xcode@v1.2.3 with: xcode-version: latest + - uses: actions/cache@v2 + with: + path: .build + key: ${{ runner.os }}-${{ matrix.webservice }}-spm-${{ hashFiles('**/Package.resolved') }} - name: Check Xcode version run: xcodebuild -version - name: Check Swift version run: swift --version - - name: Build and test - run: swift test + - name: Release Build + if: matrix.configuration == 'release' + run: swift build -c release + - name: Debug Build + if: matrix.configuration == 'debug' + run: swift build -c debug linuxwebservices: - name: Linux ${{ matrix.webservice }} ${{ matrix.linux }} + name: Linux ${{ matrix.webservice }} ${{ matrix.linux }} ${{ matrix.configuration }} runs-on: ubuntu-latest container: - image: swift:${{ matrix.linux }} + image: swiftlang/swift:nightly-5.5-${{ matrix.linux }} strategy: + fail-fast: false matrix: webservice: [Gateway, Database, Processing] - linux: [latest, focal, amazonlinux2, centos8] + linux: [bionic, focal, amazonlinux2, centos8] + configuration: [debug, release, release_testing] defaults: run: working-directory: ./${{ matrix.webservice }} @@ -69,7 +87,18 @@ jobs: - name: Install libsqlite3 if: startsWith( matrix.linux, 'centos' ) run: yum update -y --nobest && yum install -y sqlite-devel + - uses: actions/cache@v2 + with: + path: .build + key: ${{ runner.os }}-${{matrix.linux}}-${{ matrix.webservice }}-spm-${{ hashFiles('Package.resolved') }} - name: Check Swift version run: swift --version - - name: Build and test - run: swift test + - name: Release Build + if: matrix.configuration == 'release' + run: swift build -c release + - name: Release Build & Test + if: matrix.configuration == 'release_testing' + run: swift test -c release -Xswiftc -enable-testing + - name: Debug Build & Test + if: matrix.configuration == 'debug' + run: swift test -c debug diff --git a/.github/workflows/docker-compose.yml b/.github/workflows/docker-compose.yml index f47aca5..d82e420 100644 --- a/.github/workflows/docker-compose.yml +++ b/.github/workflows/docker-compose.yml @@ -1,3 +1,11 @@ +# +# This source file is part of the Collector-Analyst-Presenter Example open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + name: Build Docker Compose on: diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 5c39da8..a5264a1 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,9 +1,17 @@ +# +# This source file is part of the Collector-Analyst-Presenter Example open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + name: Build Docker Image on: - push: - tags: - - '*.*.*' + release: + types: [published] + workflow_dispatch: jobs: docker: diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index bc6ee09..ec95e87 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -1,9 +1,17 @@ +# +# This source file is part of the Collector-Analyst-Presenter Example open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + name: Release Drafter on: push: branches: - - release + - develop jobs: update_release_draft: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e0f9849..bd9eef0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,3 +1,11 @@ +# +# This source file is part of the Collector-Analyst-Presenter Example open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + name: Create Release on: @@ -9,7 +17,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - name: GH Release + - name: Create GitHub Release uses: softprops/action-gh-release@v0.1.5 env: GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} diff --git a/.github/workflows/reuseaction.yml b/.github/workflows/reuseaction.yml new file mode 100644 index 0000000..9b84cad --- /dev/null +++ b/.github/workflows/reuseaction.yml @@ -0,0 +1,22 @@ +# +# This source file is part of the Collector-Analyst-Presenter Example open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + +name: REUSE Compliance Check + +on: + pull_request: + workflow_dispatch: + +jobs: + reuse: + name: REUSE Compliance Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: REUSE Compliance Check + uses: fsfe/reuse-action@v1 diff --git a/.github/workflows/spm-update.yml b/.github/workflows/spm-update.yml new file mode 100644 index 0000000..7e2b115 --- /dev/null +++ b/.github/workflows/spm-update.yml @@ -0,0 +1,48 @@ +# +# This source file is part of the Collector-Analyst-Presenter Example open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + +name: Swift Package Update + +on: + schedule: + - cron: '0 0 * * 1' + workflow_dispatch: + +jobs: + createPR: + name: Create Pull Request + container: + image: swiftlang/swift:nightly-5.5-focal + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Check Swift version + run: swift --version + - name: Update Swift Packages Gateway + run: cd ./Gateway && swift package update + - name: Update Swift Packages Database + run: cd ./Database && swift package update + - name: Update Swift Packages Processing + run: cd ./Processing && swift package update + - name: Update Swift Packages Xcode Projekt + run: | + rm -f Example.xcworkspace/xcshareddata/swiftpm/Package.resolved + xcodebuild -resolvePackageDependencies + - uses: peter-evans/create-pull-request@v3 + with: + token: ${{ secrets.ACCESS_TOKEN }} + commit-message: Update dependencies + title: Update dependencies + body: Update the Swift Package dependencies. + delete-branch: true + base: develop + branch: bots/update-dependencies + assignees: ApodiniBot + committer: ApodiniBot + author: ApodiniBot + reviewers: PSchmiedmayer diff --git a/.github/workflows/swiftlint.yml b/.github/workflows/swiftlint.yml index 717a773..8eff8cf 100644 --- a/.github/workflows/swiftlint.yml +++ b/.github/workflows/swiftlint.yml @@ -1,21 +1,26 @@ +# +# This source file is part of the Collector-Analyst-Presenter Example open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + name: SwiftLint on: pull_request: - paths: - - '.github/workflows/swiftlint.yml' - - '.swiftlint.yml' - - '**/*.swift' + workflow_dispatch: jobs: swiftlint: + name: SwiftLint runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: GitHub Action for SwiftLint - uses: norio-nomura/action-swiftlint@3.1.0 + uses: norio-nomura/action-swiftlint@3.2.1 with: args: --strict env: DIFF_BASE: ${{ github.base_ref }} - diff --git a/.gitignore b/.gitignore index 2da8ef6..955b71a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,25 @@ +# +# This source file is part of the Collector-Analyst-Presenter Example open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + # Apodini .gitignore File # Swift Package Manager -.build/ -Package.resolved +*.xcodeproj +!Client/Example.xcodeproj +**/.swiftpm +**/.build/ + +# IDE related folders +.idea # Xcode User settings xcuserdata/ -# Xcode build -build/ - # Other files -.DS_Store \ No newline at end of file +.DS_Store +.env \ No newline at end of file diff --git a/.swiftlint.yml b/.swiftlint.yml index d35f42c..2ee5aee 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -1,8 +1,17 @@ +# +# This source file is part of the Collector-Analyst-Presenter Example open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + # Apodini SwiftLint file Apodini -# The whitelist_rules configuration also includes rules that are enabled by default to provide a good overview of all rules. +# The only_rules configuration also includes rules that are enabled by default to provide a good overview of all rules. only_rules: - attributes + # Attributes should be on their own lines in functions and types, but on the same line as variables and imports. - anyobject_protocol # Prefer using AnyObject over class for class-only protocols. - array_init @@ -27,6 +36,8 @@ only_rules: # Colons should be next to the identifier when specifying a type and next to the key in dictionary literals. - comma # There should be no space before and one after any comma. + - comment_spacing + # Prefer at least one space after slashes for comments. - compiler_protocol_init # The initializers declared in compiler protocols such as ExpressibleByArrayLiteral shouldn't be called directly. - computed_accessors_order @@ -77,6 +88,8 @@ only_rules: # Number of associated values in an enum case should be low - explicit_init # Explicitly calling .init() should be avoided. + - fallthrough + # Fallthrough should be avoided. - fatal_error_message # A fatalError call should have a message. - file_length @@ -116,6 +129,8 @@ only_rules: # Implicitly unwrapped optionals should be avoided when possible. - inclusive_language # Identifiers should use inclusive language that avoids discrimination against groups of people based on race, gender, or socioeconomic status + - indentation_width + # Indent code using either one tab or the configured amount of spaces, unindent to match previous indentations. Don’t indent the first line. - inert_defer # If defer is at the end of its parent scope, it will be executed right where it is anyway. - is_disjoint @@ -158,14 +173,18 @@ only_rules: # Modifier order should be consistent. - multiline_arguments # Arguments should be either on the same line, or one per line. + - multiline_arguments_brackets + # Multiline arguments should have their surrounding brackets in a new line. - multiline_function_chains # Chained function calls should be either on the same line, or one per line. - multiline_literal_brackets # Multiline literals should have their surrounding brackets in a new line. - multiline_parameters # Functions and methods parameters should be either on the same line, or one per line. + - multiline_parameters_brackets + # Multiline parameters should have their surrounding brackets in a new line. - nesting - # Types and statements should only be nested to a certain level deep. + # Types and functions should only be nested to a certain level deep. # See nesting below for the exact configuration. - nimble_operator # Prefer Nimble operator overloads over free matcher functions. @@ -197,6 +216,8 @@ only_rules: # Combine multiple pattern matching bindings by moving keywords out of tuples. - prefer_self_type_over_type_of_self # Prefer Self over type(of: self) when accessing properties or calling methods. + - prefer_zero_over_explicit_init + # Prefer .zero over explicit init with zero parameters (e.g. CGPoint(x: 0, y: 0)) - private_action # IBActions should be private. - private_outlet @@ -241,6 +262,8 @@ only_rules: # Test files should contain a single QuickSpec or XCTestCase class. - sorted_first_last # Prefer using `min()`` or `max()`` over `sorted().first` or `sorted().last` + - sorted_imports + # Imports should be sorted. - statement_position # Else and catch should be on the same line, one space after the previous declaration. - static_operator @@ -269,9 +292,13 @@ only_rules: - type_body_length # Type bodies should not span too many lines. # See large_tuple below for the exact configuration. + - type_contents_order + # Specifies the order of subtypes, properties, methods & more within a type. - type_name # Type name should only contain alphanumeric characters, start with an uppercase character and span between 3 and 40 characters in length. # Excluded types are listed below. + - unavailable_function + # Unimplemented functions should be marked as unavailable. - unneeded_break_in_switch # Avoid using unneeded break statements. - unneeded_parentheses_in_closure_argument @@ -309,19 +336,22 @@ only_rules: # Don’t include vertical whitespace (empty line) after opening braces. - void_return # Prefer -> Void over -> (). - - weak_delegate - # Delegates should be weak to avoid reference cycles. + - xct_specific_matcher + # Prefer specific XCTest matchers over XCTAssertEqual and XCTAssertNotEqual - xctfail_message # An XCTFail call should include a description of the assertion. - yoda_condition # The variable should be placed on the left, the constant on the right of a comparison operator. excluded: # paths to ignore during linting. Takes precedence over `included`. - - Carthage - - Pods - .build - .swiftpm - - R.generated.swift + - Database/.build + - Database/.swiftpm + - Gateway/.build + - Gateway/.swiftpm + - Processing/.build + - Processing/.swiftpm closure_body_length: # Closure bodies should not span too many lines. - 35 # warning - default: 20 @@ -348,6 +378,12 @@ identifier_name: - id - ok - or + - p8 + - of + - s3 + - at + - to + - in large_tuple: # Tuples shouldn't have too many members. Create a custom type instead. - 2 # warning - default: 2 @@ -361,10 +397,10 @@ line_length: # Lines should not span too many characters. ignores_function_declarations: false # default: false ignores_interpolated_strings: true # default: false -nesting: # Types should be nested at most 2 level deep, and statements should be nested at most 5 levels deep. +nesting: # Types should be nested at most 2 level deep, and functions should be nested at most 5 levels deep. type_level: warning: 2 # warning - default: 1 - statement_level: + function_level: warning: 5 # warning - default: 5 trailing_closure: diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md new file mode 100644 index 0000000..49c7e2e --- /dev/null +++ b/CONTRIBUTORS.md @@ -0,0 +1,15 @@ + + +Apodini contributors +==================== + +* [Paul Schmiedmayer](https://github.com/PSchmiedmayer) +* [Paul Kraft](https://github.com/pauljohanneskraft) \ No newline at end of file diff --git a/Client/Example.xcodeproj/project.pbxproj.license b/Client/Example.xcodeproj/project.pbxproj.license new file mode 100644 index 0000000..829bd43 --- /dev/null +++ b/Client/Example.xcodeproj/project.pbxproj.license @@ -0,0 +1,6 @@ + +This source file is part of the Collector-Analyst-Presenter Example open source project + +SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) + +SPDX-License-Identifier: MIT diff --git a/Client/Example.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved.license b/Client/Example.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved.license new file mode 100644 index 0000000..829bd43 --- /dev/null +++ b/Client/Example.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved.license @@ -0,0 +1,6 @@ + +This source file is part of the Collector-Analyst-Presenter Example open source project + +SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) + +SPDX-License-Identifier: MIT diff --git a/Client/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme.license b/Client/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme.license new file mode 100644 index 0000000..829bd43 --- /dev/null +++ b/Client/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme.license @@ -0,0 +1,6 @@ + +This source file is part of the Collector-Analyst-Presenter Example open source project + +SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) + +SPDX-License-Identifier: MIT diff --git a/Client/Example/ExampleApp.swift b/Client/Example/ExampleApp.swift index fda977b..898f56b 100644 --- a/Client/Example/ExampleApp.swift +++ b/Client/Example/ExampleApp.swift @@ -1,3 +1,11 @@ +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import AnalystPresenter import SwiftUI diff --git a/Client/Example/Views/ConnectView.swift b/Client/Example/Views/ConnectView.swift index 25b69c7..ff34ae4 100644 --- a/Client/Example/Views/ConnectView.swift +++ b/Client/Example/Views/ConnectView.swift @@ -1,3 +1,11 @@ +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import SwiftUI @@ -30,10 +38,9 @@ struct ConnectView: View { .padding(.bottom, 16) Button("Connect", action: load) .disabled(url == nil) - .buttonStyle(.bordered) + .buttonStyle(.borderedProminent) .tint(.primary) .controlSize(.large) - .controlProminence(.increased) } .padding(32) .frame(maxWidth: .infinity) diff --git a/Client/Example/Views/ContentView.swift b/Client/Example/Views/ContentView.swift index 1bc9d0a..f27ea30 100644 --- a/Client/Example/Views/ContentView.swift +++ b/Client/Example/Views/ContentView.swift @@ -1,3 +1,11 @@ +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import Presenter import SwiftUI diff --git a/Client/Example/Views/ErrorView.swift b/Client/Example/Views/ErrorView.swift index 2e3baa0..84fc02a 100644 --- a/Client/Example/Views/ErrorView.swift +++ b/Client/Example/Views/ErrorView.swift @@ -1,3 +1,11 @@ +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import SwiftUI @@ -12,10 +20,9 @@ struct ErrorView: View { VStack(spacing: 32) { Text(error) Button("Enter different hostname", action: action) - .buttonStyle(.bordered) + .buttonStyle(.borderedProminent) .tint(.primary) .controlSize(.large) - .controlProminence(.increased) } .padding(32) .navigationTitle("Error") diff --git a/Client/Example/Views/LoadingView.swift b/Client/Example/Views/LoadingView.swift index 5e9ae0c..adf02e5 100644 --- a/Client/Example/Views/LoadingView.swift +++ b/Client/Example/Views/LoadingView.swift @@ -1,3 +1,11 @@ +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import Presenter import SwiftUI diff --git a/Client/ExampleUITests/ExampleUITests.swift b/Client/ExampleUITests/ExampleUITests.swift index b340892..5bd0012 100644 --- a/Client/ExampleUITests/ExampleUITests.swift +++ b/Client/ExampleUITests/ExampleUITests.swift @@ -1,3 +1,11 @@ +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import XCTest diff --git a/Database/.dockerignore b/Database/.dockerignore index e690b13..013d4df 100644 --- a/Database/.dockerignore +++ b/Database/.dockerignore @@ -1,3 +1,11 @@ +# +# This source file is part of the Collector-Analyst-Presenter Example open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + .build/ .swiftpm/ Package.resolved \ No newline at end of file diff --git a/Database/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/Database/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 919434a..0000000 --- a/Database/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Database/.swiftpm/xcode/xcshareddata/xcschemes/DatabaseWebService.xcscheme b/Database/.swiftpm/xcode/xcshareddata/xcschemes/DatabaseWebService.xcscheme deleted file mode 100644 index cf25996..0000000 --- a/Database/.swiftpm/xcode/xcshareddata/xcschemes/DatabaseWebService.xcscheme +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Database/Dockerfile b/Database/Dockerfile index c67d6b5..e43ff99 100644 --- a/Database/Dockerfile +++ b/Database/Dockerfile @@ -1,7 +1,15 @@ +# +# This source file is part of the Collector-Analyst-Presenter Example open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + # ================================ # Build image # ================================ -FROM swift:5.4-focal as build +FROM swiftlang/swift:nightly-5.5-focal as build # Install OS updates and, if needed, sqlite3 RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \ @@ -36,7 +44,7 @@ RUN [ -d "$(swift build --package-path /build -c release --show-bin-path)/Databa # ================================ # Run image # ================================ -FROM swift:5.4-focal-slim +FROM swiftlang/swift:nightly-5.5-focal-slim as run # Make sure all system packages are up to date. RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \ diff --git a/Database/Package.resolved b/Database/Package.resolved new file mode 100644 index 0000000..168934c --- /dev/null +++ b/Database/Package.resolved @@ -0,0 +1,466 @@ +{ + "object": { + "pins": [ + { + "package": "Analyst", + "repositoryURL": "https://github.com/Apodini/Analyst.git", + "state": { + "branch": null, + "revision": "b98dc3472d47115e84704c9169103192c7379703", + "version": "0.1.1" + } + }, + { + "package": "apnswift", + "repositoryURL": "https://github.com/kylebrowning/APNSwift.git", + "state": { + "branch": null, + "revision": "03e83e2332d13a3c06d5cd70948166e5724c43c7", + "version": "3.0.0" + } + }, + { + "package": "Apodini", + "repositoryURL": "https://github.com/Apodini/Apodini.git", + "state": { + "branch": null, + "revision": "e6a943b0db29b2df5c0c139ab993e57752bf22b7", + "version": "0.5.0" + } + }, + { + "package": "ApodiniAnalystPresenter", + "repositoryURL": "https://github.com/Apodini/ApodiniAnalystPresenter.git", + "state": { + "branch": null, + "revision": "d813931e0fc52205669c0a30fe6aad09bdd8ec19", + "version": "0.3.1" + } + }, + { + "package": "ApodiniAsyncHTTPClient", + "repositoryURL": "https://github.com/Apodini/ApodiniAsyncHTTPClient.git", + "state": { + "branch": null, + "revision": "cb387bdf21b8d3ded1e76bd27b3b88d59202d4c1", + "version": "0.3.1" + } + }, + { + "package": "ApodiniCollector", + "repositoryURL": "https://github.com/Apodini/ApodiniCollector.git", + "state": { + "branch": null, + "revision": "fbea06605aa31e4487123ff4ca1ebfbc157d243a", + "version": "0.3.1" + } + }, + { + "package": "AssociatedTypeRequirementsKit", + "repositoryURL": "https://github.com/nerdsupremacist/AssociatedTypeRequirementsKit.git", + "state": { + "branch": null, + "revision": "2e4c49c21ffb2135f1c99fbfcf2119c9d24f5e8c", + "version": "0.3.2" + } + }, + { + "package": "async-http-client", + "repositoryURL": "https://github.com/swift-server/async-http-client.git", + "state": { + "branch": null, + "revision": "8e4d51908dd49272667126403bf977c5c503f78f", + "version": "1.5.0" + } + }, + { + "package": "async-kit", + "repositoryURL": "https://github.com/vapor/async-kit.git", + "state": { + "branch": null, + "revision": "c1de408100a2f2e4ab2ea06512e8635bc1a59144", + "version": "1.3.1" + } + }, + { + "package": "Collector", + "repositoryURL": "https://github.com/Apodini/Collector.git", + "state": { + "branch": null, + "revision": "868eac8c46ffab0e03b29522d0c98fa9bf07fb4f", + "version": "0.1.1" + } + }, + { + "package": "console-kit", + "repositoryURL": "https://github.com/vapor/console-kit.git", + "state": { + "branch": null, + "revision": "75ea3b627d88221440b878e5dfccc73fd06842ed", + "version": "4.2.7" + } + }, + { + "package": "FCM", + "repositoryURL": "https://github.com/MihaelIsaev/FCM.git", + "state": { + "branch": null, + "revision": "5d35a93bde97fd34879bf1f7ca198f4efacd8eca", + "version": "2.11.1" + } + }, + { + "package": "FineJSON", + "repositoryURL": "https://github.com/omochi/FineJSON.git", + "state": { + "branch": null, + "revision": "05101709243cb66d80c92e645210a3b80cf4e17f", + "version": "1.14.0" + } + }, + { + "package": "fluent-kit", + "repositoryURL": "https://github.com/vapor/fluent-kit.git", + "state": { + "branch": null, + "revision": "c0cfc1e6d9a2bbd04d4c583632eb0c09c92ff22c", + "version": "1.15.0" + } + }, + { + "package": "fluent-sqlite-driver", + "repositoryURL": "https://github.com/vapor/fluent-sqlite-driver.git", + "state": { + "branch": null, + "revision": "9ca34be792979fb0f1dbd8e45b8af9f1e1440474", + "version": "4.1.0" + } + }, + { + "package": "grpc-swift", + "repositoryURL": "https://github.com/grpc/grpc-swift.git", + "state": { + "branch": null, + "revision": "14e1ea3350892a864386517c037e11fb68baf818", + "version": "1.3.0" + } + }, + { + "package": "jmespath.swift", + "repositoryURL": "https://github.com/adam-fowler/jmespath.swift.git", + "state": { + "branch": null, + "revision": "4a166ea71f0d9e9cc3523fc3dee516080a4c36a0", + "version": "1.0.0" + } + }, + { + "package": "jwt", + "repositoryURL": "https://github.com/vapor/jwt.git", + "state": { + "branch": null, + "revision": "46eddb526fa70fd9d765a3bdffac73b2be487cfc", + "version": "4.0.0" + } + }, + { + "package": "jwt-kit", + "repositoryURL": "https://github.com/vapor/jwt-kit.git", + "state": { + "branch": null, + "revision": "7a9a04df93e71de10fa2e8d6e9430dd0a7924643", + "version": "4.2.4" + } + }, + { + "package": "multipart-kit", + "repositoryURL": "https://github.com/vapor/multipart-kit.git", + "state": { + "branch": null, + "revision": "c9ea04017b7fb3b1f034ad7a77f8e53d3e080be5", + "version": "4.2.1" + } + }, + { + "package": "OpenAPIKit", + "repositoryURL": "https://github.com/mattpolzin/OpenAPIKit.git", + "state": { + "branch": null, + "revision": "4986552e76c331a99770428bd2be77ad76068c08", + "version": "2.4.0" + } + }, + { + "package": "Presenter", + "repositoryURL": "https://github.com/Apodini/Presenter.git", + "state": { + "branch": null, + "revision": "ea7630c2c115c72a61f607c574e453470167b925", + "version": "0.1.2" + } + }, + { + "package": "RichJSONParser", + "repositoryURL": "https://github.com/omochi/RichJSONParser.git", + "state": { + "branch": null, + "revision": "263e2ecfe88d0500fa99e4cbc8c948529d335534", + "version": "3.0.0" + } + }, + { + "package": "routing-kit", + "repositoryURL": "https://github.com/vapor/routing-kit.git", + "state": { + "branch": null, + "revision": "a0801a36a6ad501d5ad6285cbcd4774de6b0a734", + "version": "4.3.0" + } + }, + { + "package": "Runtime", + "repositoryURL": "https://github.com/Supereg/Runtime.git", + "state": { + "branch": null, + "revision": "596e22a518bb3f8177cd796cd77e5386098a33f8", + "version": "2.2.3" + } + }, + { + "package": "soto", + "repositoryURL": "https://github.com/soto-project/soto.git", + "state": { + "branch": null, + "revision": "693fc693b580a2c635c1457d09cbf54411691ffe", + "version": "5.7.0" + } + }, + { + "package": "soto-core", + "repositoryURL": "https://github.com/soto-project/soto-core.git", + "state": { + "branch": null, + "revision": "98c7f11f9e66480984340950e7d0241c7456ac8e", + "version": "5.5.0" + } + }, + { + "package": "soto-s3-file-transfer", + "repositoryURL": "https://github.com/soto-project/soto-s3-file-transfer", + "state": { + "branch": null, + "revision": "14814e5894991705b2cc122c694bf0b3931f2c02", + "version": "0.3.1" + } + }, + { + "package": "sql-kit", + "repositoryURL": "https://github.com/vapor/sql-kit.git", + "state": { + "branch": null, + "revision": "b70d1fea1b544dd819c17e83d59fb9aa85c81e74", + "version": "3.10.0" + } + }, + { + "package": "sqlite-kit", + "repositoryURL": "https://github.com/vapor/sqlite-kit.git", + "state": { + "branch": null, + "revision": "2ec279b9c845cec254646834b66338551a024561", + "version": "4.0.2" + } + }, + { + "package": "sqlite-nio", + "repositoryURL": "https://github.com/vapor/sqlite-nio.git", + "state": { + "branch": null, + "revision": "6481dd0b01112d082dd7eb362782126e81964138", + "version": "1.1.0" + } + }, + { + "package": "SwifCron", + "repositoryURL": "https://github.com/MihaelIsaev/SwifCron.git", + "state": { + "branch": null, + "revision": "effe20321342705e66894d86720c5882e2f4095e", + "version": "1.3.1" + } + }, + { + "package": "swift-argument-parser", + "repositoryURL": "https://github.com/apple/swift-argument-parser", + "state": { + "branch": null, + "revision": "83b23d940471b313427da226196661856f6ba3e0", + "version": "0.4.4" + } + }, + { + "package": "swift-aws-lambda-runtime", + "repositoryURL": "https://github.com/swift-server/swift-aws-lambda-runtime.git", + "state": { + "branch": null, + "revision": "a9e15b13b30b6700056c4cfbdcf6a69382a9fb6f", + "version": "0.5.0" + } + }, + { + "package": "swift-backtrace", + "repositoryURL": "https://github.com/swift-server/swift-backtrace.git", + "state": { + "branch": null, + "revision": "d3e04a9d4b3833363fb6192065b763310b156d54", + "version": "1.3.1" + } + }, + { + "package": "swift-collections", + "repositoryURL": "https://github.com/apple/swift-collections", + "state": { + "branch": null, + "revision": "9d8719c8bebdc79740b6969c912ac706eb721d7a", + "version": "0.0.7" + } + }, + { + "package": "swift-crypto", + "repositoryURL": "https://github.com/apple/swift-crypto.git", + "state": { + "branch": null, + "revision": "3bea268b223651c4ab7b7b9ad62ef9b2d4143eb6", + "version": "1.1.6" + } + }, + { + "package": "swift-extras-base64", + "repositoryURL": "https://github.com/swift-extras/swift-extras-base64", + "state": { + "branch": null, + "revision": "97237cf1bc1feebaeb0febec91c1e1b9e4d839b3", + "version": "0.7.0" + } + }, + { + "package": "swift-log", + "repositoryURL": "https://github.com/apple/swift-log.git", + "state": { + "branch": null, + "revision": "5d66f7ba25daf4f94100e7022febf3c75e37a6c7", + "version": "1.4.2" + } + }, + { + "package": "swift-metrics", + "repositoryURL": "https://github.com/apple/swift-metrics.git", + "state": { + "branch": null, + "revision": "3edd2f57afc4e68e23c3e4956bc8b65ca6b5b2ff", + "version": "2.2.0" + } + }, + { + "package": "swift-nio", + "repositoryURL": "https://github.com/apple/swift-nio.git", + "state": { + "branch": null, + "revision": "9a992ee3de1f8da9f2968fc96b26714834f3105f", + "version": "2.31.1" + } + }, + { + "package": "swift-nio-extras", + "repositoryURL": "https://github.com/apple/swift-nio-extras.git", + "state": { + "branch": null, + "revision": "f72c4688f89c28502105509186eadc49a49cb922", + "version": "1.10.0" + } + }, + { + "package": "swift-nio-http2", + "repositoryURL": "https://github.com/apple/swift-nio-http2.git", + "state": { + "branch": null, + "revision": "f6cde03ef8ad57e3bd25743d1e678efd1e5239f7", + "version": "1.18.1" + } + }, + { + "package": "swift-nio-ssl", + "repositoryURL": "https://github.com/apple/swift-nio-ssl.git", + "state": { + "branch": null, + "revision": "4829979d9f5ed9a2f4c6efd9c1ed51d1ab4d0394", + "version": "2.14.1" + } + }, + { + "package": "swift-nio-transport-services", + "repositoryURL": "https://github.com/apple/swift-nio-transport-services.git", + "state": { + "branch": null, + "revision": "39587bceccda72780e2a8a8c5e857e42a9df2fa8", + "version": "1.11.0" + } + }, + { + "package": "SwiftProtobuf", + "repositoryURL": "https://github.com/apple/swift-protobuf.git", + "state": { + "branch": null, + "revision": "1f62db409f2c9b0223a3f68567b4a01333aae778", + "version": "1.17.0" + } + }, + { + "package": "SwiftPrometheus", + "repositoryURL": "https://github.com/MrLotU/SwiftPrometheus.git", + "state": { + "branch": null, + "revision": "7e0cf8f913ed4353462bd4ad46f1db1b34c28a82", + "version": "1.0.0-alpha.14" + } + }, + { + "package": "vapor", + "repositoryURL": "https://github.com/vapor/vapor.git", + "state": { + "branch": null, + "revision": "5113bfcb0dbcfaefdc043acd8e161046eb4fbb65", + "version": "4.48.4" + } + }, + { + "package": "vapor-aws-lambda-runtime", + "repositoryURL": "https://github.com/vapor-community/vapor-aws-lambda-runtime.git", + "state": { + "branch": null, + "revision": "610aaed1cdd7ef434ed23bc7006000948a221527", + "version": "0.6.2" + } + }, + { + "package": "websocket-kit", + "repositoryURL": "https://github.com/vapor/websocket-kit.git", + "state": { + "branch": null, + "revision": "d7537b787d37f3877e36b5f1e7cb910f7c401836", + "version": "2.1.4" + } + }, + { + "package": "Yams", + "repositoryURL": "https://github.com/jpsim/Yams.git", + "state": { + "branch": null, + "revision": "9ff1cc9327586db4e0c8f46f064b6a82ec1566fa", + "version": "4.0.6" + } + } + ] + }, + "version": 1 +} diff --git a/Database/Package.resolved.license b/Database/Package.resolved.license new file mode 100644 index 0000000..829bd43 --- /dev/null +++ b/Database/Package.resolved.license @@ -0,0 +1,6 @@ + +This source file is part of the Collector-Analyst-Presenter Example open source project + +SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) + +SPDX-License-Identifier: MIT diff --git a/Database/Package.swift b/Database/Package.swift index aa2a177..d34e5d6 100644 --- a/Database/Package.swift +++ b/Database/Package.swift @@ -1,11 +1,21 @@ -// swift-tools-version:5.4 +// swift-tools-version:5.5 + +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + + import PackageDescription let package = Package( name: "DatabaseWebService", platforms: [ - .macOS(.v10_15) + .macOS(.v12) ], products: [ .executable( @@ -16,9 +26,10 @@ let package = Package( ) ], dependencies: [ - .package(url: "https://github.com/Apodini/Apodini.git", .upToNextMinor(from: "0.3.0")), - .package(url: "https://github.com/Apodini/ApodiniCollector.git", .upToNextMinor(from: "0.2.0")), - .package(url: "https://github.com/Apodini/ApodiniAnalystPresenter.git", .upToNextMinor(from: "0.2.0")) + .package(url: "https://github.com/Apodini/Apodini.git", .upToNextMinor(from: "0.5.0")), + .package(url: "https://github.com/Apodini/ApodiniCollector.git", .upToNextMinor(from: "0.3.1")), + .package(url: "https://github.com/Apodini/ApodiniAnalystPresenter.git", .upToNextMinor(from: "0.3.1")), + .package(url: "https://github.com/vapor/fluent-sqlite-driver.git", from: "4.1.0") ], targets: [ .executableTarget( @@ -28,7 +39,8 @@ let package = Package( .product(name: "ApodiniDatabase", package: "Apodini"), .product(name: "ApodiniREST", package: "Apodini"), .product(name: "ApodiniCollector", package: "ApodiniCollector"), - .product(name: "ApodiniAnalystPresenter", package: "ApodiniAnalystPresenter") + .product(name: "ApodiniAnalystPresenter", package: "ApodiniAnalystPresenter"), + .product(name: "FluentSQLiteDriver", package: "fluent-sqlite-driver") ] ), .testTarget( diff --git a/Database/Sources/DatabaseWebService/DatabaseWebService.swift b/Database/Sources/DatabaseWebService/DatabaseWebService.swift index 8e946ea..e7aac86 100644 --- a/Database/Sources/DatabaseWebService/DatabaseWebService.swift +++ b/Database/Sources/DatabaseWebService/DatabaseWebService.swift @@ -1,9 +1,18 @@ +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import Apodini import ApodiniAnalystPresenter import ApodiniCollector import ApodiniDatabase import ApodiniREST import ArgumentParser +import FluentSQLiteDriver import Foundation @@ -24,7 +33,7 @@ struct DatabaseWebService: WebService { REST() // Databasee Configuration - DatabaseConfiguration(.sqlite(.memory)) + DatabaseConfiguration(.sqlite(.memory), as: .sqlite) .addMigrations(UserLocationModel()) // Configure the UI Metrics Service with the passed in arguments diff --git a/Database/Sources/DatabaseWebService/Extensions/URL+ExpressibleByArgument.swift b/Database/Sources/DatabaseWebService/Extensions/URL+ExpressibleByArgument.swift index 656348b..0f61750 100644 --- a/Database/Sources/DatabaseWebService/Extensions/URL+ExpressibleByArgument.swift +++ b/Database/Sources/DatabaseWebService/Extensions/URL+ExpressibleByArgument.swift @@ -1,3 +1,11 @@ +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import ArgumentParser import Foundation diff --git a/Database/Sources/DatabaseWebService/Handler/CreateUserLocationHandler.swift b/Database/Sources/DatabaseWebService/Handler/CreateUserLocationHandler.swift index 1ee7ad0..9183be4 100644 --- a/Database/Sources/DatabaseWebService/Handler/CreateUserLocationHandler.swift +++ b/Database/Sources/DatabaseWebService/Handler/CreateUserLocationHandler.swift @@ -1,3 +1,11 @@ +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import Apodini import JaegerCollector diff --git a/Database/Sources/DatabaseWebService/Handler/ReadUserLocationHandler.swift b/Database/Sources/DatabaseWebService/Handler/ReadUserLocationHandler.swift index c7b7052..eb397d3 100644 --- a/Database/Sources/DatabaseWebService/Handler/ReadUserLocationHandler.swift +++ b/Database/Sources/DatabaseWebService/Handler/ReadUserLocationHandler.swift @@ -1,3 +1,11 @@ +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import Apodini import JaegerCollector diff --git a/Database/Sources/DatabaseWebService/Model/Coordinate.swift b/Database/Sources/DatabaseWebService/Model/Coordinate.swift index c2ccc66..8db8de7 100644 --- a/Database/Sources/DatabaseWebService/Model/Coordinate.swift +++ b/Database/Sources/DatabaseWebService/Model/Coordinate.swift @@ -1,5 +1,13 @@ -import Foundation +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import Apodini +import Foundation struct Coordinate: Codable, Content { diff --git a/Database/Sources/DatabaseWebService/Model/DatabaseService.swift b/Database/Sources/DatabaseWebService/Model/DatabaseService.swift index a1af50b..332cf28 100644 --- a/Database/Sources/DatabaseWebService/Model/DatabaseService.swift +++ b/Database/Sources/DatabaseWebService/Model/DatabaseService.swift @@ -1,3 +1,11 @@ +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import Apodini import FluentSQLiteDriver @@ -32,8 +40,7 @@ final class FluentDatabaseService: DatabaseService { .all() .map { $0.map { - Coordinate(latitude: $0.latitude, - longitude: $0.longitude) + Coordinate(latitude: $0.latitude, longitude: $0.longitude) } } } diff --git a/Database/Sources/DatabaseWebService/Model/UserLocationModel.swift b/Database/Sources/DatabaseWebService/Model/UserLocationModel.swift index 9d4a12b..d67b4c4 100644 --- a/Database/Sources/DatabaseWebService/Model/UserLocationModel.swift +++ b/Database/Sources/DatabaseWebService/Model/UserLocationModel.swift @@ -1,13 +1,18 @@ +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import FluentSQLiteDriver import Foundation final class UserLocationModel: Model, Codable { static let schema = String(describing: UserLocationModel.self) - - init() {} - @ID var id: UUID? @@ -20,6 +25,9 @@ final class UserLocationModel: Model, Codable { @Field(key: "longitude") var longitude: Double + + + init() {} } diff --git a/Database/Tests/DatabaseWebServiceTests/AppTests.swift b/Database/Tests/DatabaseWebServiceTests/AppTests.swift index a37b184..578a675 100644 --- a/Database/Tests/DatabaseWebServiceTests/AppTests.swift +++ b/Database/Tests/DatabaseWebServiceTests/AppTests.swift @@ -1,3 +1,11 @@ +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import XCTest diff --git a/Database/prometheus-development.yml b/Database/prometheus-development.yml index b829caa..937b1c0 100644 --- a/Database/prometheus-development.yml +++ b/Database/prometheus-development.yml @@ -1,3 +1,11 @@ +# +# This source file is part of the Collector-Analyst-Presenter Example open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + global: scrape_interval: 15s scrape_timeout: 10s diff --git a/Database/prometheus.yml b/Database/prometheus.yml index a62313e..91ac90b 100644 --- a/Database/prometheus.yml +++ b/Database/prometheus.yml @@ -1,3 +1,11 @@ +# +# This source file is part of the Collector-Analyst-Presenter Example open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + global: scrape_interval: 15s scrape_timeout: 10s diff --git a/Example.xcworkspace/contents.xcworkspacedata b/Example.xcworkspace/contents.xcworkspacedata index 53ba023..c6c09e8 100644 --- a/Example.xcworkspace/contents.xcworkspacedata +++ b/Example.xcworkspace/contents.xcworkspacedata @@ -4,9 +4,6 @@ - - diff --git a/Example.xcworkspace/contents.xcworkspacedata.license b/Example.xcworkspace/contents.xcworkspacedata.license new file mode 100644 index 0000000..829bd43 --- /dev/null +++ b/Example.xcworkspace/contents.xcworkspacedata.license @@ -0,0 +1,6 @@ + +This source file is part of the Collector-Analyst-Presenter Example open source project + +SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) + +SPDX-License-Identifier: MIT diff --git a/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist.license b/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist.license new file mode 100644 index 0000000..829bd43 --- /dev/null +++ b/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist.license @@ -0,0 +1,6 @@ + +This source file is part of the Collector-Analyst-Presenter Example open source project + +SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) + +SPDX-License-Identifier: MIT diff --git a/Example.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Example.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 0000000..64bd434 --- /dev/null +++ b/Example.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,475 @@ +{ + "object": { + "pins": [ + { + "package": "Analyst", + "repositoryURL": "https://github.com/Apodini/Analyst", + "state": { + "branch": null, + "revision": "b98dc3472d47115e84704c9169103192c7379703", + "version": "0.1.1" + } + }, + { + "package": "apnswift", + "repositoryURL": "https://github.com/kylebrowning/APNSwift.git", + "state": { + "branch": null, + "revision": "03e83e2332d13a3c06d5cd70948166e5724c43c7", + "version": "3.0.0" + } + }, + { + "package": "Apodini", + "repositoryURL": "https://github.com/Apodini/Apodini.git", + "state": { + "branch": null, + "revision": "e6a943b0db29b2df5c0c139ab993e57752bf22b7", + "version": "0.5.0" + } + }, + { + "package": "ApodiniAnalystPresenter", + "repositoryURL": "https://github.com/Apodini/ApodiniAnalystPresenter.git", + "state": { + "branch": null, + "revision": "d813931e0fc52205669c0a30fe6aad09bdd8ec19", + "version": "0.3.1" + } + }, + { + "package": "ApodiniAsyncHTTPClient", + "repositoryURL": "https://github.com/Apodini/ApodiniAsyncHTTPClient.git", + "state": { + "branch": null, + "revision": "cb387bdf21b8d3ded1e76bd27b3b88d59202d4c1", + "version": "0.3.1" + } + }, + { + "package": "ApodiniCollector", + "repositoryURL": "https://github.com/Apodini/ApodiniCollector.git", + "state": { + "branch": null, + "revision": "fbea06605aa31e4487123ff4ca1ebfbc157d243a", + "version": "0.3.1" + } + }, + { + "package": "AssociatedTypeRequirementsKit", + "repositoryURL": "https://github.com/nerdsupremacist/AssociatedTypeRequirementsKit.git", + "state": { + "branch": null, + "revision": "2e4c49c21ffb2135f1c99fbfcf2119c9d24f5e8c", + "version": "0.3.2" + } + }, + { + "package": "async-http-client", + "repositoryURL": "https://github.com/swift-server/async-http-client.git", + "state": { + "branch": null, + "revision": "8e4d51908dd49272667126403bf977c5c503f78f", + "version": "1.5.0" + } + }, + { + "package": "async-kit", + "repositoryURL": "https://github.com/vapor/async-kit.git", + "state": { + "branch": null, + "revision": "c1de408100a2f2e4ab2ea06512e8635bc1a59144", + "version": "1.3.1" + } + }, + { + "package": "Collector", + "repositoryURL": "https://github.com/Apodini/Collector.git", + "state": { + "branch": null, + "revision": "868eac8c46ffab0e03b29522d0c98fa9bf07fb4f", + "version": "0.1.1" + } + }, + { + "package": "console-kit", + "repositoryURL": "https://github.com/vapor/console-kit.git", + "state": { + "branch": null, + "revision": "75ea3b627d88221440b878e5dfccc73fd06842ed", + "version": "4.2.7" + } + }, + { + "package": "DBSCAN", + "repositoryURL": "https://github.com/NSHipster/DBSCAN", + "state": { + "branch": null, + "revision": "c99186151c1ab227588d27032146140ddc9b4f24", + "version": "0.0.1" + } + }, + { + "package": "FCM", + "repositoryURL": "https://github.com/MihaelIsaev/FCM.git", + "state": { + "branch": null, + "revision": "5d35a93bde97fd34879bf1f7ca198f4efacd8eca", + "version": "2.11.1" + } + }, + { + "package": "FineJSON", + "repositoryURL": "https://github.com/omochi/FineJSON.git", + "state": { + "branch": null, + "revision": "05101709243cb66d80c92e645210a3b80cf4e17f", + "version": "1.14.0" + } + }, + { + "package": "fluent-kit", + "repositoryURL": "https://github.com/vapor/fluent-kit.git", + "state": { + "branch": null, + "revision": "c0cfc1e6d9a2bbd04d4c583632eb0c09c92ff22c", + "version": "1.15.0" + } + }, + { + "package": "fluent-sqlite-driver", + "repositoryURL": "https://github.com/vapor/fluent-sqlite-driver.git", + "state": { + "branch": null, + "revision": "9ca34be792979fb0f1dbd8e45b8af9f1e1440474", + "version": "4.1.0" + } + }, + { + "package": "grpc-swift", + "repositoryURL": "https://github.com/grpc/grpc-swift.git", + "state": { + "branch": null, + "revision": "14e1ea3350892a864386517c037e11fb68baf818", + "version": "1.3.0" + } + }, + { + "package": "jmespath.swift", + "repositoryURL": "https://github.com/adam-fowler/jmespath.swift.git", + "state": { + "branch": null, + "revision": "4a166ea71f0d9e9cc3523fc3dee516080a4c36a0", + "version": "1.0.0" + } + }, + { + "package": "jwt", + "repositoryURL": "https://github.com/vapor/jwt.git", + "state": { + "branch": null, + "revision": "46eddb526fa70fd9d765a3bdffac73b2be487cfc", + "version": "4.0.0" + } + }, + { + "package": "jwt-kit", + "repositoryURL": "https://github.com/vapor/jwt-kit.git", + "state": { + "branch": null, + "revision": "7a9a04df93e71de10fa2e8d6e9430dd0a7924643", + "version": "4.2.4" + } + }, + { + "package": "multipart-kit", + "repositoryURL": "https://github.com/vapor/multipart-kit.git", + "state": { + "branch": null, + "revision": "c9ea04017b7fb3b1f034ad7a77f8e53d3e080be5", + "version": "4.2.1" + } + }, + { + "package": "OpenAPIKit", + "repositoryURL": "https://github.com/mattpolzin/OpenAPIKit.git", + "state": { + "branch": null, + "revision": "4986552e76c331a99770428bd2be77ad76068c08", + "version": "2.4.0" + } + }, + { + "package": "Presenter", + "repositoryURL": "https://github.com/Apodini/Presenter.git", + "state": { + "branch": null, + "revision": "ea7630c2c115c72a61f607c574e453470167b925", + "version": "0.1.2" + } + }, + { + "package": "RichJSONParser", + "repositoryURL": "https://github.com/omochi/RichJSONParser.git", + "state": { + "branch": null, + "revision": "263e2ecfe88d0500fa99e4cbc8c948529d335534", + "version": "3.0.0" + } + }, + { + "package": "routing-kit", + "repositoryURL": "https://github.com/vapor/routing-kit.git", + "state": { + "branch": null, + "revision": "a0801a36a6ad501d5ad6285cbcd4774de6b0a734", + "version": "4.3.0" + } + }, + { + "package": "Runtime", + "repositoryURL": "https://github.com/Supereg/Runtime.git", + "state": { + "branch": null, + "revision": "596e22a518bb3f8177cd796cd77e5386098a33f8", + "version": "2.2.3" + } + }, + { + "package": "soto", + "repositoryURL": "https://github.com/soto-project/soto.git", + "state": { + "branch": null, + "revision": "693fc693b580a2c635c1457d09cbf54411691ffe", + "version": "5.7.0" + } + }, + { + "package": "soto-core", + "repositoryURL": "https://github.com/soto-project/soto-core.git", + "state": { + "branch": null, + "revision": "98c7f11f9e66480984340950e7d0241c7456ac8e", + "version": "5.5.0" + } + }, + { + "package": "soto-s3-file-transfer", + "repositoryURL": "https://github.com/soto-project/soto-s3-file-transfer", + "state": { + "branch": null, + "revision": "14814e5894991705b2cc122c694bf0b3931f2c02", + "version": "0.3.1" + } + }, + { + "package": "sql-kit", + "repositoryURL": "https://github.com/vapor/sql-kit.git", + "state": { + "branch": null, + "revision": "b70d1fea1b544dd819c17e83d59fb9aa85c81e74", + "version": "3.10.0" + } + }, + { + "package": "sqlite-kit", + "repositoryURL": "https://github.com/vapor/sqlite-kit.git", + "state": { + "branch": null, + "revision": "2ec279b9c845cec254646834b66338551a024561", + "version": "4.0.2" + } + }, + { + "package": "sqlite-nio", + "repositoryURL": "https://github.com/vapor/sqlite-nio.git", + "state": { + "branch": null, + "revision": "6481dd0b01112d082dd7eb362782126e81964138", + "version": "1.1.0" + } + }, + { + "package": "SwifCron", + "repositoryURL": "https://github.com/MihaelIsaev/SwifCron.git", + "state": { + "branch": null, + "revision": "effe20321342705e66894d86720c5882e2f4095e", + "version": "1.3.1" + } + }, + { + "package": "swift-argument-parser", + "repositoryURL": "https://github.com/apple/swift-argument-parser", + "state": { + "branch": null, + "revision": "83b23d940471b313427da226196661856f6ba3e0", + "version": "0.4.4" + } + }, + { + "package": "swift-aws-lambda-runtime", + "repositoryURL": "https://github.com/swift-server/swift-aws-lambda-runtime.git", + "state": { + "branch": null, + "revision": "a9e15b13b30b6700056c4cfbdcf6a69382a9fb6f", + "version": "0.5.0" + } + }, + { + "package": "swift-backtrace", + "repositoryURL": "https://github.com/swift-server/swift-backtrace.git", + "state": { + "branch": null, + "revision": "d3e04a9d4b3833363fb6192065b763310b156d54", + "version": "1.3.1" + } + }, + { + "package": "swift-collections", + "repositoryURL": "https://github.com/apple/swift-collections", + "state": { + "branch": null, + "revision": "9d8719c8bebdc79740b6969c912ac706eb721d7a", + "version": "0.0.7" + } + }, + { + "package": "swift-crypto", + "repositoryURL": "https://github.com/apple/swift-crypto.git", + "state": { + "branch": null, + "revision": "3bea268b223651c4ab7b7b9ad62ef9b2d4143eb6", + "version": "1.1.6" + } + }, + { + "package": "swift-extras-base64", + "repositoryURL": "https://github.com/swift-extras/swift-extras-base64", + "state": { + "branch": null, + "revision": "97237cf1bc1feebaeb0febec91c1e1b9e4d839b3", + "version": "0.7.0" + } + }, + { + "package": "swift-log", + "repositoryURL": "https://github.com/apple/swift-log.git", + "state": { + "branch": null, + "revision": "5d66f7ba25daf4f94100e7022febf3c75e37a6c7", + "version": "1.4.2" + } + }, + { + "package": "swift-metrics", + "repositoryURL": "https://github.com/apple/swift-metrics.git", + "state": { + "branch": null, + "revision": "3edd2f57afc4e68e23c3e4956bc8b65ca6b5b2ff", + "version": "2.2.0" + } + }, + { + "package": "swift-nio", + "repositoryURL": "https://github.com/apple/swift-nio.git", + "state": { + "branch": null, + "revision": "9a992ee3de1f8da9f2968fc96b26714834f3105f", + "version": "2.31.1" + } + }, + { + "package": "swift-nio-extras", + "repositoryURL": "https://github.com/apple/swift-nio-extras.git", + "state": { + "branch": null, + "revision": "f72c4688f89c28502105509186eadc49a49cb922", + "version": "1.10.0" + } + }, + { + "package": "swift-nio-http2", + "repositoryURL": "https://github.com/apple/swift-nio-http2.git", + "state": { + "branch": null, + "revision": "f6cde03ef8ad57e3bd25743d1e678efd1e5239f7", + "version": "1.18.1" + } + }, + { + "package": "swift-nio-ssl", + "repositoryURL": "https://github.com/apple/swift-nio-ssl.git", + "state": { + "branch": null, + "revision": "4829979d9f5ed9a2f4c6efd9c1ed51d1ab4d0394", + "version": "2.14.1" + } + }, + { + "package": "swift-nio-transport-services", + "repositoryURL": "https://github.com/apple/swift-nio-transport-services.git", + "state": { + "branch": null, + "revision": "39587bceccda72780e2a8a8c5e857e42a9df2fa8", + "version": "1.11.0" + } + }, + { + "package": "SwiftProtobuf", + "repositoryURL": "https://github.com/apple/swift-protobuf.git", + "state": { + "branch": null, + "revision": "1f62db409f2c9b0223a3f68567b4a01333aae778", + "version": "1.17.0" + } + }, + { + "package": "SwiftPrometheus", + "repositoryURL": "https://github.com/MrLotU/SwiftPrometheus.git", + "state": { + "branch": null, + "revision": "7e0cf8f913ed4353462bd4ad46f1db1b34c28a82", + "version": "1.0.0-alpha.14" + } + }, + { + "package": "vapor", + "repositoryURL": "https://github.com/vapor/vapor.git", + "state": { + "branch": null, + "revision": "5113bfcb0dbcfaefdc043acd8e161046eb4fbb65", + "version": "4.48.4" + } + }, + { + "package": "vapor-aws-lambda-runtime", + "repositoryURL": "https://github.com/vapor-community/vapor-aws-lambda-runtime.git", + "state": { + "branch": null, + "revision": "610aaed1cdd7ef434ed23bc7006000948a221527", + "version": "0.6.2" + } + }, + { + "package": "websocket-kit", + "repositoryURL": "https://github.com/vapor/websocket-kit.git", + "state": { + "branch": null, + "revision": "d7537b787d37f3877e36b5f1e7cb910f7c401836", + "version": "2.1.4" + } + }, + { + "package": "Yams", + "repositoryURL": "https://github.com/jpsim/Yams.git", + "state": { + "branch": null, + "revision": "9ff1cc9327586db4e0c8f46f064b6a82ec1566fa", + "version": "4.0.6" + } + } + ] + }, + "version": 1 +} diff --git a/Example.xcworkspace/xcshareddata/swiftpm/Package.resolved.license b/Example.xcworkspace/xcshareddata/swiftpm/Package.resolved.license new file mode 100644 index 0000000..829bd43 --- /dev/null +++ b/Example.xcworkspace/xcshareddata/swiftpm/Package.resolved.license @@ -0,0 +1,6 @@ + +This source file is part of the Collector-Analyst-Presenter Example open source project + +SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) + +SPDX-License-Identifier: MIT diff --git a/Gateway/.dockerignore b/Gateway/.dockerignore index e690b13..013d4df 100644 --- a/Gateway/.dockerignore +++ b/Gateway/.dockerignore @@ -1,3 +1,11 @@ +# +# This source file is part of the Collector-Analyst-Presenter Example open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + .build/ .swiftpm/ Package.resolved \ No newline at end of file diff --git a/Gateway/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/Gateway/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 919434a..0000000 --- a/Gateway/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Gateway/.swiftpm/xcode/xcshareddata/xcschemes/GatewayWebService.xcscheme b/Gateway/.swiftpm/xcode/xcshareddata/xcschemes/GatewayWebService.xcscheme deleted file mode 100644 index 44b0e0f..0000000 --- a/Gateway/.swiftpm/xcode/xcshareddata/xcschemes/GatewayWebService.xcscheme +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Gateway/Dockerfile b/Gateway/Dockerfile index c5271dc..bac00b9 100644 --- a/Gateway/Dockerfile +++ b/Gateway/Dockerfile @@ -1,7 +1,15 @@ +# +# This source file is part of the Collector-Analyst-Presenter Example open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + # ================================ # Build image # ================================ -FROM swift:5.4-focal as build +FROM swiftlang/swift:nightly-5.5-focal as build # Install OS updates and, if needed, sqlite3 RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \ @@ -36,7 +44,7 @@ RUN [ -d "$(swift build --package-path /build -c release --show-bin-path)/Gatewa # ================================ # Run image # ================================ -FROM swift:5.4-focal-slim +FROM swiftlang/swift:nightly-5.5-focal-slim as run # Make sure all system packages are up to date. RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \ diff --git a/Gateway/Package.resolved b/Gateway/Package.resolved new file mode 100644 index 0000000..c8f0cf8 --- /dev/null +++ b/Gateway/Package.resolved @@ -0,0 +1,439 @@ +{ + "object": { + "pins": [ + { + "package": "Analyst", + "repositoryURL": "https://github.com/Apodini/Analyst.git", + "state": { + "branch": null, + "revision": "b98dc3472d47115e84704c9169103192c7379703", + "version": "0.1.1" + } + }, + { + "package": "apnswift", + "repositoryURL": "https://github.com/kylebrowning/APNSwift.git", + "state": { + "branch": null, + "revision": "03e83e2332d13a3c06d5cd70948166e5724c43c7", + "version": "3.0.0" + } + }, + { + "package": "Apodini", + "repositoryURL": "https://github.com/Apodini/Apodini.git", + "state": { + "branch": null, + "revision": "e6a943b0db29b2df5c0c139ab993e57752bf22b7", + "version": "0.5.0" + } + }, + { + "package": "ApodiniAnalystPresenter", + "repositoryURL": "https://github.com/Apodini/ApodiniAnalystPresenter.git", + "state": { + "branch": null, + "revision": "d813931e0fc52205669c0a30fe6aad09bdd8ec19", + "version": "0.3.1" + } + }, + { + "package": "ApodiniAsyncHTTPClient", + "repositoryURL": "https://github.com/Apodini/ApodiniAsyncHTTPClient.git", + "state": { + "branch": null, + "revision": "cb387bdf21b8d3ded1e76bd27b3b88d59202d4c1", + "version": "0.3.1" + } + }, + { + "package": "ApodiniCollector", + "repositoryURL": "https://github.com/Apodini/ApodiniCollector.git", + "state": { + "branch": null, + "revision": "fbea06605aa31e4487123ff4ca1ebfbc157d243a", + "version": "0.3.1" + } + }, + { + "package": "AssociatedTypeRequirementsKit", + "repositoryURL": "https://github.com/nerdsupremacist/AssociatedTypeRequirementsKit.git", + "state": { + "branch": null, + "revision": "2e4c49c21ffb2135f1c99fbfcf2119c9d24f5e8c", + "version": "0.3.2" + } + }, + { + "package": "async-http-client", + "repositoryURL": "https://github.com/swift-server/async-http-client.git", + "state": { + "branch": null, + "revision": "8e4d51908dd49272667126403bf977c5c503f78f", + "version": "1.5.0" + } + }, + { + "package": "async-kit", + "repositoryURL": "https://github.com/vapor/async-kit.git", + "state": { + "branch": null, + "revision": "c1de408100a2f2e4ab2ea06512e8635bc1a59144", + "version": "1.3.1" + } + }, + { + "package": "Collector", + "repositoryURL": "https://github.com/Apodini/Collector.git", + "state": { + "branch": null, + "revision": "868eac8c46ffab0e03b29522d0c98fa9bf07fb4f", + "version": "0.1.1" + } + }, + { + "package": "console-kit", + "repositoryURL": "https://github.com/vapor/console-kit.git", + "state": { + "branch": null, + "revision": "75ea3b627d88221440b878e5dfccc73fd06842ed", + "version": "4.2.7" + } + }, + { + "package": "FCM", + "repositoryURL": "https://github.com/MihaelIsaev/FCM.git", + "state": { + "branch": null, + "revision": "5d35a93bde97fd34879bf1f7ca198f4efacd8eca", + "version": "2.11.1" + } + }, + { + "package": "FineJSON", + "repositoryURL": "https://github.com/omochi/FineJSON.git", + "state": { + "branch": null, + "revision": "05101709243cb66d80c92e645210a3b80cf4e17f", + "version": "1.14.0" + } + }, + { + "package": "fluent-kit", + "repositoryURL": "https://github.com/vapor/fluent-kit.git", + "state": { + "branch": null, + "revision": "c0cfc1e6d9a2bbd04d4c583632eb0c09c92ff22c", + "version": "1.15.0" + } + }, + { + "package": "grpc-swift", + "repositoryURL": "https://github.com/grpc/grpc-swift.git", + "state": { + "branch": null, + "revision": "14e1ea3350892a864386517c037e11fb68baf818", + "version": "1.3.0" + } + }, + { + "package": "jmespath.swift", + "repositoryURL": "https://github.com/adam-fowler/jmespath.swift.git", + "state": { + "branch": null, + "revision": "4a166ea71f0d9e9cc3523fc3dee516080a4c36a0", + "version": "1.0.0" + } + }, + { + "package": "jwt", + "repositoryURL": "https://github.com/vapor/jwt.git", + "state": { + "branch": null, + "revision": "46eddb526fa70fd9d765a3bdffac73b2be487cfc", + "version": "4.0.0" + } + }, + { + "package": "jwt-kit", + "repositoryURL": "https://github.com/vapor/jwt-kit.git", + "state": { + "branch": null, + "revision": "7a9a04df93e71de10fa2e8d6e9430dd0a7924643", + "version": "4.2.4" + } + }, + { + "package": "multipart-kit", + "repositoryURL": "https://github.com/vapor/multipart-kit.git", + "state": { + "branch": null, + "revision": "c9ea04017b7fb3b1f034ad7a77f8e53d3e080be5", + "version": "4.2.1" + } + }, + { + "package": "OpenAPIKit", + "repositoryURL": "https://github.com/mattpolzin/OpenAPIKit.git", + "state": { + "branch": null, + "revision": "4986552e76c331a99770428bd2be77ad76068c08", + "version": "2.4.0" + } + }, + { + "package": "Presenter", + "repositoryURL": "https://github.com/Apodini/Presenter.git", + "state": { + "branch": null, + "revision": "ea7630c2c115c72a61f607c574e453470167b925", + "version": "0.1.2" + } + }, + { + "package": "RichJSONParser", + "repositoryURL": "https://github.com/omochi/RichJSONParser.git", + "state": { + "branch": null, + "revision": "263e2ecfe88d0500fa99e4cbc8c948529d335534", + "version": "3.0.0" + } + }, + { + "package": "routing-kit", + "repositoryURL": "https://github.com/vapor/routing-kit.git", + "state": { + "branch": null, + "revision": "a0801a36a6ad501d5ad6285cbcd4774de6b0a734", + "version": "4.3.0" + } + }, + { + "package": "Runtime", + "repositoryURL": "https://github.com/Supereg/Runtime.git", + "state": { + "branch": null, + "revision": "596e22a518bb3f8177cd796cd77e5386098a33f8", + "version": "2.2.3" + } + }, + { + "package": "soto", + "repositoryURL": "https://github.com/soto-project/soto.git", + "state": { + "branch": null, + "revision": "693fc693b580a2c635c1457d09cbf54411691ffe", + "version": "5.7.0" + } + }, + { + "package": "soto-core", + "repositoryURL": "https://github.com/soto-project/soto-core.git", + "state": { + "branch": null, + "revision": "98c7f11f9e66480984340950e7d0241c7456ac8e", + "version": "5.5.0" + } + }, + { + "package": "soto-s3-file-transfer", + "repositoryURL": "https://github.com/soto-project/soto-s3-file-transfer", + "state": { + "branch": null, + "revision": "14814e5894991705b2cc122c694bf0b3931f2c02", + "version": "0.3.1" + } + }, + { + "package": "sql-kit", + "repositoryURL": "https://github.com/vapor/sql-kit.git", + "state": { + "branch": null, + "revision": "b70d1fea1b544dd819c17e83d59fb9aa85c81e74", + "version": "3.10.0" + } + }, + { + "package": "SwifCron", + "repositoryURL": "https://github.com/MihaelIsaev/SwifCron.git", + "state": { + "branch": null, + "revision": "effe20321342705e66894d86720c5882e2f4095e", + "version": "1.3.1" + } + }, + { + "package": "swift-argument-parser", + "repositoryURL": "https://github.com/apple/swift-argument-parser", + "state": { + "branch": null, + "revision": "83b23d940471b313427da226196661856f6ba3e0", + "version": "0.4.4" + } + }, + { + "package": "swift-aws-lambda-runtime", + "repositoryURL": "https://github.com/swift-server/swift-aws-lambda-runtime.git", + "state": { + "branch": null, + "revision": "a9e15b13b30b6700056c4cfbdcf6a69382a9fb6f", + "version": "0.5.0" + } + }, + { + "package": "swift-backtrace", + "repositoryURL": "https://github.com/swift-server/swift-backtrace.git", + "state": { + "branch": null, + "revision": "d3e04a9d4b3833363fb6192065b763310b156d54", + "version": "1.3.1" + } + }, + { + "package": "swift-collections", + "repositoryURL": "https://github.com/apple/swift-collections", + "state": { + "branch": null, + "revision": "9d8719c8bebdc79740b6969c912ac706eb721d7a", + "version": "0.0.7" + } + }, + { + "package": "swift-crypto", + "repositoryURL": "https://github.com/apple/swift-crypto.git", + "state": { + "branch": null, + "revision": "3bea268b223651c4ab7b7b9ad62ef9b2d4143eb6", + "version": "1.1.6" + } + }, + { + "package": "swift-extras-base64", + "repositoryURL": "https://github.com/swift-extras/swift-extras-base64", + "state": { + "branch": null, + "revision": "97237cf1bc1feebaeb0febec91c1e1b9e4d839b3", + "version": "0.7.0" + } + }, + { + "package": "swift-log", + "repositoryURL": "https://github.com/apple/swift-log.git", + "state": { + "branch": null, + "revision": "5d66f7ba25daf4f94100e7022febf3c75e37a6c7", + "version": "1.4.2" + } + }, + { + "package": "swift-metrics", + "repositoryURL": "https://github.com/apple/swift-metrics.git", + "state": { + "branch": null, + "revision": "3edd2f57afc4e68e23c3e4956bc8b65ca6b5b2ff", + "version": "2.2.0" + } + }, + { + "package": "swift-nio", + "repositoryURL": "https://github.com/apple/swift-nio.git", + "state": { + "branch": null, + "revision": "9a992ee3de1f8da9f2968fc96b26714834f3105f", + "version": "2.31.1" + } + }, + { + "package": "swift-nio-extras", + "repositoryURL": "https://github.com/apple/swift-nio-extras.git", + "state": { + "branch": null, + "revision": "f72c4688f89c28502105509186eadc49a49cb922", + "version": "1.10.0" + } + }, + { + "package": "swift-nio-http2", + "repositoryURL": "https://github.com/apple/swift-nio-http2.git", + "state": { + "branch": null, + "revision": "f6cde03ef8ad57e3bd25743d1e678efd1e5239f7", + "version": "1.18.1" + } + }, + { + "package": "swift-nio-ssl", + "repositoryURL": "https://github.com/apple/swift-nio-ssl.git", + "state": { + "branch": null, + "revision": "4829979d9f5ed9a2f4c6efd9c1ed51d1ab4d0394", + "version": "2.14.1" + } + }, + { + "package": "swift-nio-transport-services", + "repositoryURL": "https://github.com/apple/swift-nio-transport-services.git", + "state": { + "branch": null, + "revision": "39587bceccda72780e2a8a8c5e857e42a9df2fa8", + "version": "1.11.0" + } + }, + { + "package": "SwiftProtobuf", + "repositoryURL": "https://github.com/apple/swift-protobuf.git", + "state": { + "branch": null, + "revision": "1f62db409f2c9b0223a3f68567b4a01333aae778", + "version": "1.17.0" + } + }, + { + "package": "SwiftPrometheus", + "repositoryURL": "https://github.com/MrLotU/SwiftPrometheus.git", + "state": { + "branch": null, + "revision": "7e0cf8f913ed4353462bd4ad46f1db1b34c28a82", + "version": "1.0.0-alpha.14" + } + }, + { + "package": "vapor", + "repositoryURL": "https://github.com/vapor/vapor.git", + "state": { + "branch": null, + "revision": "5113bfcb0dbcfaefdc043acd8e161046eb4fbb65", + "version": "4.48.4" + } + }, + { + "package": "vapor-aws-lambda-runtime", + "repositoryURL": "https://github.com/vapor-community/vapor-aws-lambda-runtime.git", + "state": { + "branch": null, + "revision": "610aaed1cdd7ef434ed23bc7006000948a221527", + "version": "0.6.2" + } + }, + { + "package": "websocket-kit", + "repositoryURL": "https://github.com/vapor/websocket-kit.git", + "state": { + "branch": null, + "revision": "d7537b787d37f3877e36b5f1e7cb910f7c401836", + "version": "2.1.4" + } + }, + { + "package": "Yams", + "repositoryURL": "https://github.com/jpsim/Yams.git", + "state": { + "branch": null, + "revision": "9ff1cc9327586db4e0c8f46f064b6a82ec1566fa", + "version": "4.0.6" + } + } + ] + }, + "version": 1 +} diff --git a/Gateway/Package.resolved.license b/Gateway/Package.resolved.license new file mode 100644 index 0000000..829bd43 --- /dev/null +++ b/Gateway/Package.resolved.license @@ -0,0 +1,6 @@ + +This source file is part of the Collector-Analyst-Presenter Example open source project + +SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) + +SPDX-License-Identifier: MIT diff --git a/Gateway/Package.swift b/Gateway/Package.swift index 9fd06e6..93011de 100644 --- a/Gateway/Package.swift +++ b/Gateway/Package.swift @@ -1,4 +1,12 @@ -// swift-tools-version:5.4 +// swift-tools-version:5.5 + +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// import PackageDescription @@ -6,7 +14,7 @@ import PackageDescription let package = Package( name: "GatewayWebService", platforms: [ - .macOS(.v10_15) + .macOS(.v12) ], products: [ .executable( @@ -15,10 +23,10 @@ let package = Package( ) ], dependencies: [ - .package(url: "https://github.com/Apodini/Apodini.git", .upToNextMinor(from: "0.3.0")), - .package(url: "https://github.com/Apodini/ApodiniAsyncHTTPClient.git", .upToNextMinor(from: "0.2.0")), - .package(url: "https://github.com/Apodini/ApodiniCollector.git", .upToNextMinor(from: "0.2.0")), - .package(url: "https://github.com/Apodini/ApodiniAnalystPresenter.git", .upToNextMinor(from: "0.2.0")) + .package(url: "https://github.com/Apodini/Apodini.git", .upToNextMinor(from: "0.5.0")), + .package(url: "https://github.com/Apodini/ApodiniAsyncHTTPClient.git", .upToNextMinor(from: "0.3.1")), + .package(url: "https://github.com/Apodini/ApodiniCollector.git", .upToNextMinor(from: "0.3.1")), + .package(url: "https://github.com/Apodini/ApodiniAnalystPresenter.git", .upToNextMinor(from: "0.3.1")) ], targets: [ .executableTarget( diff --git a/Gateway/Sources/GatewayWebService/ConnectionService/Coordinate.swift b/Gateway/Sources/GatewayWebService/ConnectionService/Coordinate.swift index b977b40..fa1efb2 100644 --- a/Gateway/Sources/GatewayWebService/ConnectionService/Coordinate.swift +++ b/Gateway/Sources/GatewayWebService/ConnectionService/Coordinate.swift @@ -1,3 +1,11 @@ +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import Apodini diff --git a/Gateway/Sources/GatewayWebService/ConnectionService/RemoteConnectionService.swift b/Gateway/Sources/GatewayWebService/ConnectionService/RemoteConnectionService.swift index 7280e72..edcda75 100644 --- a/Gateway/Sources/GatewayWebService/ConnectionService/RemoteConnectionService.swift +++ b/Gateway/Sources/GatewayWebService/ConnectionService/RemoteConnectionService.swift @@ -1,6 +1,14 @@ +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import Apodini -import Collector import AsyncHTTPClient +import Collector import NIOHTTP1 diff --git a/Gateway/Sources/GatewayWebService/Extensions/EventLoopFuture+Combine.swift b/Gateway/Sources/GatewayWebService/Extensions/EventLoopFuture+Combine.swift index eec3abd..3e10027 100644 --- a/Gateway/Sources/GatewayWebService/Extensions/EventLoopFuture+Combine.swift +++ b/Gateway/Sources/GatewayWebService/Extensions/EventLoopFuture+Combine.swift @@ -1,3 +1,11 @@ +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import NIO diff --git a/Gateway/Sources/GatewayWebService/Extensions/URL+ExpressibleByArgument.swift b/Gateway/Sources/GatewayWebService/Extensions/URL+ExpressibleByArgument.swift index 656348b..0f61750 100644 --- a/Gateway/Sources/GatewayWebService/Extensions/URL+ExpressibleByArgument.swift +++ b/Gateway/Sources/GatewayWebService/Extensions/URL+ExpressibleByArgument.swift @@ -1,3 +1,11 @@ +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import ArgumentParser import Foundation diff --git a/Gateway/Sources/GatewayWebService/GatewayWebService.swift b/Gateway/Sources/GatewayWebService/GatewayWebService.swift index 693bf63..91e05e1 100644 --- a/Gateway/Sources/GatewayWebService/GatewayWebService.swift +++ b/Gateway/Sources/GatewayWebService/GatewayWebService.swift @@ -1,3 +1,11 @@ +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import Apodini import ApodiniAnalystPresenter import ApodiniCollector diff --git a/Gateway/Sources/GatewayWebService/Handler/CreateUserLocationHandler.swift b/Gateway/Sources/GatewayWebService/Handler/CreateUserLocationHandler.swift index 427623f..7a5fc74 100644 --- a/Gateway/Sources/GatewayWebService/Handler/CreateUserLocationHandler.swift +++ b/Gateway/Sources/GatewayWebService/Handler/CreateUserLocationHandler.swift @@ -1,3 +1,11 @@ +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import Apodini import ApodiniCollector diff --git a/Gateway/Sources/GatewayWebService/Handler/ReadHotsportsHandler.swift b/Gateway/Sources/GatewayWebService/Handler/ReadHotsportsHandler.swift index b4590b9..464a1fc 100644 --- a/Gateway/Sources/GatewayWebService/Handler/ReadHotsportsHandler.swift +++ b/Gateway/Sources/GatewayWebService/Handler/ReadHotsportsHandler.swift @@ -1,3 +1,11 @@ +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import Apodini import ApodiniCollector diff --git a/Gateway/Sources/GatewayWebService/Jobs/MetricsJob.swift b/Gateway/Sources/GatewayWebService/Jobs/MetricsJob.swift index f956ee2..3eb9f88 100644 --- a/Gateway/Sources/GatewayWebService/Jobs/MetricsJob.swift +++ b/Gateway/Sources/GatewayWebService/Jobs/MetricsJob.swift @@ -1,3 +1,11 @@ +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import Apodini import ApodiniJobs import Collector diff --git a/Gateway/Sources/GatewayWebService/MetricsService/Analyst+Extensions.swift b/Gateway/Sources/GatewayWebService/MetricsService/Analyst+Extensions.swift index bcbfe06..22ace49 100644 --- a/Gateway/Sources/GatewayWebService/MetricsService/Analyst+Extensions.swift +++ b/Gateway/Sources/GatewayWebService/MetricsService/Analyst+Extensions.swift @@ -1,3 +1,11 @@ +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import Analyst diff --git a/Gateway/Sources/GatewayWebService/MetricsService/GatewayPresenterService.swift b/Gateway/Sources/GatewayWebService/MetricsService/GatewayPresenterService.swift index e230dbc..db50c37 100644 --- a/Gateway/Sources/GatewayWebService/MetricsService/GatewayPresenterService.swift +++ b/Gateway/Sources/GatewayWebService/MetricsService/GatewayPresenterService.swift @@ -1,8 +1,16 @@ +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import Apodini -import AsyncHTTPClient import ApodiniAnalystPresenter -import PrometheusAnalyst +import AsyncHTTPClient import JaegerAnalyst +import PrometheusAnalyst final class GatewayPresenterService: PresenterService { @@ -16,19 +24,21 @@ final class GatewayPresenterService: PresenterService { var eventLoop: EventLoop { client.eventLoopGroup.next() } - var view: ViewFuture { - do { - return try listView() - } catch { - return eventLoop.makeFailedFuture(ApodiniError(type: .serverError, reason: "Could not generate Presenter UI.")) + var view: _CodableView { // swiftlint:disable all + get async throws { // We disable all SwiftLint lint rules for this section as SwiftLint wrogfully triggers a few rules here. + do { + return try await listView() + } catch { + return Text("Could not generate Presenter UI: \(error)") + } } } - var encodedView: EventLoopFuture { - view.flatMapThrowing { - let data = try Presenter.encode(CoderView($0)) + var encodedView: Blob { + get async throws { // swiftlint:disable:this implicit_getter + let data = try Presenter.encode(CoderView(try await view)) return Blob(data, type: .application(.json)) } - } + } // swiftlint:enable all init( @@ -61,12 +71,12 @@ final class GatewayPresenterService: PresenterService { // MARK: Nested Types - private func listView() throws -> ViewFuture { - EventLoopFuture<(_CodableView, _CodableView, _CodableView)> - .combine(try gateway(), try database(), try processing()) - .map { - self.listView(gateway: $0, database: $1, processing: $2) - } + private func listView() async throws -> _CodableView { + async let gateway = gateway() + async let database = database() + async let processing = processing() + + return try await self.listView(gateway: gateway, database: database, processing: processing) } private func listView(gateway: _CodableView, database: _CodableView, processing: _CodableView) -> some View { @@ -97,36 +107,35 @@ final class GatewayPresenterService: PresenterService { } } - private func database() throws -> ViewFuture { - client - .execute(request: try HTTPClient.Request(url: databaseURL.appendingPathComponent("/v1/metrics-ui"))) - .map { response in - guard let body = response.body else { - return Text(.static("Database UI could not be loaded")) - } - return DataView(.init(buffer: body)) - } - .flatMapError { _ in - self.eventLoop.future(Text(.static("Error"))) + private func database() async -> _CodableView { + do { + let response = try await client.execute(request: try HTTPClient.Request(url: databaseURL.appendingPathComponent("/v1/metrics-ui"))).get() + + guard let body = response.body else { + return Text(.static("Database UI could not be loaded")) } + return DataView(.init(buffer: body)) + } catch { + return Text(.static("Error")) + } } - private func processing() throws -> ViewFuture { - client - .execute(request: try HTTPClient.Request(url: processingURL.appendingPathComponent("/v1/metrics-ui"))) - .map { response in - guard let body = response.body else { - return Text(.static("Processing UI could not be loaded")) - } - return DataView(.init(buffer: body)) - } - .flatMapError { _ in - self.eventLoop.future(Text(.static("Error"))) + private func processing() async -> _CodableView { + do { + let response = try await client.execute(request: try HTTPClient.Request(url: processingURL.appendingPathComponent("/v1/metrics-ui"))) + .get() + + guard let body = response.body else { + return Text(.static("Processing UI could not be loaded")) } + return DataView(.init(buffer: body)) + } catch { + return Text(.static("Error")) + } } - private func gateway() throws -> ViewFuture { - service(title: "Gateway", cards: [ + private func gateway() async throws -> _CodableView { + try await service(title: "Gateway", cards: [ metricsCounterGraph(label: "location_usage", title: "Location Usage"), metricsCounterGraph(label: "hotspots_usage", title: "Hotspots Usage"), periodicTaskDuration(), @@ -135,11 +144,11 @@ final class GatewayPresenterService: PresenterService { ]) } - private func periodicTaskDuration() -> ViewFuture { + private func periodicTaskDuration() async throws -> _CodableView { let timer = Timer(label: "gateway_periodic_task_duration") let range = TimeRange.range(.days(3), step: .hours(1)) let query = timer.query(scalar: .delta(timer[range.step])) - return graph(for: query.in(range), title: "Periodic Task Duration") + return try await graph(for: query.in(range), title: "Periodic Task Duration") } private func list( @@ -169,28 +178,24 @@ final class GatewayPresenterService: PresenterService { .padding(8) } - private func lastTraces() throws -> ViewFuture { - traceProvider.traces(for: TraceQuery(service: "gateway", maxCount: 10)) - .map { traces in - VStack { - traces.map { trace in - self.traceView(for: trace) - } - } + private func lastTraces() async throws -> _CodableView { + let traces = try await traceProvider.traces(for: TraceQuery(service: "gateway", maxCount: 10)).get() + return VStack { + traces.map { trace in + self.traceView(for: trace) } + } } - private func dependencies() throws -> ViewFuture { + private func dependencies() async throws -> _CodableView { let startDate = Date().addingTimeInterval(-24 * 60 * 60) - return traceProvider - .dependencies(from: startDate) - .map { dependencies in - VStack { - dependencies.map { dependency in - Text(.static(dependency.parent + " -\(dependency.callCount)-> " + dependency.child)) - } - } + let dependencies = try await traceProvider.dependencies(from: startDate).get() + + return VStack { + dependencies.map { dependency in + Text(.static(dependency.parent + " -\(dependency.callCount)-> " + dependency.child)) } + } } private func traceView(for trace: Trace) -> some View { @@ -224,18 +229,15 @@ final class GatewayPresenterService: PresenterService { } } - private func service(title: String, cards: [ViewFuture]) -> ViewFuture { - EventLoopFuture.whenAllSucceed(cards, on: eventLoop) - .map { cards in - ScrollView { - VStack { - cards - }.padding(8) - }.navigationBarTitle(.static(title)) - } + private func service(title: String, cards: [_CodableView]) -> _CodableView { + ScrollView { + VStack { + cards + }.padding(8) + }.navigationBarTitle(.static(title)) } - private func metricsCounterGraph(label: String, title: String? = nil) -> ViewFuture { + private func metricsCounterGraph(label: String, title: String? = nil) async throws -> _CodableView { let counter = Counter( label: label, dimensions: ["job": "gateway"] @@ -243,21 +245,17 @@ final class GatewayPresenterService: PresenterService { let range = TimeRange.range(.days(3), step: .hours(1)) let query = counter.query(scalar: .delta(counter[range.step])) - return graph(for: query.in(range), title: title ?? label) + return try await graph(for: query.in(range), title: title ?? label) } - private func graph(for query: RangeQuery, title: String? = nil) -> ViewFuture { - metricsProvider.results(for: query) - .map { - self.view(for: $0, title: title ?? query.label) - } + private func graph(for query: RangeQuery, title: String? = nil) async throws -> _CodableView { + let results = try await metricsProvider.results(for: query).get() + return self.view(for: results, title: title ?? query.label) } - private func graph(for query: RangeQuery, title: String? = nil) -> ViewFuture { - metricsProvider.results(for: query) - .map { - self.view(for: $0, title: title ?? query.label) - } + private func graph(for query: RangeQuery, title: String? = nil) async throws -> _CodableView { + let results = try await metricsProvider.results(for: query).get() + return self.view(for: results, title: title ?? query.label) } private func view(for results: [RangeResult], title: String) -> some View { diff --git a/Gateway/Tests/GatewayWebServiceTests/AppTests.swift b/Gateway/Tests/GatewayWebServiceTests/AppTests.swift index eb6f88b..b3c1d17 100644 --- a/Gateway/Tests/GatewayWebServiceTests/AppTests.swift +++ b/Gateway/Tests/GatewayWebServiceTests/AppTests.swift @@ -1,3 +1,11 @@ +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import XCTest diff --git a/Gateway/prometheus-development.yml b/Gateway/prometheus-development.yml index 2e45958..5489b54 100644 --- a/Gateway/prometheus-development.yml +++ b/Gateway/prometheus-development.yml @@ -1,3 +1,11 @@ +# +# This source file is part of the Collector-Analyst-Presenter Example open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + global: scrape_interval: 15s scrape_timeout: 10s diff --git a/Gateway/prometheus.yml b/Gateway/prometheus.yml index 21678d4..9307be5 100644 --- a/Gateway/prometheus.yml +++ b/Gateway/prometheus.yml @@ -1,3 +1,11 @@ +# +# This source file is part of the Collector-Analyst-Presenter Example open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + global: scrape_interval: 15s scrape_timeout: 10s diff --git a/LICENSE b/LICENSES/MIT.txt similarity index 92% rename from LICENSE rename to LICENSES/MIT.txt index 56b2787..4b2cb50 100644 --- a/LICENSE +++ b/LICENSES/MIT.txt @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2021 Paul Schmiedmayer & Paul Kraft +Copyright (c) 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Processing/.dockerignore b/Processing/.dockerignore index e690b13..013d4df 100644 --- a/Processing/.dockerignore +++ b/Processing/.dockerignore @@ -1,3 +1,11 @@ +# +# This source file is part of the Collector-Analyst-Presenter Example open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + .build/ .swiftpm/ Package.resolved \ No newline at end of file diff --git a/Processing/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/Processing/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 919434a..0000000 --- a/Processing/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Processing/.swiftpm/xcode/xcshareddata/xcschemes/ProcessingWebService.xcscheme b/Processing/.swiftpm/xcode/xcshareddata/xcschemes/ProcessingWebService.xcscheme deleted file mode 100644 index dc654ee..0000000 --- a/Processing/.swiftpm/xcode/xcshareddata/xcschemes/ProcessingWebService.xcscheme +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Processing/Dockerfile b/Processing/Dockerfile index fea030e..1c13c2b 100644 --- a/Processing/Dockerfile +++ b/Processing/Dockerfile @@ -1,7 +1,15 @@ +# +# This source file is part of the Collector-Analyst-Presenter Example open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + # ================================ # Build image -# ================================ -FROM swift:5.4-focal as build +# =============================== +FROM swiftlang/swift:nightly-5.5-focal as build # Install OS updates and, if needed, sqlite3 RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \ @@ -35,7 +43,7 @@ RUN [ -d "$(swift build --package-path /build -c release --show-bin-path)/Proces # ================================ # Run image # ================================ -FROM swift:5.4-focal-slim +FROM swiftlang/swift:nightly-5.5-focal-slim as run # Make sure all system packages are up to date. RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \ diff --git a/Processing/Package.resolved b/Processing/Package.resolved new file mode 100644 index 0000000..798ca6f --- /dev/null +++ b/Processing/Package.resolved @@ -0,0 +1,448 @@ +{ + "object": { + "pins": [ + { + "package": "Analyst", + "repositoryURL": "https://github.com/Apodini/Analyst.git", + "state": { + "branch": null, + "revision": "b98dc3472d47115e84704c9169103192c7379703", + "version": "0.1.1" + } + }, + { + "package": "apnswift", + "repositoryURL": "https://github.com/kylebrowning/APNSwift.git", + "state": { + "branch": null, + "revision": "03e83e2332d13a3c06d5cd70948166e5724c43c7", + "version": "3.0.0" + } + }, + { + "package": "Apodini", + "repositoryURL": "https://github.com/Apodini/Apodini.git", + "state": { + "branch": null, + "revision": "e6a943b0db29b2df5c0c139ab993e57752bf22b7", + "version": "0.5.0" + } + }, + { + "package": "ApodiniAnalystPresenter", + "repositoryURL": "https://github.com/Apodini/ApodiniAnalystPresenter.git", + "state": { + "branch": null, + "revision": "d813931e0fc52205669c0a30fe6aad09bdd8ec19", + "version": "0.3.1" + } + }, + { + "package": "ApodiniAsyncHTTPClient", + "repositoryURL": "https://github.com/Apodini/ApodiniAsyncHTTPClient.git", + "state": { + "branch": null, + "revision": "cb387bdf21b8d3ded1e76bd27b3b88d59202d4c1", + "version": "0.3.1" + } + }, + { + "package": "ApodiniCollector", + "repositoryURL": "https://github.com/Apodini/ApodiniCollector.git", + "state": { + "branch": null, + "revision": "fbea06605aa31e4487123ff4ca1ebfbc157d243a", + "version": "0.3.1" + } + }, + { + "package": "AssociatedTypeRequirementsKit", + "repositoryURL": "https://github.com/nerdsupremacist/AssociatedTypeRequirementsKit.git", + "state": { + "branch": null, + "revision": "2e4c49c21ffb2135f1c99fbfcf2119c9d24f5e8c", + "version": "0.3.2" + } + }, + { + "package": "async-http-client", + "repositoryURL": "https://github.com/swift-server/async-http-client.git", + "state": { + "branch": null, + "revision": "8e4d51908dd49272667126403bf977c5c503f78f", + "version": "1.5.0" + } + }, + { + "package": "async-kit", + "repositoryURL": "https://github.com/vapor/async-kit.git", + "state": { + "branch": null, + "revision": "c1de408100a2f2e4ab2ea06512e8635bc1a59144", + "version": "1.3.1" + } + }, + { + "package": "Collector", + "repositoryURL": "https://github.com/Apodini/Collector.git", + "state": { + "branch": null, + "revision": "868eac8c46ffab0e03b29522d0c98fa9bf07fb4f", + "version": "0.1.1" + } + }, + { + "package": "console-kit", + "repositoryURL": "https://github.com/vapor/console-kit.git", + "state": { + "branch": null, + "revision": "75ea3b627d88221440b878e5dfccc73fd06842ed", + "version": "4.2.7" + } + }, + { + "package": "DBSCAN", + "repositoryURL": "https://github.com/NSHipster/DBSCAN", + "state": { + "branch": null, + "revision": "c99186151c1ab227588d27032146140ddc9b4f24", + "version": "0.0.1" + } + }, + { + "package": "FCM", + "repositoryURL": "https://github.com/MihaelIsaev/FCM.git", + "state": { + "branch": null, + "revision": "5d35a93bde97fd34879bf1f7ca198f4efacd8eca", + "version": "2.11.1" + } + }, + { + "package": "FineJSON", + "repositoryURL": "https://github.com/omochi/FineJSON.git", + "state": { + "branch": null, + "revision": "05101709243cb66d80c92e645210a3b80cf4e17f", + "version": "1.14.0" + } + }, + { + "package": "fluent-kit", + "repositoryURL": "https://github.com/vapor/fluent-kit.git", + "state": { + "branch": null, + "revision": "c0cfc1e6d9a2bbd04d4c583632eb0c09c92ff22c", + "version": "1.15.0" + } + }, + { + "package": "grpc-swift", + "repositoryURL": "https://github.com/grpc/grpc-swift.git", + "state": { + "branch": null, + "revision": "14e1ea3350892a864386517c037e11fb68baf818", + "version": "1.3.0" + } + }, + { + "package": "jmespath.swift", + "repositoryURL": "https://github.com/adam-fowler/jmespath.swift.git", + "state": { + "branch": null, + "revision": "4a166ea71f0d9e9cc3523fc3dee516080a4c36a0", + "version": "1.0.0" + } + }, + { + "package": "jwt", + "repositoryURL": "https://github.com/vapor/jwt.git", + "state": { + "branch": null, + "revision": "46eddb526fa70fd9d765a3bdffac73b2be487cfc", + "version": "4.0.0" + } + }, + { + "package": "jwt-kit", + "repositoryURL": "https://github.com/vapor/jwt-kit.git", + "state": { + "branch": null, + "revision": "7a9a04df93e71de10fa2e8d6e9430dd0a7924643", + "version": "4.2.4" + } + }, + { + "package": "multipart-kit", + "repositoryURL": "https://github.com/vapor/multipart-kit.git", + "state": { + "branch": null, + "revision": "c9ea04017b7fb3b1f034ad7a77f8e53d3e080be5", + "version": "4.2.1" + } + }, + { + "package": "OpenAPIKit", + "repositoryURL": "https://github.com/mattpolzin/OpenAPIKit.git", + "state": { + "branch": null, + "revision": "4986552e76c331a99770428bd2be77ad76068c08", + "version": "2.4.0" + } + }, + { + "package": "Presenter", + "repositoryURL": "https://github.com/Apodini/Presenter.git", + "state": { + "branch": null, + "revision": "ea7630c2c115c72a61f607c574e453470167b925", + "version": "0.1.2" + } + }, + { + "package": "RichJSONParser", + "repositoryURL": "https://github.com/omochi/RichJSONParser.git", + "state": { + "branch": null, + "revision": "263e2ecfe88d0500fa99e4cbc8c948529d335534", + "version": "3.0.0" + } + }, + { + "package": "routing-kit", + "repositoryURL": "https://github.com/vapor/routing-kit.git", + "state": { + "branch": null, + "revision": "a0801a36a6ad501d5ad6285cbcd4774de6b0a734", + "version": "4.3.0" + } + }, + { + "package": "Runtime", + "repositoryURL": "https://github.com/Supereg/Runtime.git", + "state": { + "branch": null, + "revision": "596e22a518bb3f8177cd796cd77e5386098a33f8", + "version": "2.2.3" + } + }, + { + "package": "soto", + "repositoryURL": "https://github.com/soto-project/soto.git", + "state": { + "branch": null, + "revision": "693fc693b580a2c635c1457d09cbf54411691ffe", + "version": "5.7.0" + } + }, + { + "package": "soto-core", + "repositoryURL": "https://github.com/soto-project/soto-core.git", + "state": { + "branch": null, + "revision": "98c7f11f9e66480984340950e7d0241c7456ac8e", + "version": "5.5.0" + } + }, + { + "package": "soto-s3-file-transfer", + "repositoryURL": "https://github.com/soto-project/soto-s3-file-transfer", + "state": { + "branch": null, + "revision": "14814e5894991705b2cc122c694bf0b3931f2c02", + "version": "0.3.1" + } + }, + { + "package": "sql-kit", + "repositoryURL": "https://github.com/vapor/sql-kit.git", + "state": { + "branch": null, + "revision": "b70d1fea1b544dd819c17e83d59fb9aa85c81e74", + "version": "3.10.0" + } + }, + { + "package": "SwifCron", + "repositoryURL": "https://github.com/MihaelIsaev/SwifCron.git", + "state": { + "branch": null, + "revision": "effe20321342705e66894d86720c5882e2f4095e", + "version": "1.3.1" + } + }, + { + "package": "swift-argument-parser", + "repositoryURL": "https://github.com/apple/swift-argument-parser", + "state": { + "branch": null, + "revision": "83b23d940471b313427da226196661856f6ba3e0", + "version": "0.4.4" + } + }, + { + "package": "swift-aws-lambda-runtime", + "repositoryURL": "https://github.com/swift-server/swift-aws-lambda-runtime.git", + "state": { + "branch": null, + "revision": "a9e15b13b30b6700056c4cfbdcf6a69382a9fb6f", + "version": "0.5.0" + } + }, + { + "package": "swift-backtrace", + "repositoryURL": "https://github.com/swift-server/swift-backtrace.git", + "state": { + "branch": null, + "revision": "d3e04a9d4b3833363fb6192065b763310b156d54", + "version": "1.3.1" + } + }, + { + "package": "swift-collections", + "repositoryURL": "https://github.com/apple/swift-collections", + "state": { + "branch": null, + "revision": "9d8719c8bebdc79740b6969c912ac706eb721d7a", + "version": "0.0.7" + } + }, + { + "package": "swift-crypto", + "repositoryURL": "https://github.com/apple/swift-crypto.git", + "state": { + "branch": null, + "revision": "3bea268b223651c4ab7b7b9ad62ef9b2d4143eb6", + "version": "1.1.6" + } + }, + { + "package": "swift-extras-base64", + "repositoryURL": "https://github.com/swift-extras/swift-extras-base64", + "state": { + "branch": null, + "revision": "97237cf1bc1feebaeb0febec91c1e1b9e4d839b3", + "version": "0.7.0" + } + }, + { + "package": "swift-log", + "repositoryURL": "https://github.com/apple/swift-log.git", + "state": { + "branch": null, + "revision": "5d66f7ba25daf4f94100e7022febf3c75e37a6c7", + "version": "1.4.2" + } + }, + { + "package": "swift-metrics", + "repositoryURL": "https://github.com/apple/swift-metrics.git", + "state": { + "branch": null, + "revision": "3edd2f57afc4e68e23c3e4956bc8b65ca6b5b2ff", + "version": "2.2.0" + } + }, + { + "package": "swift-nio", + "repositoryURL": "https://github.com/apple/swift-nio.git", + "state": { + "branch": null, + "revision": "9a992ee3de1f8da9f2968fc96b26714834f3105f", + "version": "2.31.1" + } + }, + { + "package": "swift-nio-extras", + "repositoryURL": "https://github.com/apple/swift-nio-extras.git", + "state": { + "branch": null, + "revision": "f72c4688f89c28502105509186eadc49a49cb922", + "version": "1.10.0" + } + }, + { + "package": "swift-nio-http2", + "repositoryURL": "https://github.com/apple/swift-nio-http2.git", + "state": { + "branch": null, + "revision": "f6cde03ef8ad57e3bd25743d1e678efd1e5239f7", + "version": "1.18.1" + } + }, + { + "package": "swift-nio-ssl", + "repositoryURL": "https://github.com/apple/swift-nio-ssl.git", + "state": { + "branch": null, + "revision": "4829979d9f5ed9a2f4c6efd9c1ed51d1ab4d0394", + "version": "2.14.1" + } + }, + { + "package": "swift-nio-transport-services", + "repositoryURL": "https://github.com/apple/swift-nio-transport-services.git", + "state": { + "branch": null, + "revision": "39587bceccda72780e2a8a8c5e857e42a9df2fa8", + "version": "1.11.0" + } + }, + { + "package": "SwiftProtobuf", + "repositoryURL": "https://github.com/apple/swift-protobuf.git", + "state": { + "branch": null, + "revision": "1f62db409f2c9b0223a3f68567b4a01333aae778", + "version": "1.17.0" + } + }, + { + "package": "SwiftPrometheus", + "repositoryURL": "https://github.com/MrLotU/SwiftPrometheus.git", + "state": { + "branch": null, + "revision": "7e0cf8f913ed4353462bd4ad46f1db1b34c28a82", + "version": "1.0.0-alpha.14" + } + }, + { + "package": "vapor", + "repositoryURL": "https://github.com/vapor/vapor.git", + "state": { + "branch": null, + "revision": "5113bfcb0dbcfaefdc043acd8e161046eb4fbb65", + "version": "4.48.4" + } + }, + { + "package": "vapor-aws-lambda-runtime", + "repositoryURL": "https://github.com/vapor-community/vapor-aws-lambda-runtime.git", + "state": { + "branch": null, + "revision": "610aaed1cdd7ef434ed23bc7006000948a221527", + "version": "0.6.2" + } + }, + { + "package": "websocket-kit", + "repositoryURL": "https://github.com/vapor/websocket-kit.git", + "state": { + "branch": null, + "revision": "d7537b787d37f3877e36b5f1e7cb910f7c401836", + "version": "2.1.4" + } + }, + { + "package": "Yams", + "repositoryURL": "https://github.com/jpsim/Yams.git", + "state": { + "branch": null, + "revision": "9ff1cc9327586db4e0c8f46f064b6a82ec1566fa", + "version": "4.0.6" + } + } + ] + }, + "version": 1 +} diff --git a/Processing/Package.resolved.license b/Processing/Package.resolved.license new file mode 100644 index 0000000..829bd43 --- /dev/null +++ b/Processing/Package.resolved.license @@ -0,0 +1,6 @@ + +This source file is part of the Collector-Analyst-Presenter Example open source project + +SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) + +SPDX-License-Identifier: MIT diff --git a/Processing/Package.swift b/Processing/Package.swift index f4e0a40..c067cce 100644 --- a/Processing/Package.swift +++ b/Processing/Package.swift @@ -1,4 +1,12 @@ -// swift-tools-version:5.4 +// swift-tools-version:5.5 + +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// import PackageDescription @@ -6,7 +14,7 @@ import PackageDescription let package = Package( name: "ProcessingWebService", platforms: [ - .macOS(.v10_15) + .macOS(.v12) ], products: [ .executable( @@ -15,11 +23,11 @@ let package = Package( ) ], dependencies: [ - .package(url: "https://github.com/Apodini/Apodini.git", .upToNextMinor(from: "0.3.0")), - .package(url: "https://github.com/Apodini/ApodiniAsyncHTTPClient.git", .upToNextMinor(from: "0.2.0")), + .package(url: "https://github.com/Apodini/Apodini.git", .upToNextMinor(from: "0.5.0")), + .package(url: "https://github.com/Apodini/ApodiniAsyncHTTPClient.git", .upToNextMinor(from: "0.3.1")), .package(url: "https://github.com/NSHipster/DBSCAN", .upToNextMinor(from: "0.0.1")), - .package(url: "https://github.com/Apodini/ApodiniCollector.git", .upToNextMinor(from: "0.2.0")), - .package(url: "https://github.com/Apodini/ApodiniAnalystPresenter.git", .upToNextMinor(from: "0.2.0")) + .package(url: "https://github.com/Apodini/ApodiniCollector.git", .upToNextMinor(from: "0.3.1")), + .package(url: "https://github.com/Apodini/ApodiniAnalystPresenter.git", .upToNextMinor(from: "0.3.1")) ], targets: [ .executableTarget( diff --git a/Processing/Sources/ProcessingWebService/DatabaseService/Coordinate.swift b/Processing/Sources/ProcessingWebService/DatabaseService/Coordinate.swift index f400c07..782eeeb 100644 --- a/Processing/Sources/ProcessingWebService/DatabaseService/Coordinate.swift +++ b/Processing/Sources/ProcessingWebService/DatabaseService/Coordinate.swift @@ -1,5 +1,13 @@ -import Foundation +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import Apodini +import Foundation struct Coordinate: Codable, Equatable, Content { diff --git a/Processing/Sources/ProcessingWebService/DatabaseService/RemoteDatabaseService.swift b/Processing/Sources/ProcessingWebService/DatabaseService/RemoteDatabaseService.swift index 17d1651..de6cdda 100644 --- a/Processing/Sources/ProcessingWebService/DatabaseService/RemoteDatabaseService.swift +++ b/Processing/Sources/ProcessingWebService/DatabaseService/RemoteDatabaseService.swift @@ -1,6 +1,14 @@ +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import Apodini -import ApodiniCollector import ApodiniAsyncHTTPClient +import ApodiniCollector import Foundation protocol DatabaseService { diff --git a/Processing/Sources/ProcessingWebService/Extensions/URL+ExpressibleByArgument.swift b/Processing/Sources/ProcessingWebService/Extensions/URL+ExpressibleByArgument.swift index 656348b..0f61750 100644 --- a/Processing/Sources/ProcessingWebService/Extensions/URL+ExpressibleByArgument.swift +++ b/Processing/Sources/ProcessingWebService/Extensions/URL+ExpressibleByArgument.swift @@ -1,3 +1,11 @@ +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import ArgumentParser import Foundation diff --git a/Processing/Sources/ProcessingWebService/Handler/ReadHotsportsHandler.swift b/Processing/Sources/ProcessingWebService/Handler/ReadHotsportsHandler.swift index a6b25e2..2b8d9eb 100644 --- a/Processing/Sources/ProcessingWebService/Handler/ReadHotsportsHandler.swift +++ b/Processing/Sources/ProcessingWebService/Handler/ReadHotsportsHandler.swift @@ -1,3 +1,11 @@ +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import Apodini import JaegerCollector diff --git a/Processing/Sources/ProcessingWebService/Processing/DefaultProcessingService.swift b/Processing/Sources/ProcessingWebService/Processing/DefaultProcessingService.swift index a59a8db..57fad96 100644 --- a/Processing/Sources/ProcessingWebService/Processing/DefaultProcessingService.swift +++ b/Processing/Sources/ProcessingWebService/Processing/DefaultProcessingService.swift @@ -1,3 +1,11 @@ +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import Apodini import DBSCAN import Foundation @@ -11,9 +19,7 @@ protocol ProcessingService { class DefaultProcessingService: ProcessingService { func hotspots(in locations: [Coordinate]) throws -> [Coordinate] { let scan = DBSCAN(locations) - let (clusters, _) = scan(epsilon: 20, - minimumNumberOfPoints: 10, - distanceFunction: distance) + let (clusters, _) = scan(epsilon: 20, minimumNumberOfPoints: 10, distanceFunction: distance) return clusters.map { content in let latitude = content.reduce(0) { $0 + $1.latitude } / Double(content.count) let longitude = content.reduce(0) { $0 + $1.longitude } / Double(content.count) @@ -21,8 +27,7 @@ class DefaultProcessingService: ProcessingService { } } - private func distance(between first: Coordinate, - and second: Coordinate) -> Double { + private func distance(between first: Coordinate, and second: Coordinate) -> Double { let latitudeDelta = (first.latitude - second.latitude) * 0.00001 let longitudeDelta = (first.longitude - second.longitude) * 0.00001 return sqrt(latitudeDelta * latitudeDelta + longitudeDelta * longitudeDelta) diff --git a/Processing/Sources/ProcessingWebService/ProcessingWebService.swift b/Processing/Sources/ProcessingWebService/ProcessingWebService.swift index d85b6aa..c5e4faa 100644 --- a/Processing/Sources/ProcessingWebService/ProcessingWebService.swift +++ b/Processing/Sources/ProcessingWebService/ProcessingWebService.swift @@ -1,3 +1,11 @@ +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import Apodini import ApodiniAnalystPresenter import ApodiniCollector diff --git a/Processing/Tests/ProcessingWebServiceTests/AppTests.swift b/Processing/Tests/ProcessingWebServiceTests/AppTests.swift index 07545fc..ba2739a 100644 --- a/Processing/Tests/ProcessingWebServiceTests/AppTests.swift +++ b/Processing/Tests/ProcessingWebServiceTests/AppTests.swift @@ -1,3 +1,11 @@ +// +// This source file is part of the Collector-Analyst-Presenter Example open source project +// +// SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +// +// SPDX-License-Identifier: MIT +// + import XCTest diff --git a/Processing/prometheus-development.yml b/Processing/prometheus-development.yml index b657bb9..b8170a0 100644 --- a/Processing/prometheus-development.yml +++ b/Processing/prometheus-development.yml @@ -1,3 +1,11 @@ +# +# This source file is part of the Collector-Analyst-Presenter Example open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + global: scrape_interval: 15s scrape_timeout: 10s diff --git a/Processing/prometheus.yml b/Processing/prometheus.yml index 7b58da2..9ae8cc9 100644 --- a/Processing/prometheus.yml +++ b/Processing/prometheus.yml @@ -1,3 +1,11 @@ +# +# This source file is part of the Collector-Analyst-Presenter Example open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + global: scrape_interval: 15s scrape_timeout: 10s diff --git a/README.md b/README.md index 659fc5a..5fc8cd5 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,13 @@ + + # Collector, Analyst, and Presenter Example System [![DOI](https://zenodo.org/badge/379429348.svg)](https://zenodo.org/badge/latestdoi/379429348) diff --git a/docker-compose-development.yml b/docker-compose-development.yml index 9334596..053c3bc 100644 --- a/docker-compose-development.yml +++ b/docker-compose-development.yml @@ -1,3 +1,11 @@ +# +# This source file is part of the Collector-Analyst-Presenter Example open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + version: "3.9" services: jaeger: diff --git a/docker-compose-locally.yml b/docker-compose-locally.yml index 241fde0..7303dfa 100644 --- a/docker-compose-locally.yml +++ b/docker-compose-locally.yml @@ -1,3 +1,11 @@ +# +# This source file is part of the Collector-Analyst-Presenter Example open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + version: "3.9" services: jaeger: diff --git a/docker-compose.yml b/docker-compose.yml index e3d0deb..5e9a94e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,3 +1,11 @@ +# +# This source file is part of the Collector-Analyst-Presenter Example open source project +# +# SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) +# +# SPDX-License-Identifier: MIT +# + version: "3.9" services: jaeger: