Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Despliegue #233

Merged
merged 43 commits into from
May 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
844994d
Arreglo cors y variables de entorno
UO271728 May 2, 2022
b7b91e3
Delete .env
UO271728 May 2, 2022
b08510a
Arreglo workflow
UO271728 May 2, 2022
855cd10
Seguir arreglando el workflow
UO271728 May 2, 2022
9f2a10b
Arreglo minimo test y cambio en workflow
UO271728 May 2, 2022
da13bbb
Commit de un guion
UO271728 May 2, 2022
d65febb
Mas correcciones
UO271728 May 2, 2022
9c2dc35
Prueba
UO271728 May 2, 2022
beb257a
Error tonto
UO271728 May 2, 2022
42f5964
Error tonto 2
UO271728 May 2, 2022
ab3924e
Cambios por probar
UO271728 May 2, 2022
6e10cb3
Creación de variables en string
UO271728 May 2, 2022
b30c815
Añadir principio mongo a la url
UO271728 May 2, 2022
1b2a06e
Cambiando la uri de otra opcion
UO271728 May 2, 2022
ccf567f
Ultimo intento
UO271728 May 2, 2022
76f4350
Cambio en el workflow
UO271728 May 2, 2022
2b438a1
No se me ocurre mas
UO271728 May 2, 2022
b0a5205
Cambio de uri
UO271728 May 2, 2022
434ef62
Prueba completa
UO271728 May 2, 2022
876fdd5
Error tonto 3
UO271728 May 2, 2022
05fe8b1
Vuelta al antiguo workflow
UO271728 May 2, 2022
f5df068
Antiguo
UO271728 May 2, 2022
144f39f
Otro intento
UO271728 May 2, 2022
8ec5a33
Cambiando url
UO271728 May 2, 2022
77e76a7
Merge branch 'develop' into Despliegue
UO271728 May 3, 2022
aca6053
Probar varaible entorno
UO271728 May 3, 2022
6d306dc
Probar API_URL
UO271728 May 3, 2022
48d74da
Probar a sacar las llamadas a la api a api.ts
UO271728 May 3, 2022
f4d538d
Console
UO271728 May 3, 2022
21094a7
Cambiando a API_URI
UO271728 May 3, 2022
7dcc40c
Cambiando el dockerfile
UO271728 May 3, 2022
a553f60
Añadiendo ARG en dockerfile
UO271728 May 3, 2022
59b2758
Intentando entender
UO271728 May 3, 2022
f0a91f5
Otro mas
UO271728 May 3, 2022
e4e8f1f
Cambiando a un .env
UO271728 May 3, 2022
bbd924f
Cambio completo
UO271728 May 3, 2022
4078c06
Error tonto
UO271728 May 3, 2022
8be12a8
Update pruebaSinDocker.yml
UO271728 May 3, 2022
59b8507
Moviendo las peticiones
UO271728 May 3, 2022
9734516
Quitar la barra
UO271728 May 3, 2022
dbfae67
Merge remote-tracking branch 'origin/Despliegue' into Despliegue
UO271728 May 3, 2022
4c46993
Adaptar direcciones
UO271728 May 3, 2022
89424bb
Merge branch 'develop' into Despliegue
UO271728 May 3, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/pruebaDeploy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
name: CI for ASW2122
on:
release:
types: [published]
jobs:
docker-push-webapp:
name: Push webapp Docker Image to GitHub Packages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Publish to Registry
uses: elgohr/[email protected]
with:
name: arquisoft/dede_es2a/webapp
username: ${{ github.actor }}
password: ${{ secrets.DOCKER_PUSH_TOKEN }}
registry: ghcr.io
workdir: webapp
docker-push-restapi:
name: Push restapi Docker Image to GitHub Packages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Publish to Registry
uses: elgohr/[email protected]
with:
name: arquisoft/dede_es2a/restapi
username: ${{ github.actor }}
password: ${{ secrets.DOCKER_PUSH_TOKEN }}
registry: ghcr.io
workdir: restapi
deploy-webapp:
needs: [docker-push-restapi,docker-push-webapp]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Deploy webapp
uses: akhileshns/[email protected]
with:
heroku_api_key: ${{ secrets.DEPLOY_KEY }}
heroku_app_name: "dede-es2a-webapp"
heroku_email: ${{ secrets.EMAIL }}
usedocker: true
appdir: "webapp"
deploy-restapi:
needs: [docker-push-restapi,docker-push-webapp]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Deploy restapi
uses: akhileshns/[email protected]
with:
heroku_api_key: ${{ secrets.DEPLOY_KEY }}
heroku_app_name: "dede-es2a-restapi"
heroku_email: ${{ secrets.EMAIL }}
usedocker: true
appdir: "restapi"
*/
43 changes: 43 additions & 0 deletions .github/workflows/pruebaSinDocker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI for ASW2122
on:
release:
types: [published]
jobs:
deploy-webapp:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Deploy webapp
uses: akhileshns/[email protected]
with:
heroku_api_key: ${{ secrets.DEPLOY_KEY }}
heroku_app_name: "dede-es2a-webapp"
heroku_email: ${{ secrets.EMAIL }}
usedocker: true
appdir: "webapp"
docker_build_args: |
API_URI
env:
API_URI: "https://dede-es2a-restapi.herokuapp.com"
deploy-restapi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Deploy restapi
uses: akhileshns/[email protected]
with:
heroku_api_key: ${{ secrets.DEPLOY_KEY }}
heroku_app_name: "dede-es2a-restapi"
heroku_email: ${{ secrets.EMAIL }}
usedocker: true
appdir: "restapi"
docker_build_args: |
MONGO_URI
CLOUDINARY_NAME
CLOUDINARY_API_KEY
CLOUDINARY_API_SECRET
env:
MONGO_URI: ${{ secrets.MONGO_URI }}
CLOUDINARY_NAME: ${{ secrets.CLOUD_NAME }}
CLOUDINARY_API_KEY: ${{ secrets.CLOUD_KEY }}
CLOUDINARY_API_SECRET: ${{ secrets.CLOUD_SECRET }}
3 changes: 2 additions & 1 deletion restapi/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/node_modules
/node_modules
.env
12 changes: 12 additions & 0 deletions restapi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@ LABEL org.opencontainers.image.source https://github.com/Arquisoft/dede_es2a
COPY . /app
WORKDIR /app

ARG MONGO_URI="mongodb://mongoserver:27017/api"
ENV MONGO_URI=$MONGO_URI

ARG CLOUDINARY_NAME="name"
ENV CLOUDINARY_NAME=$CLOUDINARY_NAME

ARG CLOUDINARY_API_KEY="apikey"
ENV CLOUDINARY_API_KEY=$CLOUDINARY_NAME

ARG CLOUDINARY_API_SECRET="secret"
ENV CLOUDINARY_API_SECRET=$CLOUDINARY_API_SECRET


#Install the dependencies
RUN npm install
Expand Down
16 changes: 10 additions & 6 deletions restapi/modules/cloudinary.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
const cloudinary = require('cloudinary').v2;
require('dotenv').config()

/*
var name: string = process.env.CLOUDINARY_NAME || 'name'
var api_key:string = process.env.CLOUDINARY_API_KEY || 'key'
var secret:string = process.env.CLOUDINARY_API_SECRET || 'secret'

export function config(){
cloudinary.config({
cloud_name : process.env.CLOUDINARY_NAME,
api_key : process.env.CLOUDINARY_API_KEY,
api_secret: process.env.CLOUDINARY_API_SECRET
cloud_name : name,
api_key : api_key,
api_secret: secret
});
}*/
}


/*
export function config(){
cloudinary.config({
cloud_name : 'dypp8pt31',
api_key : '321597164512969',
api_secret: 'sM2uhnqaS53Sq9_HsPDLK63FS7I'
});
}
}*/


export function configTest(){
Expand Down
11 changes: 5 additions & 6 deletions restapi/modules/gestorDB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@
const mongoose = require('mongoose')
require('dotenv').config()

const database_uri = process.env.DB_CONNECT
const database_test_uri = 'mongodb+srv://admin:<password>@cluster.mf7ve.mongodb.net/myFirstDatabase?retryWrites=true&w=majority'


export function connect(){
mongoose.connect('mongodb+srv://admin:[email protected]/myFirstDatabase?retryWrites=true&w=majority', {

mongoose.connect(process.env.MONGO_URI!, {
useNewUrlParser: true,
useUnifiedTopology: true
})
.then(() =>{
console.log("Database connected")
})
;
});
}

export function connectTest(){
Expand Down
4 changes: 2 additions & 2 deletions restapi/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ let {config} = require('./modules/cloudinary');

const options: cors.CorsOptions = {
origin: ['http://localhost:3000']
//origin: ['https://dede-es2a-webapp.herokuapp.com']
//origin: 'https://dede-es2a-webapp.herokuapp.com' || 'http://localhost:3000'
};

const metricsMiddleware:RequestHandler = promBundle({includeMethod: true});
Expand All @@ -27,7 +27,7 @@ app.use(metricsMiddleware);
bd.connect();
config();

app.use(cors(options));
app.use(cors());
app.use(bp.json());

app.use("/juguete", jugueteRouter);
Expand Down
2 changes: 2 additions & 0 deletions webapp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ WORKDIR /app
#Install the dependencies
RUN npm install

ARG API_URI="http://localhost:5000"
ENV REACT_APP_API_URI=$API_URI

#Crete an optimized version of the webapp
RUN npm run build
Expand Down
Loading