Code Monkey home page Code Monkey logo

infra-problem's Introduction

DevOps Assessment

This project contains three services:

  • quotes which serves a random quote from quotes/resources/quotes.json
  • newsfeed which aggregates several RSS feeds together
  • front-end which calls the two previous services and displays the results.

Prerequisites

  • Java
  • Leiningen (can be installed using brew install leiningen)

Running tests

You can run the tests of all apps by using make test

Building

First you need to ensure that the common libraries are installed: run make libs to install them to your local ~/.m2 repository. This will allow you to build the JARs.

To build all the JARs and generate the static tarball, run the make clean all command from this directory. The JARs and tarball will appear in the build/ directory.

Static assets

cd to front-end/public and run ./serve.py (you need Python3 installed). This will serve the assets on port 8000.

Running

All the apps take environment variables to configure them and expose the URL /ping which will just return a 200 response that you can use with e.g. a load balancer to check if the app is running.

Front-end app

java -jar front-end.jar

Environment variables:

  • APP_PORT: The port on which to run the app
  • STATIC_URL: The URL on which to find the static assets
  • QUOTE_SERVICE_URL: The URL on which to find the quote service
  • NEWSFEED_SERVICE_URL: The URL on which to find the newsfeed service
  • NEWSFEED_SERVICE_TOKEN: The authentication token that allows the app to talk to the newsfeed service. This should be treated as an application secret. The value should be: T1&eWbYXNWG1w1^YGKDPxAWJ@^et^&kX

Quote service

java -jar quotes.jar

Environment variables

  • APP_PORT: The port on which to run the app

Newsfeed service

java -jar newsfeed.jar

Environment variables

  • APP_PORT: The port on which to run the app

infra-problem's People

Contributors

jgumbley avatar joerayme avatar timjdfletcher avatar tomzo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

infra-problem's Issues

running "make test" fails testing timestamps

This is related to the hard coded timezone in the strings.

cd common-utils && lein midje
All checks (2) succeeded.
cd front-end && lein midje

FAIL "about 'data' - handle-news-response correctly processes entries" at (data.clj:22)
    Expected: [{"date" #inst "2014-12-31T13:30:00.000-00:00", "published-date" #inst "2014-12-31T13:30:00.000-00:00", "title" "Title 1"}]
      Actual: ({"date" #inst "2015-01-01T00:00:00.000-00:00", "published-date" #inst "2015-01-01T00:00:00.000-00:00", "title" "Title 1"})
       Diffs: in [0 "date"] expected #inst "2014-12-31T13:30:00.000-00:00", was #inst "2015-01-01T00:00:00.000-00:00"
              in [0 "published-date"] expected #inst "2014-12-31T13:30:00.000-00:00", was #inst "2015-01-01T00:00:00.000-00:00"
FAILURE: 1 check failed.  (But 3 succeeded.)
Subprocess failed
make: *** [front-end.test] Error 1

Dependencies not met / artifact not found on running "make test"

Hi,

while executing make test, it occurred to me that some dependency cannot get resolved properly or artifacts are missing upstream:

Log of a second run of make test:

$ make test
cd common-utils && lein midje
WARNING: any? already refers to: #'clojure.core/any? in namespace: leiningen.midje, being replaced by: #'leiningen.midje/any?
nil
All checks (2) succeeded.
cd front-end && lein midje
WARNING: any? already refers to: #'clojure.core/any? in namespace: leiningen.midje, being replaced by: #'leiningen.midje/any?
Could not find artifact com.thoughtworks:common-utils:jar:0.1.0-SNAPSHOT in clojars (https://repo.clojars.org/)
This could be due to a typo in :dependencies, file system permissions, or network issues.
If you are behind a proxy, try setting the 'http_proxy' environment variable.
make: *** [front-end.test] Error 1

Error-message:

Could not find artifact com.thoughtworks:common-utils:jar:0.1.0-SNAPSHOT in clojars (https://repo.clojars.org/)

It'd be great if you could update or fix the dependencies.

front-end fails to run with Feed returned error

The front-end throws an error when calling the newsfeed api.

frontend    | 21:08:26.409 [worker-3] ERROR front-end.core - GET /
frontend    | java.lang.Exception: Feed returned error
frontend    |   at front_end.data$handle_response.invokeStatic(data.clj:28)
frontend    |   at front_end.data$handle_response.invoke(data.clj:24)
frontend    |   at front_end.data$handle_news_response.invokeStatic(data.clj:60)
frontend    |   at front_end.data$handle_news_response.invoke(data.clj:58)
frontend    |   at front_end.core$index.invokeStatic(core.clj:18)
frontend    |   at front_end.core$index.invoke(core.clj:14)
frontend    |   at front_end.core$fn__3659.invokeStatic(core.clj:30)
frontend    |   at front_end.core$fn__3659.invoke(core.clj:30)
frontend    |   at compojure.core$wrap_response$fn__1919.invoke(core.clj:158)
frontend    |   at compojure.core$wrap_route_middleware$fn__1903.invoke(core.clj:128)
frontend    |   at compojure.core$wrap_route_info$fn__1908.invoke(core.clj:137)
frontend    |   at compojure.core$wrap_route_matches$fn__1912.invoke(core.clj:146)
frontend    |   at compojure.core$routing$fn__1927.invoke(core.clj:185)
frontend    |   at clojure.core$some.invokeStatic(core.clj:2701)
frontend    |   at clojure.core$some.invoke(core.clj:2692)
frontend    |   at compojure.core$routing.invokeStatic(core.clj:185)
frontend    |   at compojure.core$routing.doInvoke(core.clj:182)
frontend    |   at clojure.lang.RestFn.applyTo(RestFn.java:139)
frontend    |   at clojure.core$apply.invokeStatic(core.clj:667)
frontend    |   at clojure.core$apply.invoke(core.clj:660)
frontend    |   at compojure.core$routes$fn__1931.invoke(core.clj:192)
frontend    |   at common_utils.middleware$correlation_id_middleware$fn__2020.invoke(middleware.clj:12)
frontend    |   at front_end.core$wrap_exception_handling$fn__3652.invoke(core.clj:23)
frontend    |   at ring.middleware.reload$wrap_reload$fn__3473.invoke(reload.clj:22)
frontend    |   at clojure.lang.Var.invoke(Var.java:384)
frontend    |   at org.httpkit.server.HttpHandler.run(RingHandler.java:115)
frontend    |   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
frontend    |   at java.util.concurrent.FutureTask.run(FutureTask.java:266)
frontend    |   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
frontend    |   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
frontend    |   at java.lang.Thread.run(Thread.java:748)
frontend    | Caused by: org.httpkit.client.TimeoutException: idle timeout: 1000ms
frontend    |   at org.httpkit.client.HttpClient.clearTimeout(HttpClient.java:131)
frontend    |   at org.httpkit.client.HttpClient.run(HttpClient.java:496)
frontend    |   ... 1 common frames omitted

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.