diff --git a/.codeclimate.yml b/.codeclimate.yml deleted file mode 100644 index 658e7d16..00000000 --- a/.codeclimate.yml +++ /dev/null @@ -1,21 +0,0 @@ -version: "2" - -checks: - similar-code: - config: - threshold: 110 # Golang default: 100 - identical-code: - config: - threshold: 110 # Golang default: 100 - -plugins: - golint: - enabled: false - govet: - enabled: false - gofmt: - enabled: false - -exclude_patterns: - - "**/*_mock.go" - - "**/*_test.go" diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml deleted file mode 100644 index 7c4482eb..00000000 --- a/.github/workflows/docker-image.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: Create and publish Poseidon image - -on: - push: - branches: [ main ] - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - -jobs: - build-and-push-image: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version-file: go.mod - - uses: actions/cache@v4 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - name: Build - run: make build - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - name: Build and push Docker image - uses: docker/build-push-action@v6 - with: - context: . - file: deploy/poseidon/Dockerfile - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} diff --git a/Makefile b/Makefile index 46b8e32e..70ac7009 100644 --- a/Makefile +++ b/Makefile @@ -66,11 +66,6 @@ build-cover: deps ## Build the binary and with coverage support for e2e-tests clean: ## Remove previous build @rm -f poseidon -.PHONY: docker -docker: - @CGO_ENABLED=0 make build - @docker build -t $(DOCKER_TAG) -f deploy/poseidon/Dockerfile . - .PHONY: lint-deps lint-deps: ## Install linter dependencies @go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest diff --git a/deploy/api.tpl.nomad b/deploy/api.tpl.nomad deleted file mode 100644 index fb4843c7..00000000 --- a/deploy/api.tpl.nomad +++ /dev/null @@ -1,90 +0,0 @@ -job "${NOMAD_SLUG}" { - datacenters = ["dc1"] - namespace = "${NOMAD_NAMESPACE}" - - group "api" { - count = 1 - - update { - // https://learn.hashicorp.com/tutorials/nomad/job-rolling-update - max_parallel = 1 - min_healthy_time = "30s" - healthy_deadline = "5m" - progress_deadline = "10m" - auto_revert = true - } - - // Don't allow rescheduling to fail deployment and pipeline if task fails - reschedule { - attempts = 0 - unlimited = false - } - - // No restarts to immediately fail the deployment and pipeline on first task fail - restart { - attempts = 0 - } - - network { - mode = "cni/secure-bridge" - - port "http" { - to = 7200 - } - } - - service { - # urlprefix- tag allows Fabio to discover this service and proxy traffic correctly - tags = ["urlprefix-${HOSTNAME}:80/"] - name = "${NOMAD_SLUG}" - port = "http" - - // Health check to let Consul know we are alive - check { - name = "health-check" - type = "http" - port = "http" - path = "/api/v1/health" - interval = "10s" - timeout = "2s" - check_restart { - limit = 3 // auto-restart task when health check fails 3x in a row - } - - } - } - - task "api" { - driver = "docker" - - config { - image = "${IMAGE_NAME_ENV}" - } - - template { - data = < /dev/null -RUN apt-get update && \ - apt-get install -y docker-ce docker-ce-cli containerd.io && \ - rm -rf /var/lib/apt/lists - -ENV NOMAD_VERSION="1.1.2" - -# Download Nomad -RUN wget "https://releases.hashicorp.com/nomad/${NOMAD_VERSION}/nomad_${NOMAD_VERSION}_linux_amd64.zip" && \ - wget "https://releases.hashicorp.com/nomad/${NOMAD_VERSION}/nomad_${NOMAD_VERSION}_SHA256SUMS" && \ - grep "nomad_${NOMAD_VERSION}_linux_amd64.zip" nomad_${NOMAD_VERSION}_SHA256SUMS | sha256sum -c - && \ - unzip nomad_${NOMAD_VERSION}_linux_amd64.zip - -# Install Nomad -RUN mv nomad /usr/sbin/ && nomad -version diff --git a/deploy/nomad-ci/README.md b/deploy/nomad-ci/README.md deleted file mode 100644 index 8bcced1a..00000000 --- a/deploy/nomad-ci/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# Nomad-in-Docker Image - -The [`Dockerfile`](Dockerfile) in this folder creates a Docker image that contains Docker and Nomad. - -Running the image requires the following Docker options: - -- Allow Nomad to use mount: `--cap-add=SYS_ADMIN` -- Allow Nomad to use bind mounts: `--security-opt apparmor=unconfined` -- Add access to Docker daemon: `-v /var/run/docker.sock:/var/run/docker.sock` -- Map port to host: `-p 4646:4646` - -A complete command to run the container is as follows. - -```shell -docker run --rm --name nomad \ - --cap-add=SYS_ADMIN \ - --security-opt apparmor=unconfined \ - -v /var/run/docker.sock:/var/run/docker.sock \ - -p 4646:4646 \ - nomad-ci -``` diff --git a/deploy/nomad-run-env-job.sh b/deploy/nomad-run-env-job.sh deleted file mode 100755 index 01f91841..00000000 --- a/deploy/nomad-run-env-job.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -# This script substitutes environment variables in the given Nomad job and runs it afterwards. - -if [[ "$#" -ne 2 ]]; then - echo "Usage: $0 path/to/infile path/to/outfile" -fi - -envsubst "$(env | sed -e 's/=.*//' -e 's/^/\$/g')" < $1 > $2 -nomad validate $2 -# nomad plan returns 1 if allocations are created or destroyed which is what we want here -# https://www.nomadproject.io/docs/commands/job/plan#usage -nomad plan $2 || [ $? == 1 ] -nomad run $2 diff --git a/deploy/poseidon/Dockerfile b/deploy/poseidon/Dockerfile deleted file mode 100644 index 11777e55..00000000 --- a/deploy/poseidon/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM alpine:latest - -RUN adduser --disabled-password api -USER api -COPY poseidon /home/api/ - -EXPOSE 7200 -CMD ["/home/api/poseidon"] diff --git a/git_hooks/pre-commit b/git_hooks/pre-commit deleted file mode 100755 index 380da79c..00000000 --- a/git_hooks/pre-commit +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright (c) 2010, Evan Shaw -################################################################################### -# NOTE: This file needs to be copied to .git/hooks/pre-commit to enable the hook. -################################################################################### -# Taken from https://github.com/edsrzf/gofmt-git-hook/blob/master/fmt-check -# Runs gofmt on the changes before committing. -# Aborts the commit with a warning if gofmt needs to be run first. -################################################################################### -#!/bin/sh - -test_fmt() { - hash gofmt 2>&- || { echo >&2 "gofmt not in PATH."; exit 1; } - IFS=' -' - for file in `git diff --cached --name-only --diff-filter=ACM | grep '\.go$'` - do - output=`git cat-file -p :$file | gofmt -l 2>&1` - if test $? -ne 0 - then - output=`echo "$output" | sed "s,,$file,"` - syntaxerrors="${list}${output}\n" - elif test -n "$output" - then - list="${list}${file}\n" - fi - done - exitcode=0 - if test -n "$syntaxerrors" - then - echo >&2 "gofmt found syntax errors:" - printf "$syntaxerrors" - exitcode=1 - fi - if test -n "$list" - then - echo >&2 "gofmt needs to format these files (run gofmt -w and git add):" - printf "$list" - exitcode=1 - fi - exit $exitcode -} - -case "$1" in - --about ) - echo "Check Go code formatting" - ;; - * ) - test_fmt - ;; -esac