Skip to content

Commit

Permalink
add skeleton for next-backend service (#1629)
Browse files Browse the repository at this point in the history
* init commit

* upd branch
  • Loading branch information
motatoes authored Jul 19, 2024
1 parent 8d752cb commit 57841d1
Show file tree
Hide file tree
Showing 45 changed files with 7,565 additions and 2 deletions.
63 changes: 63 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# flyctl launch added from .gitignore
**/.idea
**/.DS_Store
**/venv
**/**/__pycache__
**/__azurite*

# flyctl launch added from backend/.gitignore
backend/**/backend
backend/**/main
backend/**/.idea
backend/**/.DS_Store
backend/**/venv
backend/**/**/__pycache__
backend/**/__azurite*
backend/**/digger
backend/**/cloud
backend/**/*.env
backend/**/*.env.*
backend/**/.docker-compose-env
backend/**/controllers/database_test.db

# flyctl launch added from backend/tasks/.gitignore
backend/tasks/**/.env
backend/tasks/**/tasks

# flyctl launch added from cli/.gitignore
cli/**/**/digger
!cli/pkg/digger
!cli/cmd/digger

# flyctl launch added from dgctl/.gitignore
dgctl/**/.archive
dgctl/**/generated
dgctl/**/dgctl.generated.json
dgctl/**/.dgctl
dgctl/**/dgctl

# flyctl launch added from ee/backend/.gitignore
ee/backend/**/main
ee/backend/**/backend
ee/backend/**/.idea
ee/backend/**/.DS_Store
ee/backend/**/venv
ee/backend/**/**/__pycache__
ee/backend/**/__azurite*
ee/backend/**/digger
ee/backend/**/cloud
ee/backend/**/*.env
ee/backend/**/*.env.*
ee/backend/**/.docker-compose-env
ee/backend/**/controllers/database_test.db

# flyctl launch added from ee/cli/.gitignore
ee/cli/**/**/digger
!ee/cli/pkg/digger
!ee/cli/cmd/digger

# flyctl launch added from libs/digger_config/.gitignore
libs/digger_config/**/.idea

# flyctl launch added from libs/orchestrator/.gitignore
libs/orchestrator/**/.idea
2 changes: 1 addition & 1 deletion .github/workflows/next_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
push:
branches:
- develop # change to main if needed
- feat/next
- feat/nxt
pull_request:
branches:
- feat/next
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.idea/
**/.env
.DS_Store
venv/
**/__pycache__/
__azurite*
__azurite*
49 changes: 49 additions & 0 deletions Dockerfile_next
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
FROM golang:1.22 as builder
ARG COMMIT_SHA
RUN echo "commit sha: ${COMMIT_SHA}"

# Set the working directory
WORKDIR $GOPATH/src/github.com/diggerhq/digger

# Copy all required source, blacklist files that are not required through `.dockerignore`
COPY . .

# Get the vendor library
RUN go version

# RUN vgo install

# https://github.com/ethereum/go-ethereum/issues/2738
# Build static binary "-getmode=vendor" does not work with go-ethereum

RUN go build -ldflags="-X 'main.Version=${COMMIT_SHA}'" -o next_exe ./next/

# Multi-stage build will just copy the binary to an alpine image.
FROM ubuntu:24.04 as runner
ENV ATLAS_VERSION v0.16.0
ARG COMMIT_SHA
WORKDIR /app

RUN apt-get update && apt-get install -y ca-certificates curl && apt-get install -y git && apt-get clean all
RUN update-ca-certificates

RUN echo "commit sha: ${COMMIT_SHA}"

# install atlas
RUN curl -sSf https://atlasgo.sh | sh



# Set gin to production
#ENV GIN_MODE=release

# Expose the running port
EXPOSE 3000

# Copy the binary to the corresponding folder
COPY --from=builder /go/src/github.com/diggerhq/digger/next_exe /app/next
COPY --from=builder /go/src/github.com/diggerhq/digger/next/scripts/entrypoint.sh /app/entrypoint.sh
ADD next/templates ./templates

# Run the binary
ENTRYPOINT ["/bin/bash", "/app/entrypoint.sh"]
36 changes: 36 additions & 0 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# fly.toml app configuration file generated for next-backend on 2024-07-19T08:47:44+01:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = 'next-backend'
primary_region = 'lhr'
kill_signal = 'SIGINT'
kill_timeout = '5s'

[build]
dockerfile = 'Dockerfile_next'

[[services]]
protocol = 'tcp'
internal_port = 3000
processes = ['app']

[[services.ports]]
port = 80
handlers = ['http']
force_https = true

[[services.ports]]
port = 443
handlers = ['tls', 'http']

[services.concurrency]
type = 'connections'
hard_limit = 25
soft_limit = 20

[[vm]]
memory = '1gb'
cpu_kind = 'shared'
cpus = 1
1 change: 1 addition & 0 deletions go.work
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use (
./cli
./cli_e2e
./dgctl
./next

./ee/backend
./ee/cli
Expand Down
1 change: 1 addition & 0 deletions next/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env
Loading

0 comments on commit 57841d1

Please sign in to comment.