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

View File

@ -2,6 +2,7 @@ Dev :
```bash ```bash
docker-compose -f docker-compose-dev.yml build 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 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 = { const config = {
jucundus: { jucundus: {
url: 'http://jucundus-api.saucisse.ninja', url: 'https://jucundus-api.saucisse.ninja',
useremail: 'agent@agent.com' useremail: 'agent@agent.com'
}, },
agent: { agent: {

View File

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

View File

@ -6,32 +6,31 @@ services:
context: ./agent context: ./agent
dockerfile: Dockerfile dockerfile: Dockerfile
volumes: volumes:
- ./agent:/agent
- ./.Key.js:/agent/.Key.js - ./.Key.js:/agent/.Key.js
- ./config.js:/agent/config.js - ./config.js:/agent/config.js
- ./AuctionServices:/agent/AuctionServices - ./AuctionServices:/agent/AuctionServices
networks: networks:
- internal - internal
# scrapper: scrapper:
# build: build:
# context: ./scrapper context: ./scrapper
# dockerfile: Dockerfile dockerfile: Dockerfile
# ports: ports:
# - 3020 - "3020"
# volumes: volumes:
# - ./scrapper:/scrapper - ./.Key.js:/scrapper/.Key.js
# - ./.Key.js:/scrapper/.Key.js - ./config.js:/scrapper/config.js
# - ./config.js:/scrapper/config.js - ./AuctionServices:/scrapper/AuctionServices
# - ./AuctionServices:/scrapper/AuctionServices networks:
# networks: - internal
# - internal labels:
# labels: - "traefik.enable=true"
# - "traefik.enable=true" - "traefik.http.routers.jucundus-agent1.rule=Host(`jucundus-agent1.saucisse.ninja`)"
# - "traefik.http.routers.backend.rule=Host(`jucundus-agent1.saucisse.ninja`)" - "traefik.http.routers.jucundus-agent1.entrypoints=websecure"
# - "traefik.http.routers.backend.entrypoints=websecure" - "traefik.http.routers.jucundus-agent1.tls=true"
# - "traefik.http.routers.backend.tls=true" - "traefik.http.routers.jucundus-agent1.tls.certresolver=myresolver"
# - "traefik.http.routers.backend.tls.certresolver=myresolver" - "traefik.http.services.jucundus-agent1.loadbalancer.server.port=3020"
networks: networks:
internal: 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 fetch = require('node-fetch');
const { config } = require("../config.js");
class Jucundus { class Jucundus {
constructor() { constructor() {
this.url = 'http://localhost:3000/api'; this.url = config.jucundus+'/api';
} }
setSaleStatus(status) { // setSaleStatus(status) {
fetch(ApiURL+'/sale/setSaleStatus/'+status) // fetch(ApiURL+'/sale/setSaleStatus/'+status)
.then(response => response.json()) // .then(response => response.json())
.then(data => { // .then(data => {
res.json(data); // res.json(data);
}) // })
.catch(error => { // .catch(error => {
console.error(error); // console.error(error);
}); // });
} // }
} }
module.exports = Jucundus module.exports = Jucundus