Skip to content

Commit

Permalink
switched to experiment/format branch updatedcode
Browse files Browse the repository at this point in the history
  • Loading branch information
kingmariano committed Jun 28, 2024
1 parent 352814d commit cb3e621
Show file tree
Hide file tree
Showing 1,622 changed files with 410 additions and 828,338 deletions.
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2
updates:
# Configuration for Go modules
- package-ecosystem: "gomod"
directory: "/" # Location of the go.mod file
schedule:
interval: "weekly" # Options: daily, weekly, monthly
open-pull-requests-limit: 5

# Configuration for Python dependencies
- package-ecosystem: "pip"
directory: "/python" #
schedule:
interval: "weekly" # Options: daily, weekly, monthly
open-pull-requests-limit: 5
44 changes: 24 additions & 20 deletions .github/workflows/golang-pipeline.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Go CI/CD Pipeline
name: ci Pipeline

on:
push:
Expand Down Expand Up @@ -31,57 +31,61 @@ jobs:
- name: Install ffmpeg
run: sudo apt-get install -y ffmpeg

- name: Change directory to go folder
working-directory: ./golang-server
run: echo "Changed directory to golang-server"
- name: Install Python 3.11
run: |
sudo apt-get update
sudo apt-get install -y python3.11 python3.11-venv python3.11-dev python3.11-distutils
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1
python3 --version
- name: Set up Python environment
run: |
python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip
- name: Install Python dependencies
run: |
source venv/bin/activate
pip install -r ./python/requirements.txt
- name: Set environment variables
run: |
echo "API_KEY=${{ secrets.MY_API_KEY }}" >> $GITHUB_ENV
echo "GROK_API_KEY=${{ secrets.GROK_API_KEY }}" >> $GITHUB_ENV
echo "REPLICATE_API_TOKEN=${{secrets.REPLICATE_API_TOKEN}}" >> $GITHUB_ENV
echo "CLOUDINARY_URL=${{secrets.CLOUDINARY_URL}}" >> $GITHUB_ENV
echo "YOUTUBE_DEVELOPER_KEY=${{secrets.YOUTUBE_DEVELOPER_KEY}}" >> $GITHUB_ENV
echo "REPLICATE_API_TOKEN=${{ secrets.REPLICATE_API_TOKEN }}" >> $GITHUB_ENV
echo "CLOUDINARY_URL=${{ secrets.CLOUDINARY_URL }}" >> $GITHUB_ENV
echo "YOUTUBE_DEVELOPER_KEY=${{ secrets.YOUTUBE_DEVELOPER_KEY }}" >> $GITHUB_ENV
echo "PORT=8000" >> $GITHUB_ENV
- name: Fetch dependencies
working-directory: ./golang-server
run: make deps

- name: Update dependencies
working-directory: ./golang-server
run: make update

- name: Format code
working-directory: ./golang-server
run: make fmt

- name: Build
working-directory: ./golang-server
run: make build

- name: Test
working-directory: ./golang-server
run: make test

- name: Echo Go version
working-directory: ./golang-server
run: go version

- name: Install staticcheck
working-directory: ./golang-server
run: go install honnef.co/go/tools/cmd/staticcheck@latest

- name: Static Check
working-directory: ./golang-server
run: make static-check

- name: Install gosec
working-directory: ./golang-server
run: go install github.com/securego/gosec/v2/cmd/gosec@latest

- name: Security Scan
working-directory: ./golang-server
run: make security-scan

- name: Login to Docker Hub
Expand All @@ -93,7 +97,7 @@ jobs:
- name: Build and push Golang Docker image
uses: docker/build-push-action@v3
with:
context: ./golang-server
context: .
push: true
tags: charlesozo/omnicron-go:latest, charlesozo/omnicron-go:${{github.run_number}}
build-args: |
Expand Down
43 changes: 0 additions & 43 deletions .github/workflows/python-pipeline.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.env
.gitignore
golang-server/omnicron
omnicron
waste.txt
golang-server/tests/replicate_test.go
tests/replicate_test.go
vendor/
34 changes: 30 additions & 4 deletions golang-server/Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@ WORKDIR /build
# Set build arguments for API keys
ARG MY_API_KEY
ARG GROK_API_KEY

ARG GEMINI_PRO_API_KEY
ARG REPLICATE_API_TOKEN
ARG CLOUDINARY_URL
ARG YOUTUBE_DEVELOPER_KEY
# Set environment variables from build arguments
ENV MY_API_KEY=$MY_API_KEY
ENV GROK_API_KEY=$GROK_API_KEY
ENV MY_API_KEY=${MY_API_KEY}
ENV GROK_API_KEY=${GROK_API_KEY}
ENV GEMINI_PRO_API_KEY=${GEMINI_PRO_API_KEY}
ENV REPLICATE_API_TOKEN=${REPLICATE_API_TOKEN}
ENV YOUTUBE_DEVELOPER_KEY=${YOUTUBE_DEVELOPER_KEY}
ENV PORT=9000
ENV HEALTHCHECK_ENDPOINT=http://localhost:${PORT}/api/v1/readiness

Expand All @@ -26,7 +32,21 @@ RUN go mod tidy
RUN go build -o ./omnicron

# Install ffmpeg
RUN apk add --no-cache ffmpeg
RUN apt-get update && apt-get install -y ffmpeg

# Install Python 3.11 and dependencies
RUN apk add --no-cache python3 py3-pip python3-dev build-base

RUN python3 -m ensurepip

RUN pip3 install --upgrade pip

COPY ./python/requirements.txt ./python/requirements.txt

RUN pip install --upgrade --no-cache-dir -r ./python/requirements.txt

# Remove the default uvloop.
RUN pip uninstall -y uvloop

# Deploy the application binary into a lean image
FROM gcr.io/distroless/base-debian11
Expand All @@ -40,6 +60,12 @@ COPY --from=builder /build/omnicron ./omnicron
COPY --from=builder /usr/bin/ffmpeg /usr/bin/ffmpeg
COPY --from=builder /usr/share/ffmpeg /usr/share/ffmpeg

# Copy Python and dependencies from the builder stage
COPY --from=builder /usr/local/lib/python3.11 /usr/local/lib/python3.11
COPY --from=builder /usr/local/bin/python3.11 /usr/local/bin/python3.11
COPY --from=builder /usr/local/bin/pip3 /usr/local/bin/pip3
COPY ./python /app/python

# Define the health check command
HEALTHCHECK --interval=1m --timeout=10s --retries=10 \
CMD curl -f $HEALTHCHECK_ENDPOINT || exit 1
Expand Down
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions golang-server/go.mod → go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module github.com/kingmariano/omnicron-backendsever/golang-server
module github.com/kingmariano/omnicron

go 1.22.4

require (
github.com/cloudinary/cloudinary-go v1.7.0
github.com/go-chi/chi/v5 v5.0.13
github.com/go-chi/chi/v5 v5.0.14
github.com/go-ozzo/ozzo-validation v3.6.0+incompatible
github.com/google/uuid v1.6.0
github.com/iawia002/lux v0.24.1
Expand All @@ -14,11 +14,11 @@ require (
github.com/stretchr/testify v1.9.0
github.com/u2takey/ffmpeg-go v0.5.0
go.uber.org/zap v1.27.0
google.golang.org/api v0.185.0
google.golang.org/api v0.186.0
)

require (
cloud.google.com/go/auth v0.5.1 // indirect
cloud.google.com/go/auth v0.6.0 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.2 // indirect
cloud.google.com/go/compute/metadata v0.3.0 // indirect
github.com/EDDYCJY/fake-useragent v0.2.0 // indirect
Expand Down Expand Up @@ -51,7 +51,7 @@ require (
github.com/google/pprof v0.0.0-20230207041349-798e818bf904 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/gax-go/v2 v2.12.4 // indirect
github.com/googleapis/gax-go/v2 v2.12.5 // indirect
github.com/gorilla/schema v1.2.0 // indirect
github.com/itchyny/gojq v0.12.7 // indirect
github.com/itchyny/timefmt-go v0.1.3 // indirect
Expand Down
20 changes: 10 additions & 10 deletions golang-server/go.sum → go.sum
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go/auth v0.5.1 h1:0QNO7VThG54LUzKiQxv8C6x1YX7lUrzlAa1nVLF8CIw=
cloud.google.com/go/auth v0.5.1/go.mod h1:vbZT8GjzDf3AVqCcQmqeeM32U9HBFc32vVVAbwDsa6s=
cloud.google.com/go/auth v0.6.0 h1:5x+d6b5zdezZ7gmLWD1m/xNjnaQ2YDhmIz/HH3doy1g=
cloud.google.com/go/auth v0.6.0/go.mod h1:b4acV+jLQDyjwm4OXHYjNvRi4jvGBzHWJRtJcy+2P4g=
cloud.google.com/go/auth/oauth2adapt v0.2.2 h1:+TTV8aXpjeChS9M+aTtN/TjdQnzJvmzKFt//oWu7HX4=
cloud.google.com/go/auth/oauth2adapt v0.2.2/go.mod h1:wcYjgpZI9+Yu7LyYBg4pqSiaRkfEK3GQcpb7C/uyF1Q=
cloud.google.com/go/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2QxYC4trgAKZc=
Expand Down Expand Up @@ -78,8 +78,8 @@ github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYF
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/go-chi/chi/v5 v5.0.13 h1:JlH2F2M8qnwl0N1+JFFzlX9TlKJYas3aPXdiuTmJL+w=
github.com/go-chi/chi/v5 v5.0.13/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
github.com/go-chi/chi/v5 v5.0.14 h1:PyEwo2Vudraa0x/Wl6eDRRW2NXBvekgfxyydcM0WGE0=
github.com/go-chi/chi/v5 v5.0.14/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=
Expand Down Expand Up @@ -139,8 +139,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs=
github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0=
github.com/googleapis/gax-go/v2 v2.12.4 h1:9gWcmF85Wvq4ryPFvGFaOgPIs1AQX0d0bcbGw4Z96qg=
github.com/googleapis/gax-go/v2 v2.12.4/go.mod h1:KYEYLorsnIGDi/rPC8b5TdlB9kbKoFubselGIoBMCwI=
github.com/googleapis/gax-go/v2 v2.12.5 h1:8gw9KZK8TiVKB6q3zHY3SBzLnrGp6HQjyfYBYGmXdxA=
github.com/googleapis/gax-go/v2 v2.12.5/go.mod h1:BUDKcWo+RaKq5SC9vVYL0wLADa3VcfswbOMMRmB9H3E=
github.com/gorilla/schema v1.2.0 h1:YufUaxZYCKGFuAq3c96BOhjgd5nmXiOY9NGzF247Tsc=
github.com/gorilla/schema v1.2.0/go.mod h1:kgLaKoK1FELgZqMAVxx/5cbj0kT+57qxUrAlIO2eleU=
github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
Expand Down Expand Up @@ -340,8 +340,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/api v0.185.0 h1:ENEKk1k4jW8SmmaT6RE+ZasxmxezCrD5Vw4npvr+pAU=
google.golang.org/api v0.185.0/go.mod h1:HNfvIkJGlgrIlrbYkAm9W9IdkmKZjOTVh33YltygGbg=
google.golang.org/api v0.186.0 h1:n2OPp+PPXX0Axh4GuSsL5QL8xQCTb2oDwyzPnQvqUug=
google.golang.org/api v0.186.0/go.mod h1:hvRbBmgoje49RV3xqVXrmP6w93n6ehGgIVPYrGtBFFc=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
Expand All @@ -351,8 +351,8 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
google.golang.org/genproto v0.0.0-20240617180043-68d350f18fd4 h1:CUiCqkPw1nNrNQzCCG4WA65m0nAmQiwXHpub3dNyruU=
google.golang.org/genproto/googleapis/api v0.0.0-20240415180920-8c6c420018be h1:Zz7rLWqp0ApfsR/l7+zSHhY3PMiH2xqgxlfYfAfNpoU=
google.golang.org/genproto/googleapis/api v0.0.0-20240415180920-8c6c420018be/go.mod h1:dvdCTIoAGbkWbcIKBniID56/7XHTt6WfxXNMxuziJ+w=
google.golang.org/genproto/googleapis/api v0.0.0-20240610135401-a8a62080eff3 h1:QW9+G6Fir4VcRXVH8x3LilNAb6cxBGLa6+GM4hRwexE=
google.golang.org/genproto/googleapis/api v0.0.0-20240610135401-a8a62080eff3/go.mod h1:kdrSS/OiLkPrNUpzD4aHgCq2rVuC/YRxok32HXZ4vRE=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240617180043-68d350f18fd4 h1:Di6ANFilr+S60a4S61ZM00vLdw0IrQOSMS2/6mrnOU0=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240617180043-68d350f18fd4/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
Expand Down
64 changes: 0 additions & 64 deletions golang-server/main.go

This file was deleted.

This file was deleted.

Loading

0 comments on commit cb3e621

Please sign in to comment.