Working docker containerization
This commit is contained in:
parent
08e11786c0
commit
06e7b4e9c0
@ -1,4 +0,0 @@
|
|||||||
DATABASE_HOST="127.0.0.1:3306"
|
|
||||||
DATABASE_USER="test"
|
|
||||||
DATABASE_PASSWORD="test"
|
|
||||||
DATABASE_NAME="test"
|
|
||||||
3
.gitignore
vendored
3
.gitignore
vendored
@ -2,4 +2,5 @@
|
|||||||
*.swp
|
*.swp
|
||||||
*.log
|
*.log
|
||||||
.env
|
.env
|
||||||
infra-dashboard
|
data/mysql
|
||||||
|
app/infra-dashboard
|
||||||
|
|||||||
62
Dockerfile
Normal file
62
Dockerfile
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
########################
|
||||||
|
# BASE
|
||||||
|
########################
|
||||||
|
FROM golang:1.23.3-alpine AS base
|
||||||
|
|
||||||
|
ENV CGO_ENABLED=0 \
|
||||||
|
GOOS=linux \
|
||||||
|
GOARCH=amd64
|
||||||
|
|
||||||
|
ARG APP_UID=1000
|
||||||
|
ARG APP_GID=1000
|
||||||
|
RUN addgroup -S dashboard -g ${APP_GID} && adduser -u ${APP_UID} -S -D -G dashboard dashboard
|
||||||
|
|
||||||
|
RUN apk update \
|
||||||
|
&& apk add --no-cache bash ca-certificates tzdata curl \
|
||||||
|
&& update-ca-certificates
|
||||||
|
|
||||||
|
ENV TZ="Europe/Paris"
|
||||||
|
|
||||||
|
COPY ./app /app
|
||||||
|
WORKDIR /app
|
||||||
|
#COPY ./docker/config/env.local /usr/local/bin/.env
|
||||||
|
|
||||||
|
RUN go mod download && go mod verify
|
||||||
|
|
||||||
|
########################
|
||||||
|
# BUILD
|
||||||
|
########################
|
||||||
|
FROM base AS build-env
|
||||||
|
|
||||||
|
RUN go build -ldflags="-w -s" -o /infra-dashboard
|
||||||
|
|
||||||
|
########################
|
||||||
|
# PROD ENV ###
|
||||||
|
########################
|
||||||
|
FROM alpine:3.20 AS prod
|
||||||
|
|
||||||
|
ARG APP_UID=1000
|
||||||
|
ARG APP_GID=1000
|
||||||
|
RUN addgroup -S dashboard -g ${APP_GID} && adduser -u ${APP_UID} -S -D -G dashboard dashboard
|
||||||
|
|
||||||
|
RUN apk update \
|
||||||
|
&& apk add --no-cache bash ca-certificates tzdata curl \
|
||||||
|
&& update-ca-certificates
|
||||||
|
|
||||||
|
ENV TZ="Europe/Paris"
|
||||||
|
COPY --from=build-env /infra-dashboard /usr/local/bin/infra-dashboard
|
||||||
|
RUN chmod +x /usr/local/bin/infra-dashboard
|
||||||
|
RUN mkdir /app && chown ${APP_UID}:${APP_GID} /app
|
||||||
|
|
||||||
|
USER dashboard
|
||||||
|
|
||||||
|
########################
|
||||||
|
# DEV
|
||||||
|
########################
|
||||||
|
FROM base AS dev
|
||||||
|
|
||||||
|
COPY --from=build-env /infra-dashboard /usr/local/bin/infra-dashboard
|
||||||
|
RUN chmod +x /usr/local/bin/infra-dashboard
|
||||||
|
|
||||||
|
#ENTRYPOINT ["/bin/bash", "-c", "tail -f /dev/null"]
|
||||||
|
ENTRYPOINT ["infra-dashboard"]
|
||||||
@ -1,26 +0,0 @@
|
|||||||
package Tools
|
|
||||||
|
|
||||||
import (
|
|
||||||
"log"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/joho/godotenv"
|
|
||||||
)
|
|
||||||
|
|
||||||
// ReadDotEnvFile reads environment variables from .env file
|
|
||||||
func ReadDotEnvFile(f string) {
|
|
||||||
err := godotenv.Load(f)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal("Error loading .env file")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// InitLog ensure log file exists and set appropriate flags (remove timestamp at start of line).
|
|
||||||
func InitLog(p string) {
|
|
||||||
logFile, err := os.OpenFile(p, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
log.SetOutput(logFile)
|
|
||||||
log.SetFlags(log.Flags() &^ (log.Ldate | log.Ltime))
|
|
||||||
}
|
|
||||||
@ -26,13 +26,14 @@ func NotFound(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func logRequest(t time.Time, r *http.Request, s int) {
|
func logRequest(t time.Time, r *http.Request, s int) {
|
||||||
log.Printf("%s - - %s \"%s %s %s\" %d 0 \"-\" \"%s\" %d\n",
|
log.Printf("%s - - %s \"%s %s %s\" %d %d \"-\" \"%s\" %d\n",
|
||||||
r.Host,
|
r.Host,
|
||||||
t.Format("[02/Jan/2006:15:04:05 -0700]"),
|
t.Format("[02/Jan/2006:15:04:05 -0700]"),
|
||||||
r.Method,
|
r.Method,
|
||||||
r.URL.Path,
|
r.URL.Path,
|
||||||
r.Proto,
|
r.Proto,
|
||||||
s,
|
s,
|
||||||
|
r.ContentLength,
|
||||||
r.UserAgent(),
|
r.UserAgent(),
|
||||||
time.Since(t).Milliseconds(),
|
time.Since(t).Milliseconds(),
|
||||||
)
|
)
|
||||||
12
app/Tools/utils.go
Normal file
12
app/Tools/utils.go
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
package Tools
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
// InitLog ensure log file exists and set appropriate flags (remove timestamp at start of line).
|
||||||
|
func InitLog() {
|
||||||
|
log.SetOutput(os.Stdout)
|
||||||
|
log.SetFlags(log.Flags() &^ (log.Ldate | log.Ltime))
|
||||||
|
}
|
||||||
32
app/go.mod
Normal file
32
app/go.mod
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
module infra-dashboard
|
||||||
|
|
||||||
|
go 1.23.1
|
||||||
|
|
||||||
|
toolchain go1.23.3
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/alexflint/go-arg v1.5.1
|
||||||
|
github.com/go-sql-driver/mysql v1.8.1
|
||||||
|
github.com/gorilla/mux v1.8.1
|
||||||
|
github.com/joho/godotenv v1.5.1
|
||||||
|
gopkg.in/guregu/null.v4 v4.0.0
|
||||||
|
)
|
||||||
|
|
||||||
|
require (
|
||||||
|
filippo.io/edwards25519 v1.1.0 // indirect
|
||||||
|
github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c // indirect
|
||||||
|
github.com/alexflint/go-scalar v1.2.0 // indirect
|
||||||
|
github.com/google/go-cmp v0.6.0 // indirect
|
||||||
|
golang.org/x/exp/typeparams v0.0.0-20231108232855-2478ac86f678 // indirect
|
||||||
|
golang.org/x/mod v0.22.0 // indirect
|
||||||
|
golang.org/x/sync v0.9.0 // indirect
|
||||||
|
golang.org/x/sys v0.27.0 // indirect
|
||||||
|
golang.org/x/telemetry v0.0.0-20241106142447-58a1122356f5 // indirect
|
||||||
|
golang.org/x/text v0.20.0 // indirect
|
||||||
|
golang.org/x/tools v0.27.1-0.20241219162658-575221bfbda3 // indirect
|
||||||
|
golang.org/x/tools/gopls v0.17.1 // indirect
|
||||||
|
golang.org/x/vuln v1.0.4 // indirect
|
||||||
|
honnef.co/go/tools v0.5.1 // indirect
|
||||||
|
mvdan.cc/gofumpt v0.7.0 // indirect
|
||||||
|
mvdan.cc/xurls/v2 v2.5.0 // indirect
|
||||||
|
)
|
||||||
51
app/go.sum
Normal file
51
app/go.sum
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
||||||
|
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
||||||
|
github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c h1:pxW6RcqyfI9/kWtOwnv/G+AzdKuy2ZrqINhenH4HyNs=
|
||||||
|
github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
|
||||||
|
github.com/alexflint/go-arg v1.5.1 h1:nBuWUCpuRy0snAG+uIJ6N0UvYxpxA0/ghA/AaHxlT8Y=
|
||||||
|
github.com/alexflint/go-arg v1.5.1/go.mod h1:A7vTJzvjoaSTypg4biM5uYNTkJ27SkNTArtYXnlqVO8=
|
||||||
|
github.com/alexflint/go-scalar v1.2.0 h1:WR7JPKkeNpnYIOfHRa7ivM21aWAdHD0gEWHCx+WQBRw=
|
||||||
|
github.com/alexflint/go-scalar v1.2.0/go.mod h1:LoFvNMqS1CPrMVltza4LvnGKhaSpc3oyLEBUZVhhS2o=
|
||||||
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y=
|
||||||
|
github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
|
||||||
|
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||||
|
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||||
|
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
|
||||||
|
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
|
||||||
|
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
|
||||||
|
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
|
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||||
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
|
golang.org/x/exp/typeparams v0.0.0-20231108232855-2478ac86f678 h1:1P7xPZEwZMoBoz0Yze5Nx2/4pxj6nw9ZqHWXqP0iRgQ=
|
||||||
|
golang.org/x/exp/typeparams v0.0.0-20231108232855-2478ac86f678/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk=
|
||||||
|
golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
|
||||||
|
golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
|
||||||
|
golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ=
|
||||||
|
golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||||
|
golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
|
||||||
|
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
|
golang.org/x/telemetry v0.0.0-20241106142447-58a1122356f5 h1:TCDqnvbBsFapViksHcHySl/sW4+rTGNIAoJJesHRuMM=
|
||||||
|
golang.org/x/telemetry v0.0.0-20241106142447-58a1122356f5/go.mod h1:8nZWdGp9pq73ZI//QJyckMQab3yq7hoWi7SI0UIusVI=
|
||||||
|
golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug=
|
||||||
|
golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4=
|
||||||
|
golang.org/x/tools v0.27.1-0.20241219162658-575221bfbda3 h1:kgwdasJRsdDWYgWcEgMF424DiXwwXHSb3V8xVTi//i8=
|
||||||
|
golang.org/x/tools v0.27.1-0.20241219162658-575221bfbda3/go.mod h1:sUi0ZgbwW9ZPAq26Ekut+weQPR5eIM6GQLQ1Yjm1H0Q=
|
||||||
|
golang.org/x/tools/gopls v0.17.1 h1:Mt/DSfnnSe3dyf6MH/dZZ0iww+viHNhAFc4rEYDiOAw=
|
||||||
|
golang.org/x/tools/gopls v0.17.1/go.mod h1:niea3AFBDJrqLpvDQ8vjmtzjGcT44nAoYm/vd34SaH4=
|
||||||
|
golang.org/x/vuln v1.0.4 h1:SP0mPeg2PmGCu03V+61EcQiOjmpri2XijexKdzv8Z1I=
|
||||||
|
golang.org/x/vuln v1.0.4/go.mod h1:NbJdUQhX8jY++FtuhrXs2Eyx0yePo9pF7nPlIjo9aaQ=
|
||||||
|
gopkg.in/guregu/null.v4 v4.0.0 h1:1Wm3S1WEA2I26Kq+6vcW+w0gcDo44YKYD7YIEJNHDjg=
|
||||||
|
gopkg.in/guregu/null.v4 v4.0.0/go.mod h1:YoQhUrADuG3i9WqesrCmpNRwm1ypAgSHYqoOcTu/JrI=
|
||||||
|
gopkg.in/yaml.v3 v3.0.0 h1:hjy8E9ON/egN1tAYqKb61G10WtihqetD4sz2H+8nIeA=
|
||||||
|
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
honnef.co/go/tools v0.5.1 h1:4bH5o3b5ZULQ4UrBmP+63W9r7qIkqJClEA9ko5YKx+I=
|
||||||
|
honnef.co/go/tools v0.5.1/go.mod h1:e9irvo83WDG9/irijV44wr3tbhcFeRnfpVlRqVwpzMs=
|
||||||
|
mvdan.cc/gofumpt v0.7.0 h1:bg91ttqXmi9y2xawvkuMXyvAA/1ZGJqYAEGjXuP0JXU=
|
||||||
|
mvdan.cc/gofumpt v0.7.0/go.mod h1:txVFJy/Sc/mvaycET54pV8SW8gWxTlUuGHVEcncmNUo=
|
||||||
|
mvdan.cc/xurls/v2 v2.5.0 h1:lyBNOm8Wo71UknhUs4QTFUNNMyxy2JEIaKKo0RWOh+8=
|
||||||
|
mvdan.cc/xurls/v2 v2.5.0/go.mod h1:yQgaGQ1rFtJUzkmKiHYSSfuQxqfYmd//X6PxvholpeE=
|
||||||
@ -7,21 +7,11 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/alexflint/go-arg"
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
|
||||||
args struct {
|
|
||||||
Log string `arg:"-l,--logfile" help:"location of output logfile." default:"infra-dashboard-access.log"`
|
|
||||||
EnvFile string `arg:"-e,--envfile" help:"location of file containing environment variables." default:".env"`
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
arg.MustParse(&args)
|
tools.InitLog()
|
||||||
tools.InitLog(args.Log)
|
|
||||||
tools.ReadDotEnvFile(args.EnvFile)
|
|
||||||
|
|
||||||
router := mux.NewRouter()
|
router := mux.NewRouter()
|
||||||
|
|
||||||
0
data/.gitkeep
Normal file
0
data/.gitkeep
Normal file
38
docker-compose.yaml
Normal file
38
docker-compose.yaml
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
services:
|
||||||
|
api:
|
||||||
|
container_name: api
|
||||||
|
build:
|
||||||
|
context: ./
|
||||||
|
target: dev
|
||||||
|
ports:
|
||||||
|
- "8080:8080"
|
||||||
|
volumes:
|
||||||
|
- ./app/:/app/
|
||||||
|
env_file: ./docker/config/env.local
|
||||||
|
networks:
|
||||||
|
- infra-dashboard
|
||||||
|
depends_on:
|
||||||
|
mysql:
|
||||||
|
condition: service_started
|
||||||
|
restart: true
|
||||||
|
mysql:
|
||||||
|
image: mysql:8.4
|
||||||
|
container_name: mysql
|
||||||
|
environment:
|
||||||
|
MYSQL_ROOT_PASSWORD: root
|
||||||
|
MYSQL_DATABASE: infra_dashboard
|
||||||
|
MYSQL_USER: infra_dashboard
|
||||||
|
MYSQL_PASSWORD: sebisdown
|
||||||
|
ports:
|
||||||
|
- "3306:3306"
|
||||||
|
volumes:
|
||||||
|
- ./docker/mysql:/docker-entrypoint-initdb.d
|
||||||
|
- ./data/mysql:/var/lib/mysql
|
||||||
|
networks:
|
||||||
|
- infra-dashboard
|
||||||
|
|
||||||
|
networks:
|
||||||
|
infra-dashboard:
|
||||||
|
driver: bridge
|
||||||
4
docker/config/env.local
Normal file
4
docker/config/env.local
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
DATABASE_HOST="mysql:3306"
|
||||||
|
DATABASE_USER="infra_dashboard"
|
||||||
|
DATABASE_PASSWORD="sebisdown"
|
||||||
|
DATABASE_NAME="infra_dashboard"
|
||||||
4
docker/config/env.testsla
Normal file
4
docker/config/env.testsla
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
DATABASE_HOST="10.12.60.3:3306"
|
||||||
|
DATABASE_USER=infra_dashboard
|
||||||
|
DATABASE_PASSWORD=sebisdown
|
||||||
|
DATABASE_NAME=infra_dashboard
|
||||||
40
docker/mysql/init_infra_dashboard.sql
Normal file
40
docker/mysql/init_infra_dashboard.sql
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
USE infra_dashboard;
|
||||||
|
|
||||||
|
CREATE TABLE `dashboard_os` (
|
||||||
|
`id` int NOT NULL AUTO_INCREMENT,
|
||||||
|
`distribution` varchar(20) COLLATE utf8mb4_general_ci NOT NULL,
|
||||||
|
`version` varchar(10) COLLATE utf8mb4_general_ci NOT NULL,
|
||||||
|
`end_of_support` date DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `dashboard_os_distribution_version_73a59db0_uniq` (`distribution`,`version`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||||
|
|
||||||
|
CREATE TABLE `dashboard_package` (
|
||||||
|
`id` int NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` varchar(255) NOT NULL,
|
||||||
|
`active` int NOT NULL DEFAULT '1',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ;
|
||||||
|
|
||||||
|
CREATE TABLE `dashboard_server` (
|
||||||
|
`id` int NOT NULL AUTO_INCREMENT,
|
||||||
|
`hostname` varchar(200) COLLATE utf8mb4_general_ci NOT NULL,
|
||||||
|
`os_id` int DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `hostname` (`hostname`),
|
||||||
|
KEY `dashboard_server_os_id_1420b5ff_fk_dashboard_os_id` (`os_id`),
|
||||||
|
CONSTRAINT `dashboard_server_os_id_1420b5ff_fk_dashboard_os_id` FOREIGN KEY (`os_id`) REFERENCES `dashboard_os` (`id`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=385 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ;
|
||||||
|
|
||||||
|
CREATE TABLE `dashboard_packagestatus` (
|
||||||
|
`id` int NOT NULL AUTO_INCREMENT,
|
||||||
|
`package_name` varchar(50) COLLATE utf8mb4_general_ci NOT NULL,
|
||||||
|
`package_version` varchar(50) COLLATE utf8mb4_general_ci NOT NULL,
|
||||||
|
`server_id` int NOT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `dashboard_packagesta_server_id_a3393991_fk_dashboard` (`server_id`),
|
||||||
|
CONSTRAINT `dashboard_packagesta_server_id_a3393991_fk_dashboard` FOREIGN KEY (`server_id`) REFERENCES `dashboard_server` (`id`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=262048 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||||
|
|
||||||
|
INSERT INTO `dashboard_os` VALUES (1,'Unknown','1',NULL),(2,'Debian','4','2010-02-28'),(3,'Debian','5','2012-02-06'),(4,'Debian','6','2016-02-06'),(5,'Debian','7','2018-04-01'),(6,'Debian','8','2020-04-01'),(7,'Debian','9','2022-06-30'),(8,'Debian','10','2024-06-30'),(9,'Debian','11','2026-06-30'),(10,'Ubuntu','10.04','2015-04-30'),(11,'Ubuntu','10.10','2012-04-10'),(12,'Ubuntu','11.04','2012-10-28'),(13,'Ubuntu','11.10','2013-05-09'),(14,'Ubuntu','12.04','2017-04-01'),(15,'Ubuntu','12.10','2014-05-16'),(16,'Ubuntu','13.04','2014-01-27'),(17,'Ubuntu','13.10','2014-07-17'),(18,'Ubuntu','14.04','2019-04-01'),(19,'Ubuntu','14.10','2015-07-23'),(20,'Ubuntu','15.04','2016-02-04'),(21,'Ubuntu','15.10','2016-07-28'),(22,'Ubuntu','16.04','2021-04-01'),(23,'Ubuntu','16.10','2017-07-01'),(24,'Ubuntu','17.04','2018-01-31'),(25,'Ubuntu','17.10','2018-07-31'),(26,'Ubuntu','18.04','2023-04-01'),(27,'Ubuntu','20.04','2025-04-01'),(28,'Ubuntu','22.04','2027-04-01'),(29,'CentOS','4','2012-02-29'),(30,'CentOS','5','2017-03-31'),(31,'CentOS','6','2020-11-30'),(32,'CentOS','7','2024-06-30'),(33,'RedHat','5','2017-03-31'),(34,'RedHat','6','2020-11-30'),(35,'RedHat','7','2024-06-30'),(36,'FreeBSD','9.0','2013-03-31'),(37,'FreeBSD','9.1','2014-12-31'),(38,'FreeBSD','9.2','2014-12-31'),(39,'FreeBSD','9.3','2016-12-31'),(40,'FreeBSD','10.0','2015-02-28'),(41,'FreeBSD','10.1','2016-12-31'),(42,'FreeBSD','10.2','2016-12-31'),(43,'FreeBSD','10.3','2018-04-30'),(44,'OpenBSD','5.0','2012-11-01'),(45,'OpenBSD','5.1','2013-05-01'),(46,'OpenBSD','5.2','2013-11-01'),(47,'OpenBSD','5.3','2014-05-01'),(48,'OpenBSD','5.4','2014-11-01'),(49,'OpenBSD','5.5','2015-05-01'),(50,'OpenBSD','5.6','2015-10-18'),(51,'OpenBSD','5.7','2016-03-29'),(52,'OpenBSD','5.8','2016-09-01'),(53,'OpenBSD','5.9','2017-04-11'),(54,'OpenBSD','6.0','2017-11-09'),(55,'OpenBSD','6.1','2018-05-01'),(56,'OpenBSD','6.2','2018-11-01'),(57,'OpenBSD','6.3','2019-05-01'),(58,'OpenBSD','6.4','2019-11-01'),(59,'Debian','12','2028-06-30'),(60,'Ubuntu','24.04','2029-04-01'),(61,'Test','12','2024-04-25');
|
||||||
|
|
||||||
16
go.mod
16
go.mod
@ -1,16 +0,0 @@
|
|||||||
module infra-dashboard
|
|
||||||
|
|
||||||
go 1.20
|
|
||||||
|
|
||||||
require (
|
|
||||||
github.com/alexflint/go-arg v1.4.3
|
|
||||||
github.com/go-sql-driver/mysql v1.8.0
|
|
||||||
github.com/gorilla/mux v1.8.1
|
|
||||||
github.com/joho/godotenv v1.5.1
|
|
||||||
gopkg.in/guregu/null.v4 v4.0.0
|
|
||||||
)
|
|
||||||
|
|
||||||
require (
|
|
||||||
filippo.io/edwards25519 v1.1.0 // indirect
|
|
||||||
github.com/alexflint/go-scalar v1.1.0 // indirect
|
|
||||||
)
|
|
||||||
26
go.sum
26
go.sum
@ -1,26 +0,0 @@
|
|||||||
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
|
||||||
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
|
||||||
github.com/alexflint/go-arg v1.4.3 h1:9rwwEBpMXfKQKceuZfYcwuc/7YY7tWJbFsgG5cAU/uo=
|
|
||||||
github.com/alexflint/go-arg v1.4.3/go.mod h1:3PZ/wp/8HuqRZMUUgu7I+e1qcpUbvmS258mRXkFH4IA=
|
|
||||||
github.com/alexflint/go-scalar v1.1.0 h1:aaAouLLzI9TChcPXotr6gUhq+Scr8rl0P9P4PnltbhM=
|
|
||||||
github.com/alexflint/go-scalar v1.1.0/go.mod h1:LoFvNMqS1CPrMVltza4LvnGKhaSpc3oyLEBUZVhhS2o=
|
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
|
||||||
github.com/go-sql-driver/mysql v1.8.0 h1:UtktXaU2Nb64z/pLiGIxY4431SJ4/dR5cjMmlVHgnT4=
|
|
||||||
github.com/go-sql-driver/mysql v1.8.0/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
|
|
||||||
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
|
|
||||||
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
|
|
||||||
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
|
|
||||||
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
|
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
|
||||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
|
||||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
||||||
gopkg.in/guregu/null.v4 v4.0.0 h1:1Wm3S1WEA2I26Kq+6vcW+w0gcDo44YKYD7YIEJNHDjg=
|
|
||||||
gopkg.in/guregu/null.v4 v4.0.0/go.mod h1:YoQhUrADuG3i9WqesrCmpNRwm1ypAgSHYqoOcTu/JrI=
|
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
|
||||||
135
infra_dashboard.sql
Normal file
135
infra_dashboard.sql
Normal file
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user