Skip to content

Commit 80d0177

Browse files
Merge pull request #7 from zopdev/development
add orphan-domain-handler
2 parents 3356f25 + 7bb865c commit 80d0177

File tree

8 files changed

+736
-0
lines changed

8 files changed

+736
-0
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Build and Deploy (prod)
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
env:
8+
SERVICE_NAME: orphan-domain-handler
9+
NAMESPACE: kops-dev
10+
CLUSTER_NAME: raramuri-tech
11+
CLUSTER_PROJECT: raramuri-tech
12+
GAR_PROJECT: raramuri-tech
13+
GAR_REGISTRY: kops-dev
14+
15+
jobs:
16+
dockerize:
17+
runs-on: ubuntu-latest
18+
name: 🐳 Dockerize
19+
20+
outputs:
21+
image: ${{ steps.output-image.outputs.image }}
22+
steps:
23+
- uses: actions/checkout@v4
24+
- uses: actions/setup-go@v4
25+
with:
26+
go-version: '1.25.1'
27+
- name: Get dependencies
28+
run: |
29+
go mod download
30+
31+
- name: Build
32+
run: |
33+
cd ./orphan-domain-handler
34+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -buildvcs=false -o main
35+
36+
- name: Login to GAR
37+
uses: docker/login-action@v2
38+
with:
39+
registry: us-central1-docker.pkg.dev
40+
username: _json_key
41+
password: ${{ secrets.ORPHAN_DOMAIN_HANDLER_KOPS_DEV_DEPLOYMENT_KEY }}
42+
43+
- name: Build and Push Docker Image to GAR
44+
uses: docker/build-push-action@v2
45+
with:
46+
push: true
47+
context: ./orphan-domain-handler
48+
file: ./DockerfileODH
49+
tags:
50+
us-central1-docker.pkg.dev/${{ env.GAR_PROJECT }}/${{ env.GAR_REGISTRY }}/${{ env.NAMESPACE }}/${{ env.SERVICE_NAME }}:${{ github.sha }}
51+
- id: output-image
52+
run:
53+
echo "image=`echo us-central1-docker.pkg.dev/${{ env.GAR_PROJECT }}/${{ env.GAR_REGISTRY }}/${{ env.NAMESPACE }}/${{ env.SERVICE_NAME }}:${{ github.sha }}`" >> "$GITHUB_OUTPUT"
54+
55+
deployment:
56+
runs-on: ubuntu-latest
57+
needs: dockerize
58+
name: 🚀 Deploy
59+
env:
60+
image: ${{ needs.dockerize.outputs.image }}
61+
62+
steps:
63+
- name: Checkout Code
64+
uses: actions/checkout@v2
65+
66+
- name: Authorize to GCP service account
67+
uses: google-github-actions/auth@v2
68+
with:
69+
credentials_json: ${{ secrets.ORPHAN_DOMAIN_HANDLER_KOPS_DEV_DEPLOYMENT_KEY }}
70+
71+
- name: Set up Cloud SDK
72+
uses: google-github-actions/setup-gcloud@v2
73+
74+
- name: Update Kubectl component
75+
run: gcloud --quiet components update kubectl
76+
77+
- name: Set GCloud Project and Fetch Cluster Credentials
78+
run:
79+
gcloud container clusters get-credentials ${{ env.CLUSTER_NAME }} --region=us-central1 --project=${{ env.CLUSTER_PROJECT }}
80+
81+
- name: Update Deployment Image
82+
run:
83+
kubectl set image deployment/${{ env.SERVICE_NAME }} ${{ env.SERVICE_NAME }}=${{ env.image }} --namespace ${{ env.NAMESPACE }}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Build and Deploy for Go service
2+
3+
on:
4+
push:
5+
branches: [ development ]
6+
7+
env:
8+
SERVICE_NAME: orphan-domain-handler
9+
NAMESPACE: kops-dev-stg
10+
CLUSTER_NAME: raramuri-tech
11+
CLUSTER_PROJECT: raramuri-tech
12+
GAR_PROJECT: raramuri-tech
13+
GAR_REGISTRY: kops-dev
14+
15+
jobs:
16+
dockerize:
17+
runs-on: ubuntu-latest
18+
name: 🐳 Dockerize
19+
20+
outputs:
21+
image: ${{ steps.output-image.outputs.image }}
22+
steps:
23+
- uses: actions/checkout@v4
24+
- uses: actions/setup-go@v4
25+
with:
26+
go-version: '1.25.1'
27+
- name: Get dependencies
28+
run: |
29+
go mod download
30+
31+
- name: Build
32+
run: |
33+
cd ./orphan-domain-handler
34+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -buildvcs=false -o main
35+
36+
- name: Login to GAR
37+
uses: docker/login-action@v2
38+
with:
39+
registry: us-central1-docker.pkg.dev
40+
username: _json_key
41+
password: ${{ secrets.ORPHAN_DOMAIN_HANDLER_KOPS_DEV_STG_DEPLOYMENT_KEY }}
42+
43+
- name: Build and Push Docker Image to GAR
44+
uses: docker/build-push-action@v2
45+
with:
46+
push: true
47+
context: ./orphan-domain-handler
48+
file: ./DockerfileODH
49+
tags:
50+
us-central1-docker.pkg.dev/${{ env.GAR_PROJECT }}/${{ env.GAR_REGISTRY }}/${{ env.NAMESPACE }}/${{ env.SERVICE_NAME }}:${{ github.sha }}
51+
- id: output-image
52+
run:
53+
echo "image=`echo us-central1-docker.pkg.dev/${{ env.GAR_PROJECT }}/${{ env.GAR_REGISTRY }}/${{ env.NAMESPACE }}/${{ env.SERVICE_NAME }}:${{ github.sha }}`" >> "$GITHUB_OUTPUT"
54+
55+
deployment:
56+
runs-on: ubuntu-latest
57+
needs: dockerize
58+
name: 🚀 Deploy
59+
env:
60+
image: ${{ needs.dockerize.outputs.image }}
61+
62+
steps:
63+
- name: Checkout Code
64+
uses: actions/checkout@v2
65+
66+
- name: Authorize to GCP service account
67+
uses: google-github-actions/auth@v2
68+
with:
69+
credentials_json: ${{ secrets.ORPHAN_DOMAIN_HANDLER_KOPS_DEV_STG_DEPLOYMENT_KEY }}
70+
71+
- name: Set up Cloud SDK
72+
uses: google-github-actions/setup-gcloud@v2
73+
74+
- name: Update Kubectl component
75+
run: gcloud --quiet components update kubectl
76+
77+
- name: Set GCloud Project and Fetch Cluster Credentials
78+
run:
79+
gcloud container clusters get-credentials ${{ env.CLUSTER_NAME }} --region=us-central1 --project=${{ env.CLUSTER_PROJECT }}
80+
81+
- name: Update Deployment Image
82+
run:
83+
kubectl set image deployment/${{ env.SERVICE_NAME }} ${{ env.SERVICE_NAME }}=${{ env.image }} --namespace ${{ env.NAMESPACE }}

DockerfileODH

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM alpine:latest
2+
3+
# Copy only the required directories and files
4+
COPY main ./main
5+
COPY ./static /static
6+
7+
8+
RUN chmod 777 /main
9+
10+
EXPOSE 8000
11+
12+
CMD ["/main"]

orphan-domain-handler/configs/.env

Whitespace-only changes.

orphan-domain-handler/go.mod

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
module orphan-domain-handler
2+
3+
go 1.25.1
4+
5+
require gofr.dev v1.46.2
6+
7+
require (
8+
cloud.google.com/go v0.120.0 // indirect
9+
cloud.google.com/go/auth v0.16.5 // indirect
10+
cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
11+
cloud.google.com/go/compute/metadata v0.9.0 // indirect
12+
cloud.google.com/go/iam v1.5.2 // indirect
13+
cloud.google.com/go/pubsub v1.49.0 // indirect
14+
filippo.io/edwards25519 v1.1.0 // indirect
15+
github.com/DATA-DOG/go-sqlmock v1.5.2 // indirect
16+
github.com/XSAM/otelsql v0.40.0 // indirect
17+
github.com/beorn7/perks v1.0.1 // indirect
18+
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
19+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
20+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
21+
github.com/dgraph-io/dgo/v210 v210.0.0-20230328113526-b66f8ae53a2d // indirect
22+
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
23+
github.com/dustin/go-humanize v1.0.1 // indirect
24+
github.com/eclipse/paho.mqtt.golang v1.5.1 // indirect
25+
github.com/felixge/httpsnoop v1.0.4 // indirect
26+
github.com/go-logr/logr v1.4.3 // indirect
27+
github.com/go-logr/stdr v1.2.2 // indirect
28+
github.com/go-sql-driver/mysql v1.9.3 // indirect
29+
github.com/gogo/protobuf v1.3.2 // indirect
30+
github.com/golang-jwt/jwt/v5 v5.3.0 // indirect
31+
github.com/google/s2a-go v0.1.9 // indirect
32+
github.com/google/uuid v1.6.0 // indirect
33+
github.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirect
34+
github.com/googleapis/gax-go/v2 v2.15.0 // indirect
35+
github.com/gorilla/mux v1.8.1 // indirect
36+
github.com/gorilla/websocket v1.5.3 // indirect
37+
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2 // indirect
38+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect
39+
github.com/joho/godotenv v1.5.1 // indirect
40+
github.com/klauspost/compress v1.18.0 // indirect
41+
github.com/lib/pq v1.10.9 // indirect
42+
github.com/mattn/go-isatty v0.0.20 // indirect
43+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
44+
github.com/ncruces/go-strftime v0.1.9 // indirect
45+
github.com/openzipkin/zipkin-go v0.4.3 // indirect
46+
github.com/pierrec/lz4/v4 v4.1.22 // indirect
47+
github.com/pkg/errors v0.9.1 // indirect
48+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
49+
github.com/prometheus/client_golang v1.23.2 // indirect
50+
github.com/prometheus/client_model v0.6.2 // indirect
51+
github.com/prometheus/common v0.66.1 // indirect
52+
github.com/prometheus/otlptranslator v1.0.0 // indirect
53+
github.com/prometheus/procfs v0.17.0 // indirect
54+
github.com/redis/go-redis/extra/rediscmd/v9 v9.14.0 // indirect
55+
github.com/redis/go-redis/extra/redisotel/v9 v9.14.0 // indirect
56+
github.com/redis/go-redis/v9 v9.14.0 // indirect
57+
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
58+
github.com/segmentio/kafka-go v0.4.49 // indirect
59+
github.com/stretchr/testify v1.11.1 // indirect
60+
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
61+
github.com/xdg-go/scram v1.1.2 // indirect
62+
github.com/xdg-go/stringprep v1.0.4 // indirect
63+
go.opencensus.io v0.24.0 // indirect
64+
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
65+
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0 // indirect
66+
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.63.0 // indirect
67+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 // indirect
68+
go.opentelemetry.io/otel v1.38.0 // indirect
69+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 // indirect
70+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0 // indirect
71+
go.opentelemetry.io/otel/exporters/prometheus v0.60.0 // indirect
72+
go.opentelemetry.io/otel/exporters/zipkin v1.38.0 // indirect
73+
go.opentelemetry.io/otel/metric v1.38.0 // indirect
74+
go.opentelemetry.io/otel/sdk v1.38.0 // indirect
75+
go.opentelemetry.io/otel/sdk/metric v1.38.0 // indirect
76+
go.opentelemetry.io/otel/trace v1.38.0 // indirect
77+
go.opentelemetry.io/proto/otlp v1.7.1 // indirect
78+
go.uber.org/mock v0.6.0 // indirect
79+
go.yaml.in/yaml/v2 v2.4.2 // indirect
80+
golang.org/x/crypto v0.42.0 // indirect
81+
golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b // indirect
82+
golang.org/x/net v0.44.0 // indirect
83+
golang.org/x/oauth2 v0.31.0 // indirect
84+
golang.org/x/sync v0.17.0 // indirect
85+
golang.org/x/sys v0.36.0 // indirect
86+
golang.org/x/term v0.35.0 // indirect
87+
golang.org/x/text v0.29.0 // indirect
88+
golang.org/x/time v0.13.0 // indirect
89+
google.golang.org/api v0.251.0 // indirect
90+
google.golang.org/genproto v0.0.0-20250603155806-513f23925822 // indirect
91+
google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5 // indirect
92+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250929231259-57b25ae835d4 // indirect
93+
google.golang.org/grpc v1.76.0 // indirect
94+
google.golang.org/protobuf v1.36.10 // indirect
95+
gopkg.in/yaml.v3 v3.0.1 // indirect
96+
modernc.org/libc v1.66.3 // indirect
97+
modernc.org/mathutil v1.7.1 // indirect
98+
modernc.org/memory v1.11.0 // indirect
99+
modernc.org/sqlite v1.39.0 // indirect
100+
)

0 commit comments

Comments
 (0)