Skip to content

Commit

Permalink
cambios
Browse files Browse the repository at this point in the history
  • Loading branch information
IrvingCM123 committed Dec 2, 2023
0 parents commit 66d9184
Show file tree
Hide file tree
Showing 19 changed files with 10,798 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["@babel/preset-env"],
"plugins": ["@babel/plugin-transform-runtime"]
}
13 changes: 13 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
PORT=3000
DB_USER=postgres
DB_PASSWORD=IrvingConde123
DB_SERVER=localhost
DB_DATABASE=docentes
DB_PORT=5432

JWT_SECRET=Centenito

GMAIL_SERVICE=gmail
GMAIL_USER=Irving.CondeM@Gmail.com
GMAIL_DESTINY=Irving.Conde117@Gmail.om
GMAIL_SUBJECT_ALTA_MATERIA=Se solicita un alta de materia
42 changes: 42 additions & 0 deletions .gitIgnore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# Compiled output
/dist
/tmp
/out-tsc
/bazel-out

# Node
/node_modules
npm-debug.log
yarn-error.log

# IDEs and editors
.idea/
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# Miscellaneous
/.angular/cache
.sass-cache/
/connect.lock
/coverage
/libpeerconnection.log
testem.log
/typings

# System files
.DS_Store
Thumbs.db
69 changes: 69 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: master CI, CD workflow
on:
push:
branches: [ "master"]
pull_request:
branches: [ "master"]
jobs:
master-ci-cd:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 16.x
- name: make .env
uses: SpicyPizza/create-envfile@v1.3
with:
envkey_DEV_DATABASE_URL : ${{ secrets.DEV_DATABASE_URL }}
file_name: .env
fail_on_empty: false

- name: show dir, .env file
run: |
cat .env
- name: Build the custom Docker image
run: docker build -t ${{secrets.DOCKER_USER}}/${{secrets.MODEL_NAME}}:${{github.sha}} .

- name: show docker images
run: docker images

- name: docker login
env:
DOCKER_USER: ${{secrets.DOCKER_USER}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
run: |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
- name: Docker Push
run: docker push ${{secrets.DOCKER_USER}}/${{secrets.MODEL_NAME}}:${{github.sha}}

- name: update docker user in k8
run: sed -i 's/{docker_user}/${{secrets.DOCKER_USER}}/g' manifests/k8s.yml

- name: update model name in k8
run: sed -i 's/{model_name}/${{secrets.MODEL_NAME}}/g' manifests/k8s.yml

- name: update _ by -
run: sed -i 's/_/-/g' manifests/k8s.yml

- name: update sha in k8
run: sed -i 's/{github.sha}/${{github.sha}}/g' manifests/k8s.yml

- name: ls -la
run: cat manifests/k8s.yml

- uses: okteto/context@2.7.0
with:
token: ${{secrets.OKTETO_TOKEN }}

- name: Deploy and Wait
uses: okteto/actions/deploy@v1
env:
KUBECONFIG: ${{ steps.namespace.outputs.kubeconfig }}
with:
namespace: ${{secrets.OKTETO_NAMESPACE }}
manifest: manifests/k8s.yml
tag: ${{ secrets.DOCKER_USERNAME }}/${{secrets.MODEL_NAME}}:${{github.sha}}
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM debian:bullseye

RUN apt-get update
RUN apt-get install -y curl make g++
RUN curl -sL http://deb.nodesource.com/setup_16.x | bash -
RUN apt-get install -y nodejs

ADD . /

RUN npm install
EXPOSE 3000

CMD ["node", "./src/index.js"]
35 changes: 35 additions & 0 deletions manifests/k8s.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#manifest
apiVersion: apps/v1
kind: Deployment
metadata:
name: {model_name}-deployment
spec:
selector:
matchLabels:
app: {model_name}-server
replicas: 10
template:
metadata:
labels:
app: {model_name}-server
spec:
containers:
- name: {model_name}-container
#image: gcr.io/tensorflow-serving/resnet
image: docker.io/{docker_user}/{model_name}:{github.sha}
ports:
- containerPort: 3000
---
apiVersion: v1
kind: Service
metadata:
labels:
run: {model_name}-service
name: {model_name}-service
spec:
ports:
- port: 3000
targetPort: 3000
selector:
app: {model_name}-server
type: LoadBalancer
Loading

0 comments on commit 66d9184

Please sign in to comment.