mirror of
https://github.com/gomods/athens
synced 2026-02-03 12:10:32 +00:00
Proxy remove assets and config scripts (#693)
* Proxy remove assets and config scripts * update olympus dockerfile - tho its outdated anyway
This commit is contained in:
@@ -63,7 +63,6 @@ alldeps:
|
|||||||
dev:
|
dev:
|
||||||
docker-compose -p athensdev up -d mongo
|
docker-compose -p athensdev up -d mongo
|
||||||
docker-compose -p athensdev up -d redis
|
docker-compose -p athensdev up -d redis
|
||||||
./scripts/create_default_config.sh
|
|
||||||
|
|
||||||
.PHONY: down
|
.PHONY: down
|
||||||
down:
|
down:
|
||||||
|
|||||||
@@ -17,8 +17,7 @@ WORKDIR $GOPATH/src/github.com/gomods/athens
|
|||||||
ADD . .
|
ADD . .
|
||||||
|
|
||||||
RUN cd cmd/olympus && buffalo build -s -o /bin/app
|
RUN cd cmd/olympus && buffalo build -s -o /bin/app
|
||||||
RUN scripts/create_default_config.sh
|
COPY config.dev.toml /config/config.toml
|
||||||
COPY config.toml /bin/config.toml
|
|
||||||
|
|
||||||
FROM alpine
|
FROM alpine
|
||||||
RUN apk add --no-cache bash
|
RUN apk add --no-cache bash
|
||||||
@@ -27,7 +26,7 @@ RUN apk add --no-cache ca-certificates
|
|||||||
WORKDIR /bin/
|
WORKDIR /bin/
|
||||||
|
|
||||||
COPY --from=builder /bin/app .
|
COPY --from=builder /bin/app .
|
||||||
COPY --from=builder /bin/config.toml .
|
COPY --from=builder /config/config.toml .
|
||||||
|
|
||||||
# Comment out to run the binary in "production" mode:
|
# Comment out to run the binary in "production" mode:
|
||||||
# ENV GO_ENV=production
|
# ENV GO_ENV=production
|
||||||
@@ -39,4 +38,4 @@ EXPOSE 3000
|
|||||||
|
|
||||||
# Comment out to run the migrations before running the binary:
|
# Comment out to run the migrations before running the binary:
|
||||||
# CMD /bin/app migrate; /bin/app
|
# CMD /bin/app migrate; /bin/app
|
||||||
CMD exec /bin/app -config_file=config.toml
|
CMD exec /bin/app -config_file=/config/config.toml
|
||||||
|
|||||||
@@ -8,10 +8,7 @@ WORKDIR $GOPATH/src/github.com/gomods/athens
|
|||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN apk update && \
|
RUN GO111MODULE=on CGO_ENABLED=0 go build -mod=vendor -o /bin/athens-proxy ./cmd/proxy
|
||||||
apk add --no-cache bash && \
|
|
||||||
GO111MODULE=on CGO_ENABLED=0 go build -mod=vendor -o /bin/athens-proxy ./cmd/proxy && \
|
|
||||||
./scripts/create_default_config.sh
|
|
||||||
|
|
||||||
FROM alpine
|
FROM alpine
|
||||||
|
|
||||||
@@ -19,8 +16,6 @@ ENV GO111MODULE=on
|
|||||||
|
|
||||||
COPY --from=builder /bin/athens-proxy /bin/athens-proxy
|
COPY --from=builder /bin/athens-proxy /bin/athens-proxy
|
||||||
COPY --from=builder /go/src/github.com/gomods/athens/config.dev.toml /config/config.toml
|
COPY --from=builder /go/src/github.com/gomods/athens/config.dev.toml /config/config.toml
|
||||||
COPY --from=builder /go/src/github.com/gomods/athens/cmd/proxy/locales /go/src/github.com/gomods/athens/cmd/proxy/locales
|
|
||||||
COPY --from=builder /go/src/github.com/gomods/athens/cmd/proxy/assets /go/src/github.com/gomods/athens/cmd/proxy/assets
|
|
||||||
COPY --from=builder /usr/local/go/bin/go /bin/go
|
COPY --from=builder /usr/local/go/bin/go /bin/go
|
||||||
|
|
||||||
RUN apk update && \
|
RUN apk update && \
|
||||||
|
|||||||
@@ -6,10 +6,8 @@ import (
|
|||||||
"github.com/gobuffalo/buffalo"
|
"github.com/gobuffalo/buffalo"
|
||||||
"github.com/gobuffalo/buffalo/middleware"
|
"github.com/gobuffalo/buffalo/middleware"
|
||||||
"github.com/gobuffalo/buffalo/middleware/csrf"
|
"github.com/gobuffalo/buffalo/middleware/csrf"
|
||||||
"github.com/gobuffalo/buffalo/middleware/i18n"
|
|
||||||
"github.com/gobuffalo/buffalo/middleware/ssl"
|
"github.com/gobuffalo/buffalo/middleware/ssl"
|
||||||
"github.com/gobuffalo/buffalo/render"
|
"github.com/gobuffalo/buffalo/render"
|
||||||
"github.com/gobuffalo/packr"
|
|
||||||
"github.com/gomods/athens/pkg/config"
|
"github.com/gomods/athens/pkg/config"
|
||||||
"github.com/gomods/athens/pkg/log"
|
"github.com/gomods/athens/pkg/log"
|
||||||
mw "github.com/gomods/athens/pkg/middleware"
|
mw "github.com/gomods/athens/pkg/middleware"
|
||||||
@@ -23,23 +21,10 @@ import (
|
|||||||
// Service is the name of the service that we want to tag our processes with
|
// Service is the name of the service that we want to tag our processes with
|
||||||
const Service = "proxy"
|
const Service = "proxy"
|
||||||
|
|
||||||
// T is the translator to use
|
var proxy = render.New(render.Options{
|
||||||
var T *i18n.Translator
|
// Add template helpers here:
|
||||||
|
Helpers: render.Helpers{},
|
||||||
func init() {
|
})
|
||||||
proxy = render.New(render.Options{
|
|
||||||
// HTML layout to be used for all HTML requests:
|
|
||||||
HTMLLayout: "application.html",
|
|
||||||
JavaScriptLayout: "application.js",
|
|
||||||
|
|
||||||
// Box containing all of the templates:
|
|
||||||
TemplatesBox: packr.NewBox("../templates/proxy"),
|
|
||||||
AssetsBox: assetsBox,
|
|
||||||
|
|
||||||
// Add template helpers here:
|
|
||||||
Helpers: render.Helpers{},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// App is where all routes and middleware for buffalo
|
// App is where all routes and middleware for buffalo
|
||||||
// should be defined. This is the nerve center of your
|
// should be defined. This is the nerve center of your
|
||||||
@@ -115,11 +100,6 @@ func App(conf *config.Config) (*buffalo.App, error) {
|
|||||||
csrfMiddleware := csrf.New
|
csrfMiddleware := csrf.New
|
||||||
app.Use(csrfMiddleware)
|
app.Use(csrfMiddleware)
|
||||||
}
|
}
|
||||||
// Setup and use translations:
|
|
||||||
if T, err = i18n.New(packr.NewBox("../locales"), "en-US"); err != nil {
|
|
||||||
app.Stop(err)
|
|
||||||
}
|
|
||||||
app.Use(T.Middleware())
|
|
||||||
|
|
||||||
if !conf.Proxy.FilterOff {
|
if !conf.Proxy.FilterOff {
|
||||||
mf := module.NewFilter(conf.FilterFile)
|
mf := module.NewFilter(conf.FilterFile)
|
||||||
@@ -141,9 +121,5 @@ func App(conf *config.Config) (*buffalo.App, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// serve files from the public directory:
|
|
||||||
// has to be last
|
|
||||||
app.ServeFiles("/", assetsBox)
|
|
||||||
|
|
||||||
return app, nil
|
return app, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,5 +5,5 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func proxyHomeHandler(c buffalo.Context) error {
|
func proxyHomeHandler(c buffalo.Context) error {
|
||||||
return c.Render(200, proxy.HTML("index.html"))
|
return c.Render(200, proxy.JSON("Welcome to The Athen Proxy"))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
package actions
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/gobuffalo/buffalo/render"
|
|
||||||
"github.com/gobuffalo/packr"
|
|
||||||
)
|
|
||||||
|
|
||||||
var proxy *render.Engine
|
|
||||||
var assetsBox = packr.NewBox("../public")
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
# For more information on using i18n see: https://github.com/nicksnyder/go-i18n
|
|
||||||
- id: welcome_greeting
|
|
||||||
translation: "Welcome to Buffalo (EN)"
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
<%= if (len(flash) > 0) { %>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<%= for (k, messages) in flash { %>
|
|
||||||
<%= for (msg) in messages { %>
|
|
||||||
<div class="alert alert-<%= k %>" role="alert">
|
|
||||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
|
||||||
<%= msg %>
|
|
||||||
</div>
|
|
||||||
<% } %>
|
|
||||||
<% } %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% } %>
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<meta name='go-import' content='<%= module %> mod <%= redirectLoc %>'>
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
<%= if (len(flash) > 0) { %>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<%= for (k, messages) in flash { %>
|
|
||||||
<%= for (msg) in messages { %>
|
|
||||||
<div class="alert alert-<%= k %>" role="alert">
|
|
||||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
|
||||||
<%= msg %>
|
|
||||||
</div>
|
|
||||||
<% } %>
|
|
||||||
<% } %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% } %>
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>Athens Go Module Proxy</title>
|
|
||||||
<%= stylesheetTag("application.css") %>
|
|
||||||
<%= if (authenticity_token) { %>
|
|
||||||
<meta name="csrf-param" content="authenticity_token" />
|
|
||||||
<meta name="csrf-token" content="<%= authenticity_token %>" />
|
|
||||||
<% } %>
|
|
||||||
<link rel="icon" href="<%= assetPath("images/favicon.ico") %>">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="container">
|
|
||||||
<!-- NavBar -->
|
|
||||||
<nav class="navbar navbar-expand-lg navbar-light bg-light mb-2">
|
|
||||||
<a class="navbar-brand" href="<%= rootPath() %>">
|
|
||||||
<img src="<%= assetPath("images/banner.png") %>" class="logo">
|
|
||||||
</a>
|
|
||||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
|
||||||
<span class="navbar-toggler-icon"></span>
|
|
||||||
</button>
|
|
||||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
<!-- End NavBar -->
|
|
||||||
<%= partial("flash.html") %>
|
|
||||||
<%= yield %>
|
|
||||||
</div>
|
|
||||||
<footer class="footer text-center fixed-bottom">
|
|
||||||
<div>
|
|
||||||
<ul class="list-inline">
|
|
||||||
<li class="text-muted">github.com/gomods/athens © 2018</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</footer>
|
|
||||||
<%= javascriptTag("application.js") %>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<div class="row mt-5">
|
|
||||||
<div class="col text-center">
|
|
||||||
<h1>Welcome to the Athens proxy</h1>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@@ -99,7 +99,6 @@ if ($alldeps.IsPresent) {
|
|||||||
if ($dev.IsPresent) {
|
if ($dev.IsPresent) {
|
||||||
& docker-compose -p athensdev up -d mongo
|
& docker-compose -p athensdev up -d mongo
|
||||||
& docker-compose -p athensdev up -d redis
|
& docker-compose -p athensdev up -d redis
|
||||||
execScript "create_default_config.ps1"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($test.IsPresent) {
|
if ($test.IsPresent) {
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
|
||||||
|
|
||||||
if [ ! -e "${SCRIPTS_DIR}/../config.toml" ] ; then
|
|
||||||
cp "${SCRIPTS_DIR}/../config.dev.toml" "${SCRIPTS_DIR}/../config.toml"
|
|
||||||
fi
|
|
||||||
Reference in New Issue
Block a user