Purged old Git Server Added NEW! :)
This commit is contained in:
parent
370cfc5a23
commit
ac70ce47dd
19 changed files with 27 additions and 249 deletions
|
@ -1,15 +0,0 @@
|
|||
variables:
|
||||
REPO_NAME: git.ucode.space/Phil/goshorly
|
||||
DOCKER_BUILDKIT: 1
|
||||
|
||||
stages:
|
||||
- test
|
||||
- build-binary
|
||||
- build-docker
|
||||
- deploy
|
||||
|
||||
include:
|
||||
- '/.gitlab/ci/always.yml'
|
||||
- '/.gitlab/ci/main-branch.yml'
|
||||
- '/.gitlab/ci/merge-request.yml'
|
||||
- '/.gitlab/ci/tagged-build.yml'
|
|
@ -1,22 +0,0 @@
|
|||
check-format:
|
||||
image: golang:latest
|
||||
stage: test
|
||||
before_script:
|
||||
- mkdir -p $GOPATH/src/$(dirname $REPO_NAME)
|
||||
- ln -svf $CI_PROJECT_DIR $GOPATH/src/$REPO_NAME
|
||||
- cd $GOPATH/src/$REPO_NAME
|
||||
script:
|
||||
- go fmt $(go list ./... | grep -v /vendor/)
|
||||
- go vet $(go list ./... | grep -v /vendor/)
|
||||
- go test -race $(go list ./... | grep -v /vendor/)
|
||||
|
||||
check-gosec:
|
||||
image: golang:latest
|
||||
before_script:
|
||||
- mkdir -p $GOPATH/src/$(dirname $REPO_NAME)
|
||||
- ln -svf $CI_PROJECT_DIR $GOPATH/src/$REPO_NAME
|
||||
- cd $GOPATH/src/$REPO_NAME
|
||||
script:
|
||||
- go install github.com/securego/gosec/v2/cmd/gosec@latest
|
||||
- go get -v -d .
|
||||
- gosec ./...
|
|
@ -1,52 +0,0 @@
|
|||
build-test-linux-amd64:
|
||||
image: golang:latest
|
||||
stage: build-binary
|
||||
variables:
|
||||
GOOS: "linux"
|
||||
GOARCH: "amd64"
|
||||
CGO_ENABLED: 0
|
||||
before_script:
|
||||
- go get -d -v ./...
|
||||
- apt install curl -y
|
||||
script:
|
||||
- go build -a -installsuffix cgo -ldflags="-X $I_PACKAGE.CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA -X $I_PACKAGE.CI_COMMIT_BRANCH=$CI_COMMIT_BRANCH -X $I_PACKAGE.CI_COMMIT_TAG=$CI_COMMIT_TAG" -o linux-amd64 .
|
||||
only:
|
||||
- main
|
||||
artifacts:
|
||||
paths:
|
||||
- linux-amd64
|
||||
expire_in: 1 week
|
||||
|
||||
docker-build-prod-latest:
|
||||
image: jdrouet/docker-with-buildx:stable
|
||||
stage: build-docker
|
||||
services:
|
||||
- docker:dind
|
||||
before_script:
|
||||
- docker context create build
|
||||
- docker buildx create build --use
|
||||
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
||||
script:
|
||||
- |
|
||||
docker buildx build \
|
||||
--platform linux/amd64,linux/arm64 \
|
||||
--build-arg CI_COMMIT_BRANCH=$CI_COMMIT_BRANCH \
|
||||
--build-arg CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA \
|
||||
--build-arg CI_COMMIT_TAG=$CI_COMMIT_TAG \
|
||||
--push \
|
||||
--tag $CI_REGISTRY_IMAGE:latest \
|
||||
.
|
||||
only:
|
||||
- main
|
||||
|
||||
pages:
|
||||
stage: deploy
|
||||
image: python:alpine
|
||||
script:
|
||||
- pip install --no-cache-dir -r mkdocs-req.txt
|
||||
- python -m mkdocs build --strict --verbose
|
||||
artifacts:
|
||||
paths:
|
||||
- public
|
||||
rules:
|
||||
- if: $CI_COMMIT_REF_NAME == "main"
|
|
@ -1,17 +0,0 @@
|
|||
docker-build-dry-run:
|
||||
image: docker:latest
|
||||
stage: build-docker
|
||||
services:
|
||||
- docker:dind
|
||||
script:
|
||||
- |
|
||||
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
|
||||
tag=""
|
||||
echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'"
|
||||
else
|
||||
tag=":$CI_COMMIT_REF_SLUG"
|
||||
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
|
||||
fi
|
||||
- docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
|
||||
only:
|
||||
- merge_requests
|
|
@ -1,119 +0,0 @@
|
|||
release-prod-linux-amd64:
|
||||
image: golang:latest
|
||||
stage: build-binary
|
||||
variables:
|
||||
GOOS: "linux"
|
||||
GOARCH: "amd64"
|
||||
CGO_ENABLED: 0
|
||||
before_script:
|
||||
- go get -d -v ./...
|
||||
- apt install curl -y
|
||||
script:
|
||||
- go build -a -installsuffix cgo -ldflags="-X $I_PACKAGE.CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA -X $I_PACKAGE.CI_COMMIT_BRANCH=$CI_COMMIT_BRANCH -X $I_PACKAGE.CI_COMMIT_TAG=$CI_COMMIT_TAG" -o linux-amd64 .
|
||||
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file linux-amd64 "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/release-${CI_COMMIT_TAG}/${CI_COMMIT_TAG}/linux-amd64"'
|
||||
- rm linux-amd64
|
||||
only:
|
||||
- tags
|
||||
except:
|
||||
- branches
|
||||
|
||||
release-prod-linux-arm64:
|
||||
image: golang:latest
|
||||
stage: build-binary
|
||||
variables:
|
||||
GOOS: "linux"
|
||||
GOARCH: "arm64"
|
||||
CGO_ENABLED: 0
|
||||
before_script:
|
||||
- go get -d -v ./...
|
||||
- apt install curl -y
|
||||
script:
|
||||
- go build -a -installsuffix cgo -ldflags="-X $I_PACKAGE.CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA -X $I_PACKAGE.CI_COMMIT_BRANCH=$CI_COMMIT_BRANCH -X $I_PACKAGE.CI_COMMIT_TAG=$CI_COMMIT_TAG" -o linux-arm64 .
|
||||
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file linux-arm64 "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/release-${CI_COMMIT_TAG}/${CI_COMMIT_TAG}/linux-arm64"'
|
||||
- rm linux-arm64
|
||||
only:
|
||||
- tags
|
||||
except:
|
||||
- branches
|
||||
|
||||
release-prod-darwin-amd64:
|
||||
image: golang:latest
|
||||
stage: build-binary
|
||||
variables:
|
||||
GOOS: "darwin"
|
||||
GOARCH: "amd64"
|
||||
CGO_ENABLED: 0
|
||||
before_script:
|
||||
- go get -d -v ./...
|
||||
- apt install curl -y
|
||||
script:
|
||||
- go build -a -installsuffix cgo -ldflags="-X $I_PACKAGE.CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA -X $I_PACKAGE.CI_COMMIT_BRANCH=$CI_COMMIT_BRANCH -X $I_PACKAGE.CI_COMMIT_TAG=$CI_COMMIT_TAG" -o darwin-amd64 .
|
||||
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file darwin-amd64 "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/release-${CI_COMMIT_TAG}/${CI_COMMIT_TAG}/darwin-amd64"'
|
||||
- rm darwin-amd64
|
||||
only:
|
||||
- tags
|
||||
except:
|
||||
- branches
|
||||
|
||||
release-prod-darwin-arm64:
|
||||
image: golang:latest
|
||||
stage: build-binary
|
||||
variables:
|
||||
GOOS: "darwin"
|
||||
GOARCH: "arm64"
|
||||
CGO_ENABLED: 0
|
||||
before_script:
|
||||
- go get -d -v ./...
|
||||
- apt install curl -y
|
||||
script:
|
||||
- go build -a -installsuffix cgo -ldflags="-X $I_PACKAGE.CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA -X $I_PACKAGE.CI_COMMIT_BRANCH=$CI_COMMIT_BRANCH -X $I_PACKAGE.CI_COMMIT_TAG=$CI_COMMIT_TAG" -o darwin-arm64 .
|
||||
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file darwin-arm64 "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/release-${CI_COMMIT_TAG}/${CI_COMMIT_TAG}/darwin-arm64"'
|
||||
- rm darwin-arm64
|
||||
only:
|
||||
- tags
|
||||
except:
|
||||
- branches
|
||||
|
||||
release-prod-windows-amd64:
|
||||
image: golang:latest
|
||||
stage: build-binary
|
||||
variables:
|
||||
GOOS: "windows"
|
||||
GOARCH: "amd64"
|
||||
CGO_ENABLED: 0
|
||||
before_script:
|
||||
- go get -d -v ./...
|
||||
- apt install curl -y
|
||||
script:
|
||||
- go build -a -installsuffix cgo -ldflags="-X $I_PACKAGE.CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA -X $I_PACKAGE.CI_COMMIT_BRANCH=$CI_COMMIT_BRANCH -X $I_PACKAGE.CI_COMMIT_TAG=$CI_COMMIT_TAG" -o windows-amd64.exe .
|
||||
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file windows-amd64.exe "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/release-${CI_COMMIT_TAG}/${CI_COMMIT_TAG}/windows-amd64.exe"'
|
||||
- rm windows-amd64.exe
|
||||
only:
|
||||
- tags
|
||||
except:
|
||||
- branches
|
||||
|
||||
docker-build-prod-tagged:
|
||||
image: jdrouet/docker-with-buildx:stable
|
||||
stage: build-docker
|
||||
services:
|
||||
- docker:dind
|
||||
before_script:
|
||||
- docker context create build
|
||||
- docker buildx create build --use
|
||||
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
||||
script:
|
||||
- |
|
||||
docker buildx build \
|
||||
--platform linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7 \
|
||||
--no-cache \
|
||||
--build-arg CI_COMMIT_BRANCH=$CI_COMMIT_BRANCH \
|
||||
--build-arg CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA \
|
||||
--build-arg CI_COMMIT_TAG=$CI_COMMIT_TAG \
|
||||
--push \
|
||||
--tag $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG \
|
||||
.
|
||||
only:
|
||||
- tags
|
||||
except:
|
||||
- branches
|
|
@ -10,10 +10,10 @@ ENV CI_COMMIT_BRANCH=$CI_COMMIT_BRANCH
|
|||
ENV CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA
|
||||
ENV CI_COMMIT_TAG=$CI_COMMIT_TAG
|
||||
|
||||
ENV I_PACKAGE="git.ucode.space/Phil/goshorly/utils"
|
||||
ENV I_PACKAGE="gitea.hackmi.ch/Phil/goshorly/utils"
|
||||
ENV CGO_ENABLED=0
|
||||
|
||||
WORKDIR /go/src/git.ucode.space/goshorly
|
||||
WORKDIR /go/src/gitea.hackmi.ch/goshorly
|
||||
COPY . .
|
||||
|
||||
RUN go get -d -v ./...
|
||||
|
@ -22,5 +22,5 @@ RUN go build -a -installsuffix cgo -ldflags=" -X $I_PACKAGE.CI_COMMIT_SHORT_SHA=
|
|||
|
||||
FROM scratch as production
|
||||
WORKDIR /
|
||||
COPY --from=builder /go/src/git.ucode.space/goshorly/app /app
|
||||
COPY --from=builder /go/src/gitea.hackmi.ch/goshorly/app /app
|
||||
ENTRYPOINT [ "/app" ]
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
![](https://git.ucode.space/Phil/goshorly/badges/main/pipeline.svg)
|
||||
# goshorly
|
||||
|
||||
An easy self-hosted Link shortener in Golang with Redis <3 [Live-Demo](https://goshrt.de)
|
||||
An easy self-hosted Link shortener in Golang with Redis <3
|
||||
|
||||
---
|
||||
|
||||
Live-Demo currently not available
|
||||
|
||||
---
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"context"
|
||||
"log"
|
||||
|
||||
"git.ucode.space/Phil/goshorly/utils"
|
||||
"gitea.hackmi.ch/Phil/goshorly/utils"
|
||||
"github.com/go-redis/redis/v8"
|
||||
)
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
## Download
|
||||
Get the newest binary build from the package registry.
|
||||
- https://git.ucode.space/Phil/goshorly/-/packages
|
||||
- https://gitea.hackmi.ch/Phil/goshorly/-/packages
|
||||
|
||||
## Get dependencies
|
||||
To get goshorly running you need redis.
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
# Docker installation
|
||||
|
||||
## Available Docker tags
|
||||
- https://git.ucode.space/Phil/goshorly/container_registry/1
|
||||
- https://gitea.hackmi.ch/Phil/goshorly/container_registry/1
|
||||
|
||||
## docker-compose (with no reverse proxy)
|
||||
```bash
|
||||
mkdir goshorly
|
||||
cd goshorly
|
||||
wget https://git.ucode.space/Phil/goshorly/-/raw/main/docker-compose.yml
|
||||
wget https://gitea.hackmi.ch/Phil/goshorly/-/raw/main/docker-compose.yml
|
||||
nano docker-compose.yml # Change the environment variables to your needs
|
||||
docker-compose up -d
|
||||
```
|
||||
|
@ -16,7 +16,7 @@ docker-compose up -d
|
|||
```bash
|
||||
mkdir goshorly
|
||||
cd goshorly
|
||||
wget https://git.ucode.space/Phil/goshorly/-/raw/main/docker-compose-proxy.yml
|
||||
wget https://gitea.hackmi.ch/Phil/goshorly/-/raw/main/docker-compose-proxy.yml
|
||||
mv docker-compose-proxy.yml docker-compose.yml
|
||||
nano docker-compose.yml # Change the command line on caddy to your domain & environment variables to your needs
|
||||
docker-compose up -d
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Welcome to goshorly
|
||||
![](https://git.ucode.space/Phil/goshorly/badges/main/pipeline.svg)
|
||||
![](https://gitea.hackmi.ch/Phil/goshorly/badges/main/pipeline.svg)
|
||||
|
||||
goshorly is an easy to use and self-hostable link shortener. It is based on the Golang programming language. Redis is used as the database.
|
||||
|
||||
|
|
2
go.mod
2
go.mod
|
@ -1,4 +1,4 @@
|
|||
module git.ucode.space/Phil/goshorly
|
||||
module gitea.hackmi.ch/Phil/goshorly
|
||||
|
||||
go 1.17
|
||||
|
||||
|
|
6
main.go
6
main.go
|
@ -5,9 +5,9 @@ import (
|
|||
"log"
|
||||
"net/http"
|
||||
|
||||
"git.ucode.space/Phil/goshorly/db"
|
||||
"git.ucode.space/Phil/goshorly/routes"
|
||||
"git.ucode.space/Phil/goshorly/utils"
|
||||
"gitea.hackmi.ch/Phil/goshorly/db"
|
||||
"gitea.hackmi.ch/Phil/goshorly/routes"
|
||||
"gitea.hackmi.ch/Phil/goshorly/utils"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/gofiber/fiber/v2/middleware/limiter"
|
||||
"github.com/gofiber/template/html"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
site_name: goshorly docs
|
||||
site_url: https://phil.mekelek.de/goshorly
|
||||
repo_url: https://git.ucode.space/Phil/goshorly
|
||||
repo_url: https://gitea.hackmi.ch/Phil/goshorly
|
||||
site_dir: public
|
||||
theme:
|
||||
name: material
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package routes
|
||||
|
||||
import (
|
||||
"git.ucode.space/Phil/goshorly/db"
|
||||
"git.ucode.space/Phil/goshorly/utils"
|
||||
"gitea.hackmi.ch/Phil/goshorly/db"
|
||||
"gitea.hackmi.ch/Phil/goshorly/utils"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ package routes
|
|||
import (
|
||||
"log"
|
||||
|
||||
"git.ucode.space/Phil/goshorly/db"
|
||||
"git.ucode.space/Phil/goshorly/utils"
|
||||
"gitea.hackmi.ch/Phil/goshorly/db"
|
||||
"gitea.hackmi.ch/Phil/goshorly/utils"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ import (
|
|||
"regexp"
|
||||
"time"
|
||||
|
||||
"git.ucode.space/Phil/goshorly/db"
|
||||
"git.ucode.space/Phil/goshorly/utils"
|
||||
"gitea.hackmi.ch/Phil/goshorly/db"
|
||||
"gitea.hackmi.ch/Phil/goshorly/utils"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
gonanoid "github.com/matoous/go-nanoid/v2"
|
||||
)
|
||||
|
|
|
@ -3,7 +3,7 @@ package routes
|
|||
import (
|
||||
"time"
|
||||
|
||||
"git.ucode.space/Phil/goshorly/db"
|
||||
"gitea.hackmi.ch/Phil/goshorly/db"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
<!-- Footer with Build-Check -->
|
||||
<footer>
|
||||
<center>
|
||||
Made with <a href="https://git.ucode.space/Phil/goshorly"><i class="fas fa-code-branch"></i>
|
||||
Made with <a href="https://gitea.hackmi.ch/Phil/goshorly"><i class="fas fa-code-branch"></i>
|
||||
Phil/goshorly</a>
|
||||
{{ if .CI_BUILD }}
|
||||
{{ if .CI_COMMIT_TAG }}
|
||||
|
|
Loading…
Reference in a new issue