From 56ffba487e299f3cbcd18152dce87ecf5bcb2ed7 Mon Sep 17 00:00:00 2001 From: Andrey Shikov Date: Tue, 31 Aug 2021 17:42:52 +0300 Subject: [PATCH 1/4] Added systemInfo role to harness-common --- auth-server/src/main/resources/application.conf | 3 ++- build.sbt | 4 +--- .../src/main/scala/com/actionml/authserver/Roles.scala | 4 ++++ .../authserver/directives/AuthorizationDirectives.scala | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/auth-server/src/main/resources/application.conf b/auth-server/src/main/resources/application.conf index 9bb820d..7ce7216 100644 --- a/auth-server/src/main/resources/application.conf +++ b/auth-server/src/main/resources/application.conf @@ -36,7 +36,8 @@ auth-server { "engine_create", "engine_read", "event_create", - "query_create" + "query_create", + "system_info" ] }, { diff --git a/build.sbt b/build.sbt index 4f751d4..665b644 100644 --- a/build.sbt +++ b/build.sbt @@ -2,8 +2,6 @@ import sbt.Keys.resolvers name := "harness-auth-server" -version := "0.3.0" - scalaVersion := "2.11.12" lazy val akkaVersion = "2.4.18" @@ -17,7 +15,7 @@ resolvers += "Novus Release Repository" at "http://repo.novus.com/releases/" lazy val commonSettings = Seq( organization := "com.actionml", - version := "0.3.0", + version := "0.3.1", scalaVersion := "2.11.12", updateOptions := updateOptions.value.withLatestSnapshots(false), resolvers += Resolver.bintrayRepo("hseeberger", "maven"), diff --git a/harness-auth-common/src/main/scala/com/actionml/authserver/Roles.scala b/harness-auth-common/src/main/scala/com/actionml/authserver/Roles.scala index b6e0f1d..ded8c81 100644 --- a/harness-auth-common/src/main/scala/com/actionml/authserver/Roles.scala +++ b/harness-auth-common/src/main/scala/com/actionml/authserver/Roles.scala @@ -41,4 +41,8 @@ object Roles { val create = "user_create" val permissions = "user_permissions" } + + object system { + val info = "system_info" + } } diff --git a/harness-auth-common/src/main/scala/com/actionml/authserver/directives/AuthorizationDirectives.scala b/harness-auth-common/src/main/scala/com/actionml/authserver/directives/AuthorizationDirectives.scala index f8d812a..6c96132 100644 --- a/harness-auth-common/src/main/scala/com/actionml/authserver/directives/AuthorizationDirectives.scala +++ b/harness-auth-common/src/main/scala/com/actionml/authserver/directives/AuthorizationDirectives.scala @@ -41,7 +41,7 @@ trait AuthorizationDirectives extends RouteDirectives with BasicDirectives with } def hasAccess(role: RoleId, resourceId: ResourceId = ResourceId.*) - (implicit as: ActorSystem, mat: ActorMaterializer, ec: ExecutionContext, accessTokenOpt: Option[AccessToken], log: LoggingAdapter): Directive0 = { + (implicit ec: ExecutionContext, accessTokenOpt: Option[AccessToken], log: LoggingAdapter): Directive0 = { if (authEnabled) { accessTokenOpt.fold[Directive0] { reject(AuthorizationFailedRejection) From 9f0a5f2b215c5a86e3d010a858a34b6df120bc48 Mon Sep 17 00:00:00 2001 From: Andrey Shikov Date: Fri, 3 Sep 2021 14:20:57 +0300 Subject: [PATCH 2/4] Added root project for sonatype publishing --- build.sbt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build.sbt b/build.sbt index 665b644..c8bb273 100644 --- a/build.sbt +++ b/build.sbt @@ -13,6 +13,10 @@ resolvers += Resolver.bintrayRepo("hseeberger", "maven") resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots" resolvers += "Novus Release Repository" at "http://repo.novus.com/releases/" +lazy val root = (project in file(".")).settings( + publishArtifact := false +) + lazy val commonSettings = Seq( organization := "com.actionml", version := "0.3.1", @@ -45,6 +49,7 @@ lazy val harnessAuthCommon = (project in file("harness-auth-common")). pomIncludeRepository := { _ => false }, licenses := Seq("APL2" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt")), sonatypeProjectHosting := Some(GitHubHosting("actionml", "harness-auth-server", "andrey@actionml.com")), + usePgpKeyHex("513353D6872892A57B0C1ED9639726BABE7BC0C8"), publishTo := { val nexus = "https://oss.sonatype.org/" if (isSnapshot.value) Some("snapshots" at nexus + "content/repositories/snapshots") From fe80eb52521ee7aa8a8312649848013e95763923 Mon Sep 17 00:00:00 2001 From: Andrey Shikov Date: Fri, 3 Sep 2021 16:14:34 +0300 Subject: [PATCH 3/4] updated harness-sdk docker image for circleci --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fd63faf..0aba02a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2 jobs: build: docker: - - image: actionml/harness-sdk:0.1 + - image: actionml/harness-sdk:0.1.3 environment: SDK_VERBOSE: yes From 4d676ad93dd1436e71acfb846465a879fff5f1b9 Mon Sep 17 00:00:00 2001 From: Andrey Shikov Date: Wed, 15 Sep 2021 17:44:32 +0300 Subject: [PATCH 4/4] Added Dockerfile --- .circleci/config.yml | 2 +- Dockerfile | 20 ++++++++++++++++++++ Makefile | 17 ++++++++--------- build.sbt | 12 ++++++------ entrypoint.sh | 2 ++ project/build.properties | 2 +- 6 files changed, 38 insertions(+), 17 deletions(-) create mode 100644 Dockerfile create mode 100755 entrypoint.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index 0aba02a..fd63faf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2 jobs: build: docker: - - image: actionml/harness-sdk:0.1.3 + - image: actionml/harness-sdk:0.1 environment: SDK_VERBOSE: yes diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3c0910b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM actionml/harness-sdk + +WORKDIR /app + +ADD . /tmp +ADD ./entrypoint.sh /app + +# RUN cd /tmp && \ +# ./make dist && \ +# cp -a ./auth-server/target/universal/stage/* /app/ && \ +# cd /app && \ +# rm -R /tmp/* + +RUN cd /tmp && \ + make dist && \ + cp -a ./auth-server/target/universal/stage/* /app/ && \ + cd /app && \ + rm -R /tmp/* + +ENTRYPOINT ["/app/entrypoint.sh"] diff --git a/Makefile b/Makefile index d3c9a85..c73a159 100644 --- a/Makefile +++ b/Makefile @@ -2,9 +2,9 @@ .PHONY: sbt clean clean-dist build dist publish-local HARNESS_ROOT := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) -SBT_SYSTEM_SCALA ?= no -SBT_URL ?= https://git.io/sbt -SBT ?= $(HARNESS_ROOT)/sbt/sbt +SBT_URL ?= https://raw.githubusercontent.com/sbt/sbt/v1.5.5/sbt +SBT_DIR ?= $(HARNESS_ROOT)/sbt +SBT ?= $(SBT_DIR)/sbt DIST ?= dist VERSION := $(shell grep ^version build.sbt | grep -o '".*"' | sed 's/"//g') @@ -17,21 +17,20 @@ ifeq ($(SBT),$(HARNESS_ROOT)/sbt/sbt) @ SBT_DIR="$$(dirname $(SBT))" && mkdir -p $$SBT_DIR && cd $$SBT_DIR && \ [ -x sbt ] || ( echo "Installing sbt extras locally (from $(SBT_URL))"; \ which curl &> /dev/null && ( curl \-#SL -o sbt \ - https://git.io/sbt && chmod 0755 sbt || exit 1; ) || \ - ( which wget &>/dev/null && wget -O sbt https://git.io/sbt && chmod 0755 sbt; ) \ + $(SBT_URL) && chmod 0755 sbt || exit 1; ) || \ + ( which wget &>/dev/null && wget -O sbt $(SBT_URL) && chmod 0755 sbt; ) \ ) endif build: sbt - $(SBT) ++$(SCALA_VERSION) -batch authServer/universal:stage + $(SBT) authServer/universal:stage publish-local: build - $(SBT) ++$(SCALA_VERSION) -batch harnessAuthCommon/publish-local + $(SBT) harnessAuthCommon/publish-local clean: sbt - $(SBT) ++$(SCALA_VERSION) -batch harnessAuthCommon/clean - $(SBT) ++$(SCALA_VERSION) -batch authServer/clean + $(SBT) clean dist: clean clean-dist build mkdir -p $(DIST) && cd $(DIST) && mkdir bin conf logs lib diff --git a/build.sbt b/build.sbt index c8bb273..b5a161d 100644 --- a/build.sbt +++ b/build.sbt @@ -9,9 +9,9 @@ lazy val akkaHttpVersion = "10.0.9" lazy val circeVersion = "0.8.0" lazy val scalaTestVersion = "3.0.1" -resolvers += Resolver.bintrayRepo("hseeberger", "maven") -resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots" -resolvers += "Novus Release Repository" at "http://repo.novus.com/releases/" +resolvers += Resolver.bintrayRepo("hseeberger", "maven").withAllowInsecureProtocol(true) +resolvers += ("Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots").withAllowInsecureProtocol(true) +resolvers += Resolver.typesafeRepo("releases").withAllowInsecureProtocol(true) lazy val root = (project in file(".")).settings( publishArtifact := false @@ -22,9 +22,9 @@ lazy val commonSettings = Seq( version := "0.3.1", scalaVersion := "2.11.12", updateOptions := updateOptions.value.withLatestSnapshots(false), - resolvers += Resolver.bintrayRepo("hseeberger", "maven"), - resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots", - resolvers += Resolver.mavenLocal, + resolvers += Resolver.bintrayRepo("hseeberger", "maven").withAllowInsecureProtocol(true), + resolvers += ("Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots").withAllowInsecureProtocol(true), + resolvers += Resolver.mavenLocal.withAllowInsecureProtocol(true), libraryDependencies ++= Seq( "ch.qos.logback" % "logback-classic" % "1.2.3", "org.slf4j" % "log4j-over-slf4j" % "1.7.25", diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..1ef0d08 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +exec /app/bin/authserver \ No newline at end of file diff --git a/project/build.properties b/project/build.properties index cd7364c..215ddd2 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version = 0.13.17 \ No newline at end of file +sbt.version = 1.5.5 \ No newline at end of file