cor docker Dev/Prod

This commit is contained in:
Cyril Rouillon 2024-11-26 15:13:34 +01:00
parent 3ac3e9ac8e
commit d15fa9a57d
10 changed files with 67 additions and 48 deletions

2
.gitignore vendored
View File

@ -3,4 +3,4 @@
agent/node_modules
scrapper/node_modules
scrapper/node_modules

View File

@ -169,7 +169,7 @@ class Scraper {
async getNewToken(email, password) {
try {
try {
const response = await fetch(this._JucundusUrl+'/authenticate', {
method: 'POST',
headers: {

View File

@ -2,6 +2,7 @@ Dev :
```bash
docker-compose -f docker-compose-dev.yml build
docker-compose -f docker-compose-dev.yml up
docker-compose -f docker-compose-dev.yml up --scale agent=3
```

15
agent/config.js Executable file → Normal file
View File

@ -0,0 +1,15 @@
// Config Dev
console.log('## CONFIG DEV ##');
const config = {
jucundus: {
url: 'http://host.docker.internal:3000',
useremail: 'agent@agent.com'
},
agent: {
urlApi: 'http://agent/internApi',
maxCloseWebsockets: 5,
}
};
module.exports = { config };

View File

@ -1,12 +0,0 @@
const config = {
jucundus: {
url: 'http://host.docker.internal:3000',
useremail: 'agent@agent.com'
},
agent: {
urlApi: 'http://agent/internApi',
maxCloseWebsockets: 5,
}
};
module.exports = { config };

View File

@ -1,6 +1,8 @@
// Config Prod
const config = {
jucundus: {
url: 'http://jucundus-api.saucisse.ninja',
url: 'https://jucundus-api.saucisse.ninja',
useremail: 'agent@agent.com'
},
agent: {

View File

@ -8,7 +8,6 @@ services:
volumes:
- ./agent:/agent
- ./.Key.js:/agent/.Key.js
- ./config-dev.js:/agent/config.js
- ./AuctionServices:/agent/AuctionServices
networks:
- internal
@ -24,7 +23,6 @@ services:
volumes:
- ./scrapper:/scrapper
- ./.Key.js:/scrapper/.Key.js
- ./config-dev.js:/scrapper/config.js
- ./AuctionServices:/scrapper/AuctionServices
networks:
- internal

View File

@ -6,32 +6,31 @@ services:
context: ./agent
dockerfile: Dockerfile
volumes:
- ./agent:/agent
- ./.Key.js:/agent/.Key.js
- ./config.js:/agent/config.js
- ./AuctionServices:/agent/AuctionServices
networks:
- internal
# scrapper:
# build:
# context: ./scrapper
# dockerfile: Dockerfile
# ports:
# - 3020
# volumes:
# - ./scrapper:/scrapper
# - ./.Key.js:/scrapper/.Key.js
# - ./config.js:/scrapper/config.js
# - ./AuctionServices:/scrapper/AuctionServices
# networks:
# - internal
# labels:
# - "traefik.enable=true"
# - "traefik.http.routers.backend.rule=Host(`jucundus-agent1.saucisse.ninja`)"
# - "traefik.http.routers.backend.entrypoints=websecure"
# - "traefik.http.routers.backend.tls=true"
# - "traefik.http.routers.backend.tls.certresolver=myresolver"
scrapper:
build:
context: ./scrapper
dockerfile: Dockerfile
ports:
- "3020"
volumes:
- ./.Key.js:/scrapper/.Key.js
- ./config.js:/scrapper/config.js
- ./AuctionServices:/scrapper/AuctionServices
networks:
- internal
labels:
- "traefik.enable=true"
- "traefik.http.routers.jucundus-agent1.rule=Host(`jucundus-agent1.saucisse.ninja`)"
- "traefik.http.routers.jucundus-agent1.entrypoints=websecure"
- "traefik.http.routers.jucundus-agent1.tls=true"
- "traefik.http.routers.jucundus-agent1.tls.certresolver=myresolver"
- "traefik.http.services.jucundus-agent1.loadbalancer.server.port=3020"
networks:
internal:

15
scrapper/config.js Executable file → Normal file
View File

@ -0,0 +1,15 @@
// Config Dev
console.log('## CONFIG DEV ##');
const config = {
jucundus: {
url: 'http://host.docker.internal:3000',
useremail: 'agent@agent.com'
},
agent: {
urlApi: 'http://agent/internApi',
maxCloseWebsockets: 5,
}
};
module.exports = { config };

View File

@ -1,20 +1,21 @@
const fetch = require('node-fetch');
const { config } = require("../config.js");
class Jucundus {
constructor() {
this.url = 'http://localhost:3000/api';
this.url = config.jucundus+'/api';
}
setSaleStatus(status) {
fetch(ApiURL+'/sale/setSaleStatus/'+status)
.then(response => response.json())
.then(data => {
res.json(data);
})
.catch(error => {
console.error(error);
});
}
// setSaleStatus(status) {
// fetch(ApiURL+'/sale/setSaleStatus/'+status)
// .then(response => response.json())
// .then(data => {
// res.json(data);
// })
// .catch(error => {
// console.error(error);
// });
// }
}
module.exports = Jucundus