Skip to content

Commit

Permalink
adding Go proxy support
Browse files Browse the repository at this point in the history
  • Loading branch information
CMYanko committed Jul 15, 2019
1 parent a59e8e6 commit 0332ba0
Show file tree
Hide file tree
Showing 5 changed files with 148 additions and 74 deletions.
163 changes: 89 additions & 74 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
version: '3'
services:
nginx-proxy:
build: ./nginx
image: 'cmyanko/sonatype_nginx-proxy:2.6.1'
ports:
- '443:443'
- '5000:5000'
- '8011:8011'
command:
- nginx
- '-g'
- daemon off;
depends_on:
- iq-server
- nexus
nginx-proxy:
build: ./nginx
image: 'cmyanko/sonatype_nginx-proxy:2.6.1'
ports:
- '443:443'
- '5000:5000'
- '8011:8011'
command:
- nginx
- '-g'
- daemon off;
depends_on:
- iq-server
- nexus

nexus:
image: 'sonatype/nexus3:3.17.0'
volumes:
- '~/.demo-pv/nexus-data:/nexus-data'
ports:
- '8081:8081'
- '18443:18443'
nexus:
image: 'sonatype/nexus3:3.17.0'
volumes:
- '~/.demo-pv/nexus-data:/nexus-data'
ports:
- '8081:8081'
- '18443:18443'

iq-server:
image: 'cmyanko/my-iq-server:1.68.0'
build: ./iq-server
volumes:
- '~/.demo-pv/iq-data:/sonatype-work'
- '~/.demo-pv/iq-logs:/opt/sonatype/nexus-iq-server/log'
ports:
- '8070:8070'
- '8071:8071'
iq-server:
image: 'cmyanko/my-iq-server:1.68.0'
build: ./iq-server
volumes:
- '~/.demo-pv/iq-data:/sonatype-work'
- '~/.demo-pv/iq-logs:/opt/sonatype/nexus-iq-server/log'
ports:
- '8070:8070'
- '8071:8071'

# Docker based build jobs that want to use NXRM need to be outside of docker
# network so they can hit the Nginx server for ingress and routing.
Expand Down Expand Up @@ -62,48 +62,63 @@ services:
# - -hooks=/etc/webhook/iq-consume.json
# - -hooks=/etc/webhook/quay-consume.json

victoria:
image: 'victoria:1.0.0-60'
build: ./victoria
volumes:
- '~/.demo-pv/victoria/db:/home/nexus/db'
- '~/.demo-pv/victoria/log:/home/nexus/log'
- '~/.demo-pv/victoria/tmp:/home/nexus/tmp'
ports:
- '8090:8090'
- '8091:8091'
depends_on:
- iq-server
victoria:
image: 'victoria:1.0.0-60'
build: ./victoria
volumes:
- '~/.demo-pv/victoria/db:/home/nexus/db'
- '~/.demo-pv/victoria/log:/home/nexus/log'
- '~/.demo-pv/victoria/tmp:/home/nexus/tmp'
ports:
- '8090:8090'
- '8091:8091'
depends_on:
- iq-server

# anchore-engine:
# image: docker.io/anchore/anchore-engine:latest
# #privileged: true
# depends_on:
# - anchore-db
# ports:
# - "8228:8228"
# - "8338:8338"
# volumes:
# - ~/.demo-pv/aevolume/config:/config/:z
# logging:
# driver: "json-file"
# options:
# max-size: 100m
# environment:
# # NOTE: this should be set to the same name as this service (e.g. anchore-engine)
# - ANCHORE_HOST_ID=dockerhostid-anchore-engine
# - ANCHORE_ENDPOINT_HOSTNAME=anchore-engine
# anchore-db:
# image: "postgres:9"
# volumes:
# - ~/.demo-pv/aevolume/db:/var/lib/postgresql/data/pgdata/:z
# environment:
# - POSTGRES_PASSWORD=mysecretpassword
# - PGDATA=/var/lib/postgresql/data/pgdata/
# logging:
# driver: "json-file"
# options:
# max-size: 100m
# #uncomment to expose a port to allow direct/external access to the DB, for debugging
# #ports:
# # - "2345:5432"
anchore-engine:
image: docker.io/anchore/anchore-engine:latest
#privileged: true
depends_on:
- anchore-db
ports:
- "8228:8228"
- "8338:8338"
volumes:
- ~/.demo-pv/aevolume/config:/config/:z
logging:
driver: "json-file"
options:
max-size: 100m
environment:
# NOTE: this should be set to the same name as this service (e.g. anchore-engine)
- ANCHORE_HOST_ID=dockerhostid-anchore-engine
- ANCHORE_ENDPOINT_HOSTNAME=anchore-engine
anchore-db:
image: "postgres:9"
volumes:
- ~/.demo-pv/aevolume/db:/var/lib/postgresql/data/pgdata/:z
environment:
- POSTGRES_PASSWORD=mysecretpassword
- PGDATA=/var/lib/postgresql/data/pgdata/
logging:
driver: "json-file"
options:
max-size: 100m
#uncomment to expose a port to allow direct/external access to the DB, for debugging
#ports:
# - "2345:5432"

athens:
image: gomods/athens:v0.4.0
restart: always
ports:
- 3000:3000
volumes:
- ~/.demo-pv/athens:/usr/local/athens
environment:
- ATHENS_STORAGE_TYPE=disk
- ATHENS_DISK_STORAGE_ROOT=/usr/local/athens

go:
build: ./golang/
image: cmyanko/golang:compose
26 changes: 26 additions & 0 deletions golang/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright (c) 2017-present Sonatype, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM golang:1.12-stretch

MAINTAINER Adam Such <[email protected]>

USER root
ENV GO111MODULE=on
RUN apt-get update && apt-get install -y openssh-server vim && mkdir -p /run/sshd
COPY go.mod /go/src/mod/
COPY app.go /go/src/app/
EXPOSE 22

CMD ["/usr/sbin/sshd", "-D"]
27 changes: 27 additions & 0 deletions golang/app.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package main

import (
"io"
"net/http"
)
import (
"github.com/gorilla/mux"
"github.com/sirupsen/logrus"
"gopkg.in/alecthomas/kingpin.v2"
)

func main() {
port := kingpin.Flag("port", "Port Number to listen").Default("9999").Short('p').String()
kingpin.Parse()
r := mux.NewRouter()
r.HandleFunc("/", HomeHandler)
//r.HandleFunc("/products", ProductsHandler)
//r.HandleFunc("/articles", ArticlesHandler)
http.Handle("/", r)
logrus.Info(*port)
http.ListenAndServe("0.0.0.0:"+*port, r)
}
func HomeHandler(writer http.ResponseWriter, request *http.Request) {
io.WriteString(writer, "Hello World!")
logrus.Info(request.RemoteAddr)
}
5 changes: 5 additions & 0 deletions golang/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module go_example.com/hello

require github.com/gorilla/mux v1.7.2

go 1.12
1 change: 1 addition & 0 deletions golang/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github.com/gorilla/mux v1.7.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=

0 comments on commit 0332ba0

Please sign in to comment.