Code Monkey home page Code Monkey logo

fischerjulian / irmgard Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 2.0 16 KB

A minimalistic example of an image processing web app accessing a PostgreSQL [1] database and a minio object store written in Go [2]. For each incoming image a message is posted to a RabbitMQ [5] message queue. This application is part of an exam for the free [anynines Kubernetes Training](https://learn.kubernetes.anynines.com/). This code contains refactoring challenges for the training participants. It implements the "happy path" only and this is rather fragile.

Go 96.04% Dockerfile 3.96%

irmgard's Introduction

Irmgard - The Image Guard

A minimalistic example of an image processing web app accessing a PostgreSQL [1] database and a minio object store written in Go [2]. For each incoming image a message is posted to a RabbitMQ [5] message queue.

This application is part of an exam for the free anynines Kubernetes Training.

This code contains refactoring challenges for the training participants. It implements the "happy path" - there is little to no error handling - and thus is rather fragile.

Go

go mod init github.com/fischerjulian/irmgard

Run

Assumptions:

  • RabbitMQ is available via local network
  • PostgreSQL is available via local network

Assuming there is a PostgreSQL server running with a user postgres and an empty database postgresl:

POSTGRES_HOST=<postgresql-host> POSTGRES_USERNAME=<postgresql-username> POSTGRES_PASSWORD=<postgresl-password> go run main.go

e.g.

POSTGRES_HOST=localhost POSTGRES_USERNAME=postgres POSTGRES_PASSWORD=xxx go run main.go

Docker

TODO Create a Dockerfile and build a container image. As a hint, the workflow of creating a Docker container image is stated below.

Build

docker image build -t irmgard:0.3.0 .

Tag

docker image tag irmgard:0.3.0 fischerjulian/irmgard:0.3.0

Publish to Registry

docker image push fischerjulian/irmgard:0.3.0                                   

Pull Image from Registry

docker image pull fischerjulian/irmgard:0.3.0

Run

In order to run the image you will also have to set the env vars POSTGRES_HOST and POSTGRES_PASSWORD which is not contained in the examples below as the images will be used in the context of Kubernetes, only.

Run local image with version tag 0.3.0:

docker container run -p 8080:8080 irmgard:0.3.0

Run remote image with version tag 0.3.0:

docker container run -p  8080:8080 fischerjulian/irmgard:0.3.0

Using the WebService

Submitting an Image

curl -F 'image=@/Users/jfischer/Downloads/000d8ea8207c6d7dae321da11083a312.jpg' localhost:8080

Links

  1. PostgreSQL, https://www.postgresql.org/
  2. Go, https://golang.org/
  3. Go PQ, https://github.com/lib/pq
  4. RabbitMQ, https://www.rabbitmq.com/
  5. RabbitMQ Go Introduction, https://www.rabbitmq.com/tutorials/tutorial-one-go.html

irmgard's People

Contributors

a9s-cli-ci avatar fischerjulian avatar

Watchers

James Cloos avatar  avatar

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.