Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ms wl #89

Merged
merged 8 commits into from
Nov 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ sudo: true
services: docker
language: scala
jdk: openjdk8
scala: 2.12.4
scala: 2.12.7
notifications:
slack:
secure: vSzVllY4Vmt6Nf6Yl+5QDMKTEQ4jIbP/bC/LSzZFmQNlYWlDEzG1gQcPb4prh7/efjUFt+vM2lTFP7jLEkib+XiR8n4LShCl+IeRyBpiONXII4KN7O9IPTMMOpGvN/FhZFgyzRFwEvkCSuSBpOYoRGGij/wzo/mPzfJYEyGxpaRmQKEmD7xmtxXMAVWpK2L5fL6XbglEPKD7pMYUvM/WyzAMJg4JgDxOGeX7QLGdSQrTOOkUtJjiEs8WtB/fR9Gev+vwX22KrnMwZpmT9KPPi+kzwFYnfzKxHdjdsmydmBBlBS4XM8rvJL1eMyrQB2LOOW8xWUeOF03t5PfKAC6cY2h01Jdl/rx3L6Pc99ABItS3OvYcwL0HY20bz+hNI0seRMVftz7eRzMHGdQsfYXfU6hOxkovGutRoyVkS7f+m66nBaOfRh6DAlOt/H6us4WEq1zJb8SyP+S7Xm38grh+xEDIMaz8AeavhDRWyH6RQfrpxvcGbcWhURXiY7clJLgjmauGJw9H/jxkuuoIINIFjkrziRHDGj9ZxNp3JbtJfprrramMCLtHl5Ziz5Pjmcf46iZxFzNlRlW/aC5ZqQbHm5EgcNuHXHMHvzTQcnkFDrQBGaXI3sLXfaYt+1LeRwfQXGOsWSgc8lmgfcGn1Fvbj/8ykq/q1ReQFAbCvT62ZR8=
Expand Down
9 changes: 6 additions & 3 deletions Dockerfile-bld
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ MAINTAINER bruce potter <bp@us.ibm.com>

ARG SCALA_VERSION

# install build tools: curl, java
RUN apt-get update && apt-get install -y curl openjdk-8-jdk
# install build tools: curl, java, sbt
# https is needed to get the sbt deb from its apt repo
RUN apt-get update && apt-get install -y apt-transport-https gnupg ca-certificates
RUN echo "deb https://dl.bintray.com/sbt/debian /" > /etc/apt/sources.list.d/sbt.list && apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
RUN apt-get update && apt-get install -y curl openjdk-8-jdk sbt

# install scala
RUN curl -s http://downloads.lightbend.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz | tar -zx -C /usr/local/share
RUN ln -s `ls -1dr /usr/local/share/scala-2* | head -1` /usr/local/share/scala
ENV PATH="/usr/local/share/scala/bin:$PATH"

# the exchange api war file is built from the Makefile using a cmd like: cd $EXCHANGE_API_DIR && ./sbt package
# the exchange api war file is built from the Makefile using a cmd like: cd $EXCHANGE_API_DIR && sbt package
11 changes: 5 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ docker: .docker-exec
# - the create because the network already exists because of the build step
.docker-network:
-docker network remove $(DOCKER_NETWORK) 2> /dev/null || :
-docker network create $(DOCKER_NETWORK)
docker network create $(DOCKER_NETWORK)
@touch $@

# Using dot files to hold the modification time the docker image and container were built
Expand All @@ -72,7 +72,7 @@ docker: .docker-exec
@touch $@

.docker-compile: $(wildcard src/main/scala/com/horizon/exchangeapi/*) $(wildcard src/main/resources/*) .docker-bld
docker exec -t $(DOCKER_NAME)_bld /bin/bash -c "cd $(EXCHANGE_API_DIR) && ./sbt package"
docker exec -t $(DOCKER_NAME)_bld /bin/bash -c "cd $(EXCHANGE_API_DIR) && sbt package"
# war file ends up in: ./target/scala-$SCALA_VERSION_SHORT/exchange-api_$SCALA_VERSION_SHORT-$EXCHANGE_API_WAR_VERSION.war
@touch $@

Expand All @@ -90,10 +90,9 @@ docker: .docker-exec
@touch $@

# Run the automated tests in the bld container against the exchange svr running in the exec container
test:
docker-test: .docker-bld
test: .docker-bld
: $${EXCHANGE_ROOTPW:?} # this verifies these env vars are set
docker exec -t -e EXCHANGE_URL_ROOT=http://$(DOCKER_NAME):8080 -e "EXCHANGE_ROOTPW=$$EXCHANGE_ROOTPW" $(DOCKER_NAME)_bld /bin/bash -c 'cd $(EXCHANGE_API_DIR) && ./sbt test'
docker exec -t -e EXCHANGE_URL_ROOT=http://$(DOCKER_NAME):8080 -e "EXCHANGE_ROOTPW=$$EXCHANGE_ROOTPW" $(DOCKER_NAME)_bld /bin/bash -c 'cd $(EXCHANGE_API_DIR) && sbt test'

# Push the docker images to the registry w/o rebuilding them
docker-push-only:
Expand Down Expand Up @@ -132,4 +131,4 @@ version:

.SECONDARY:

.PHONY: default clean clean-exec-image clean-all docker docker-test docker-push-only docker-push sync-swagger-ui testmake
.PHONY: default clean clean-exec-image clean-all docker test docker-push-only docker-push-version-only docker-push docker-push-to-prod sync-swagger-ui testmake version
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ services in the exchange.
## Preconditions

- [Install scala](http://www.scala-lang.org/download/install.html)
- [Install sbt](https://www.scala-sbt.org/1.x/docs/Setup.html)
- (optional) Install conscript and giter8 if you want to get example code from scalatra.org
- Install postgresql locally (unless you have a remote instance you are using). Instructions for installing on Mac OS X:
- `brew install postgresql`
Expand Down Expand Up @@ -44,13 +45,13 @@ services in the exchange.

## Building in Local Sandbox

- `./sbt`
- `sbt`
- `jetty:start`
- Or to have the server restart automatically when code changes: `~;jetty:stop;jetty:start`
- Once the server starts, to try a simple rest method browse: [http://localhost:8080/v1/nodes?id=a&token=b](http://localhost:8080/v1/orgs/IBM/nodes?id=a&token=b)
- To see the swagger output, browse: [http://localhost:8080/api](http://localhost:8080/api)
- Run the automated tests (with the exchange server still running): `./sbt test`
- Run just 1 of the the automated test suites (with the exchange server still running): `./sbt "test-only exchangeapi.AgbotsSuite"`
- Run the automated tests (with the exchange server still running): `sbt test`
- Run just 1 of the the automated test suites (with the exchange server still running): `sbt "testOnly exchangeapi.AgbotsSuite"`
- Run the performance tests: `src/test/bash/scale/test.sh` or `src/test/bash/scale/wrapper.sh 8`

## Building and Running the Container
Expand All @@ -62,7 +63,7 @@ services in the exchange.
- Build the exchange api container and run it locally: `make .docker-exec-run`
- Manually test container locally: `curl -sS -w %{http_code} http://localhost:8080/v1/admin/version`
- Note: the container can not access a postgres db running locally on the docker host if the db is only listening for unix domain sockets or 127.0.0.1.
- Run the automated tests: `./sbt test`
- Run the automated tests: `sbt test`
- Push container to our docker registry: `make docker-push-only`
- Deploy the new container to a docker host
- Ensure that no changes are needed to the /etc/horizon/exchange/config.json file
Expand All @@ -86,6 +87,11 @@ services in the exchange.
- Allow random PW creation for user creation
- Consider changing all creates to POST, and update (via put/patch) return codes to 200

## Changes in 1.62.0

- Remove microservice, workload, and blockchain support (leaving just service support)
- Remove deprecated `PUT /orgs/{orgid}/agbots/{id}/patterns/{patid}` method (use POST instead)

## Changes in 1.61.0

- Support IAM API keys for bx cr access by adding `username` field to service dockauths (issue anax 651)
Expand Down
16 changes: 8 additions & 8 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
lazy val scalatraVersion = "2.6.2" // can see the latest version at https://github.com/scalatra/scalatra/releases
lazy val scalatraVersion = "2.6.3" // can see the latest version at https://github.com/scalatra/scalatra/releases

lazy val root = (project in file(".")).
settings(
organization := "com.horizon",
name := "Exchange API",
version := "0.1.0",
scalaVersion := "2.12.4",
scalaVersion := "2.12.7",
resolvers += Classpaths.typesafeReleases,
libraryDependencies ++= Seq(
"org.scalatra" %% "scalatra" % "latest.release",
Expand All @@ -14,8 +14,8 @@ lazy val root = (project in file(".")).
"com.typesafe.slick" %% "slick" % "latest.release",
"com.typesafe.slick" %% "slick-hikaricp" % "latest.release",
"org.postgresql" % "postgresql" % "latest.release",
//"com.zaxxer" % "HikariCP" % "latest.release", // was grabbing 3.0.0 too early
"com.zaxxer" % "HikariCP" % "2.5.1",
"com.zaxxer" % "HikariCP" % "latest.release",
//"com.zaxxer" % "HikariCP" % "2.5.1",
//"org.slf4j" % "slf4j-api" % "latest.release", // they put version 1.8.0-alpha2 prematurely into latest.release
"org.slf4j" % "slf4j-api" % "1.7.25",
//"ch.qos.logback" % "logback-classic" % "latest.release", // they put version 1.3.0-alpha2 prematurely into latest.release
Expand All @@ -25,10 +25,10 @@ lazy val root = (project in file(".")).
"org.eclipse.jetty" % "jetty-webapp" % "latest.release" % "container",
"org.eclipse.jetty" % "jetty-plus" % "latest.release" % "container",
"org.scalatra" %% "scalatra-json" % "latest.release",
//"org.json4s" %% "json4s-native" % "latest.release", // this requires 3.6.0-M2 of some libraries, which cause conflicts with other libraries
//"org.json4s" %% "json4s-jackson" % "latest.release",
"org.json4s" %% "json4s-native" % "3.5.3",
"org.json4s" %% "json4s-jackson" % "3.5.3",
"org.json4s" %% "json4s-native" % "latest.release",
"org.json4s" %% "json4s-jackson" % "latest.release",
//"org.json4s" %% "json4s-native" % "3.5.3",
//"org.json4s" %% "json4s-jackson" % "3.5.3",
"org.scalatra" %% "scalatra-swagger" % "latest.release",
"org.scalatest" %% "scalatest" % "latest.release" % "test",
"org.scalacheck" %% "scalacheck" % "latest.release" % "test",
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=0.13.17
sbt.version=1.2.6
Loading