-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(infra): [ATL-1889] create local deployment config
* feat: Add docker compose and HAProxy configs * feat(castor,mercury): Added sbt-native-packager as plugin and configured basic docker image * feat:Updated docker-compose and HA Proxy configs and created run.sh to spin up local instance * chore(castor): Bump sbt-protoc version to 1.0.6 for M1 support * chore(infra): Fix castor image name in docker-compose config * feat(castor): add route to get OAS * chore(castor): Update OAS server url to localhost * chore(castor): patch OperationType model * chore(infra): Fix mercury docker config * Add pollux service credential API stub * Update Pollux OAS spec to make it work with Akka * fix(pollux): fix forward reference issue * chore(pollux): fix server address in OAS * chore(infra): integrate Pollux service * chore(infra): build Pollux image in run.sh Co-authored-by: Benjamin Voiturier <[email protected]> Co-authored-by: David <[email protected]> Co-authored-by: Pat Losoponkul <[email protected]>
- Loading branch information
1 parent
def88ee
commit 3f381cd
Showing
43 changed files
with
1,285 additions
and
311 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ info: | |
name: Core DID | ||
email: [email protected] | ||
servers: | ||
- url: "https://api.atala.io" | ||
- url: "http://localhost/castor" | ||
tags: | ||
- name: DID | ||
description: DID REST API | ||
|
@@ -17,7 +17,7 @@ tags: | |
description: DID Authentication REST API | ||
|
||
paths: | ||
/dids/: | ||
/dids: | ||
post: | ||
tags: [ "DID" ] | ||
operationId: createDid | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,15 +34,21 @@ lazy val server = project | |
name := "castor-server", | ||
libraryDependencies ++= apiServerDependencies, | ||
// OpenAPI settings | ||
Compile / unmanagedResourceDirectories += apiBaseDirectory.value / "http", | ||
Compile / sourceGenerators += openApiGenerateClasses, | ||
openApiGeneratorSpec := apiBaseDirectory.value / "http/castor-openapi-spec.yaml", | ||
openApiGeneratorConfig := baseDirectory.value / "openapi/generator-config/config.yaml", | ||
openApiGeneratorImportMapping := Seq("DidType", "DidOperationType", "DidOperationStatus") | ||
openApiGeneratorImportMapping := Seq("DidType", "DidOperationType", "DidOperationStatus", "OperationType") | ||
.map(model => (model, s"io.iohk.atala.castor.server.http.OASModelPatches.$model")) | ||
.toMap, | ||
// gRPC settings | ||
Compile / PB.targets := Seq(scalapb.gen() -> (Compile / sourceManaged).value / "scalapb"), | ||
Compile / PB.protoSources := Seq(apiBaseDirectory.value / "grpc") | ||
Compile / PB.protoSources := Seq(apiBaseDirectory.value / "grpc"), | ||
Docker / maintainer := "[email protected]", | ||
Docker / dockerRepository := Some("atala-prism.io"), | ||
// Docker / packageName := s"atala-prism/${packageName.value}", | ||
dockerExposedPorts := Seq(8080), | ||
dockerBaseImage := "openjdk:11" | ||
) | ||
.enablePlugins(OpenApiGeneratorPlugin) | ||
.enablePlugins(OpenApiGeneratorPlugin, JavaAppPackaging, DockerPlugin) | ||
.dependsOn(core, sql) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6") | ||
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.11") | ||
|
||
libraryDependencies ++= Seq("org.openapitools" % "openapi-generator" % "6.0.0") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.3") | ||
addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.6") | ||
|
||
libraryDependencies ++= Seq("com.thesamet.scalapb" %% "compilerplugin" % "0.11.11") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# How-to | ||
|
||
Use the `run.sh` provided | ||
|
||
From root of project | ||
|
||
```bash | ||
./infrastructure/local/run.sh | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
version: '3.8' | ||
|
||
services: | ||
castor: | ||
image: atala-prism.io/castor-server:0.1.0-SNAPSHOT | ||
|
||
pollux: | ||
image: atala-prism.io/pollux-server:0.1.0-SNAPSHOT | ||
|
||
mercury: | ||
image: atala-prism.io/mercury-mediator:0.1.0-SNAPSHOT | ||
|
||
swagger-ui: | ||
image: swaggerapi/swagger-ui:v4.14.0 | ||
environment: | ||
- 'URLS=[ | ||
{ name: "Castor", url: "/castor/api/openapi-spec.yaml" }, | ||
{ name: "Pollux", url: "/pollux/api/openapi-spec.yaml" }, | ||
{ name: "Mercury", url: "/mercury/api/openapi-spec.yaml" } | ||
]' | ||
- BASE_URL=/apidocs | ||
|
||
haproxy: | ||
image: haproxy:2.6.5 | ||
ports: | ||
- "80:80" # Http | ||
depends_on: | ||
- castor | ||
- pollux | ||
- mercury | ||
- swagger-ui | ||
volumes: | ||
- ./haproxy:/usr/local/etc/haproxy:ro |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
global | ||
log 127.0.0.1 local0 debug | ||
maxconn 4096 | ||
|
||
ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS | ||
ssl-default-bind-options no-sslv3 | ||
tune.ssl.default-dh-param 2048 | ||
|
||
defaults | ||
mode http | ||
option log-separate-errors | ||
timeout connect 20000ms | ||
timeout client 50000ms | ||
timeout server 50000ms | ||
timeout tunnel 60s | ||
# never fail on address resolution | ||
default-server init-addr last,libc,none | ||
|
||
log global | ||
#log-format "%{+Q}o %{-Q}ci - - [%trg] %r %ST %U %B \"\" \"\" %cp %ms %ft %b %s %TR/%Tw/%Tc/%Tr/%Ta %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq \"%CC\" \"%CS\" \"%hr\" \"%hsl\"" | ||
|
||
frontend https-in | ||
bind *:80 | ||
option httplog | ||
option logasap | ||
|
||
use_backend castor if { path_beg -i /castor } | ||
use_backend pollux if { path_beg -i /pollux } | ||
use_backend mercury if { path_beg -i /mercury } | ||
use_backend swagger-ui if { path_beg -i /apidocs } | ||
|
||
backend castor | ||
balance roundrobin | ||
http-request set-uri %[url,regsub(^/castor,,)] if { path_beg /castor } | ||
option httpclose | ||
option forwardfor | ||
server s1 castor:8080 maxconn 32 | ||
|
||
|
||
backend pollux | ||
balance roundrobin | ||
http-request set-uri %[url,regsub(^/pollux,,)] if { path_beg /pollux } | ||
option httpclose | ||
option forwardfor | ||
server s1 pollux:8080 maxconn 32 | ||
|
||
backend mercury | ||
balance roundrobin | ||
http-request set-uri %[url,regsub(^/mercury,,)] if { path_beg /mercury } | ||
option httpclose | ||
option forwardfor | ||
server s1 mercury:8080 maxconn 32 | ||
|
||
backend swagger-ui | ||
balance roundrobin | ||
option httpclose | ||
option forwardfor | ||
server s1 swagger-ui:8080 maxconn 1024 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
echo "--------------------------------------" | ||
echo "Building docker images" | ||
echo "--------------------------------------" | ||
|
||
cd castor/service; sbt docker:publishLocal; cd - | ||
cd mercury/prism-mediator; sbt "project mediator; docker:publishLocal"; cd - | ||
cd pollux/service; sbt docker:publishLocal; cd - | ||
|
||
echo "--------------------------------------" | ||
echo "Bringing up stack using docker-compose" | ||
echo "--------------------------------------" | ||
|
||
docker-compose -f infrastructure/local/docker-compose.yml up | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ info: | |
email: [email protected] | ||
|
||
servers: | ||
- url: https://mailbox.mediator.atalaprism.io | ||
- url: http://localhost/mercury | ||
|
||
tags: | ||
- name: Mailbox Mediator | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -201,7 +201,12 @@ lazy val mediator = project | |
), | ||
Compile / unmanagedResourceDirectories += apiBaseDirectory.value, | ||
testFrameworks := Seq(new TestFramework("zio.test.sbt.ZTestFramework")), | ||
Docker / maintainer := "[email protected]", | ||
Docker / dockerRepository := Some("atala-prism.io"), | ||
dockerExposedPorts := Seq(8080), | ||
dockerBaseImage := "openjdk:11" | ||
) | ||
.enablePlugins(JavaAppPackaging, DockerPlugin) | ||
.dependsOn(agentDidcommx, resolver) | ||
.dependsOn( | ||
protocolConnection, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6") | ||
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.11") |
Oops, something went wrong.