Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Guang1234567 committed Jul 17, 2020
0 parents commit b0f2b7e
Show file tree
Hide file tree
Showing 63 changed files with 2,714 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.build/
.swiftpm/
5 changes: 5 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
HOST_NAME="127.0.0.1"
HOST_PORT=8080

DATABASE_HOST=localhost
DATABASE_NAME=vapor_database_fallback
8 changes: 8 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
HOST_NAME="127.0.0.1"
HOST_PORT=8080

DATABASE_HOST=localhost
DATABASE_NAME=vapor_database_dev

DATABASE_USERNAME=vapor_username_dev
DATABASE_PASSWORD=vapor_password_dev
8 changes: 8 additions & 0 deletions .env.development.custom_name
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
HOST_NAME="127.0.0.1"
HOST_PORT=8080

DATABASE_HOST=localhost
DATABASE_NAME=vapor_database_dev_custom

DATABASE_USERNAME=vapor_username_dev_custom
DATABASE_PASSWORD=vapor_password_dev_custom
5 changes: 5 additions & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
HOST_NAME="www.production.com"
HOST_PORT=8080

DATABASE_HOST=localhost
DATABASE_NAME=vapor_database_prod
5 changes: 5 additions & 0 deletions .env.production.custom_name
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
HOST_NAME="www.production.custom.com"
HOST_PORT=8080

DATABASE_HOST=localhost
DATABASE_NAME=vapor_database_prod_custom
5 changes: 5 additions & 0 deletions .env.staging
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
HOST_NAME="www.staging.com"
HOST_PORT=8080

DATABASE_HOST=localhost
DATABASE_NAME=vapor_database_stag
8 changes: 8 additions & 0 deletions .env.testing
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
HOST_NAME="www.tesing.com"
HOST_PORT=8080

DATABASE_HOST=localhost
DATABASE_NAME=vapor_database_test

DATABASE_USERNAME=vapor_username_test
DATABASE_PASSWORD=vapor_password_test
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Packages
.build
xcuserdata
*.xcodeproj
DerivedData/
.DS_Store
db.sqlite
.swiftpm
.idea
36 changes: 36 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
language: generic
matrix:
include:
- os: osx
osx_image: xcode11.5
env: SCHEME="Run"


before_install:
- gem install xcpretty
- brew tap vapor/tap
- brew update
- brew install vapor


script:
- swift build -Xswiftc -g -c debug
- swift package generate-xcodeproj
- xcodebuild -scheme $SCHEME -enableCodeCoverage YES test | xcpretty


after_success:
- bash <(curl -s https://codecov.io/bash)

#
deploy:
provider: releases
api_key:
secure: Y1fkSiMXxU0wJEZ12PtfuWheTcIFD870iHpCRollKyVjobI50MF0yYWHm8jMtwHCYLKwmf+SZwp/w+emRZ6iho1n5yCo+zPeAcZSc2XCi7pzGzJ5kKvi3Lgh01BduTUI30+LqJ7XNk2HXH61Zl2eBZl4hFn6+Bc5BmCNyue2PKs2gVexpTub7X3abhdCR6frbdtC3lNW2HWiH/j4ccDE6Lmr1WJjFgM2QzoXVc56wWaUlXwOBPAmIG8AZM2nN7wKqV7znMJTNnE+hw7e1vtdLaV4QrNDDkya4f3Z1mgAJCNDQg8sIERvqdAg4NOh3Y090HR5QYHp8WejrvbKg/54KIdTE0L7TzLeYARG2NrqA0o4IezLGvbmlDL6vnwegNhSHp1IK89ZN2he/Tt4t0ONrcyKb7V4N6s5LKxzI24pvAjwG3pdqdO57iXus3CMksxaNW4F9ZaWaObSSi8zqFLqgyx8ZpTjy7zTso8xKyO/+/BpaD1BF8NJCzHKqgQmWbypyo4tNlRtyWsli7Eo2xcrEwTPU07CbYNbUnRfEj5hHc+Or/V0T6hgSnywaNs9crU9bedOn8Xh8myPamV17TGr282f7pwqCyIg+wms13PyhV5inNM7B7qbufXzQnM+Zu3OrBqKEVD7A1H3QxoLLhGJNe3gQKuFjXcC5Y/q68Y0WqQ=
file: ".build/debug/Run"
on:
tags: true
branch: master
repo: Guang1234567/vapor4_auth_template
skip_cleanup: 'true'
draft: true
41 changes: 41 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# ================================
# Build image
# ================================
FROM swift:5.2-bionic as build
WORKDIR /build

# First just resolve dependencies.
# This creates a cached layer that can be reused
# as long as your Package.swift/Package.resolved
# files do not change.
COPY ./Package.* ./
RUN swift package resolve

# Copy entire repo into container
COPY . .

# Compile with optimizations
RUN swift build --enable-test-discovery -c release

# ================================
# Run image
# ================================
FROM swift:5.2-bionic-slim

# Create a vapor user and group with /app as its home directory
RUN useradd --user-group --create-home --system --skel /dev/null --home-dir /app vapor

# Switch to the new home directory
WORKDIR /app

# Copy build artifacts
COPY --from=build --chown=vapor:vapor /build/.build/release /app
# Uncomment the next line if you need to load resources from the `Public` directory
#COPY --from=build --chown=vapor:vapor /build/Public /app/Public

# Ensure all further commands run as the vapor user
USER vapor:vapor

# Start the Vapor service when the image is run, default to listening on 8080 in production environment
ENTRYPOINT ["./Run"]
CMD ["serve", "--env", "production", "--hostname", "0.0.0.0", "--port", "8080"]
223 changes: 223 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
{
"object": {
"pins": [
{
"package": "async-http-client",
"repositoryURL": "https://github.com/swift-server/async-http-client.git",
"state": {
"branch": null,
"revision": "037b70291941fe43de668066eb6fb802c5e181d2",
"version": "1.1.1"
}
},
{
"package": "async-kit",
"repositoryURL": "https://github.com/vapor/async-kit.git",
"state": {
"branch": null,
"revision": "8e2cad80dd9f62f0349a2a78ab8c81fb456f4d4a",
"version": "1.1.1"
}
},
{
"package": "console-kit",
"repositoryURL": "https://github.com/vapor/console-kit.git",
"state": {
"branch": null,
"revision": "05c52a91631a6ca432275439f6456a5dace0d1db",
"version": "4.1.2"
}
},
{
"package": "fluent",
"repositoryURL": "https://github.com/vapor/fluent.git",
"state": {
"branch": null,
"revision": "e681c93df3201a2d8ceef15e8a9a0634578df233",
"version": "4.0.0"
}
},
{
"package": "fluent-kit",
"repositoryURL": "https://github.com/vapor/fluent-kit.git",
"state": {
"branch": null,
"revision": "ad5eef38c5168fdb4b77d5a73794a90e0ce3b9a5",
"version": "1.0.2"
}
},
{
"package": "fluent-postgres-driver",
"repositoryURL": "https://github.com/vapor/fluent-postgres-driver.git",
"state": {
"branch": null,
"revision": "cf8ec53b87606dc799a07a0754a297b32cf9f592",
"version": "2.0.0"
}
},
{
"package": "postgres-kit",
"repositoryURL": "https://github.com/vapor/postgres-kit.git",
"state": {
"branch": null,
"revision": "fca27ff90326e3612ed0197598a7ce467bfedfbd",
"version": "2.1.0"
}
},
{
"package": "postgres-nio",
"repositoryURL": "https://github.com/vapor/postgres-nio.git",
"state": {
"branch": null,
"revision": "25aa31fdd55ea119edee270ce4bd7bd4bd59fdf7",
"version": "1.1.0"
}
},
{
"package": "routing-kit",
"repositoryURL": "https://github.com/vapor/routing-kit.git",
"state": {
"branch": null,
"revision": "e7f2d5bd36dc65a9edb303541cb678515a7fece3",
"version": "4.1.0"
}
},
{
"package": "RxSwift",
"repositoryURL": "https://github.com/ReactiveX/RxSwift.git",
"state": {
"branch": null,
"revision": "002d325b0bdee94e7882e1114af5ff4fe1e96afa",
"version": "5.1.1"
}
},
{
"package": "sql-kit",
"repositoryURL": "https://github.com/vapor/sql-kit.git",
"state": {
"branch": null,
"revision": "8b82edd5d918068f204e3ac4206d5d15f6740395",
"version": "3.5.0"
}
},
{
"package": "swift-backtrace",
"repositoryURL": "https://github.com/swift-server/swift-backtrace.git",
"state": {
"branch": null,
"revision": "f2fd8c4845a123419c348e0bc4b3839c414077d5",
"version": "1.2.0"
}
},
{
"package": "swift-crypto",
"repositoryURL": "https://github.com/apple/swift-crypto.git",
"state": {
"branch": null,
"revision": "9b9d1868601a199334da5d14f4ab2d37d4f8d0c5",
"version": "1.0.2"
}
},
{
"package": "swift-log",
"repositoryURL": "https://github.com/apple/swift-log.git",
"state": {
"branch": null,
"revision": "74d7b91ceebc85daf387ebb206003f78813f71aa",
"version": "1.2.0"
}
},
{
"package": "swift-metrics",
"repositoryURL": "https://github.com/apple/swift-metrics.git",
"state": {
"branch": null,
"revision": "708b960b4605abb20bc55d65abf6bad607252200",
"version": "2.0.0"
}
},
{
"package": "swift-nio",
"repositoryURL": "https://github.com/apple/swift-nio.git",
"state": {
"branch": null,
"revision": "120acb15c39aa3217e9888e515de160378fbcc1e",
"version": "2.18.0"
}
},
{
"package": "swift-nio-extras",
"repositoryURL": "https://github.com/apple/swift-nio-extras.git",
"state": {
"branch": null,
"revision": "7cd24c0efcf9700033f671b6a8eaa64a77dd0b72",
"version": "1.5.1"
}
},
{
"package": "swift-nio-http2",
"repositoryURL": "https://github.com/apple/swift-nio-http2.git",
"state": {
"branch": null,
"revision": "c5d10f4165128c3d0cc0e3c0f0a8ef55947a73a6",
"version": "1.12.2"
}
},
{
"package": "swift-nio-ssl",
"repositoryURL": "https://github.com/apple/swift-nio-ssl.git",
"state": {
"branch": null,
"revision": "f0b118d9af6c4e78bc4f3f4fbb464020172b0bf4",
"version": "2.7.5"
}
},
{
"package": "Swift_Atomics",
"repositoryURL": "https://github.com/Guang1234567/Swift_Atomics.git",
"state": {
"branch": "master",
"revision": "32a8c89a132c5d6d4330002dc65af2953306d3b6",
"version": null
}
},
{
"package": "Swift_Boost_Context",
"repositoryURL": "https://github.com/Guang1234567/Swift_Boost_Context.git",
"state": {
"branch": "master",
"revision": "cdc7565f77c5308db073036d0e03277dcb0f9e1b",
"version": null
}
},
{
"package": "Swift_Coroutine_NIO2",
"repositoryURL": "https://github.com/Guang1234567/Swift_Coroutine_NIO2.git",
"state": {
"branch": "master",
"revision": "1ce084dd0abc4c1331cb81b6f010d7d6db23605f",
"version": null
}
},
{
"package": "vapor",
"repositoryURL": "https://github.com/vapor/vapor.git",
"state": {
"branch": null,
"revision": "dc2aa1e02e04a47b67cb0dabed628fe844900f30",
"version": "4.14.0"
}
},
{
"package": "websocket-kit",
"repositoryURL": "https://github.com/vapor/websocket-kit.git",
"state": {
"branch": null,
"revision": "021edd1ca55451ad15b3e84da6b4064e4b877b34",
"version": "2.1.0"
}
}
]
},
"version": 1
}

0 comments on commit b0f2b7e

Please sign in to comment.