This project is a web application to have an easy access to It is a full-stack application containing an Express.js backend and a React.js frontend, dockerized using a single Dockerfile for easier deployment and containerization.
This application comprises both the backend and frontend components:
- Backend: Built using Express.js, it provides API endpoints and handles server-side operations.
- Frontend: Developed in React.js, it offers a user interface to interact with the backend services.
Both the backend and frontend are encapsulated within a Docker container using a single Dockerfile for streamlined deployment.
Make sure you have the following prerequisites installed:
- Docker: Install Docker
- Node.js (v18 or higher) and npm (for local development)
Follow these steps to set up and run the application:
-
Clone the repository:
git clone https://github.com/Inist-CNRS/tdm-factory.git
-
Navigate to the project directory:
cd tdm-factory
Build the Docker image using the provided Dockerfile:
docker build . -t tdm:v1.0.0 --no-cache
To create a new version of TDM-Factory create a new GitHub release with an associated tags. This will run the ci and push an image into Docker Hub.
To run the application in a Docker container:
docker run -p 3000:3000 tdm:v1.0.0
The frontend will be accessible at http://localhost:3000/
and the swagger configuration at http://localhost:3000/swagger-config
.
To use the dev mode, set HOST
to http://localhost:3000
in tdm-be/bin/swagger.ts
.
Then run make update-front-api
.
You also need a ngrok host for the external host in tdm-be/config/devlopement.json
,
to create a ngrok endpoints run ngrok http 3000
.
After setting up this you can run make run-dev
There are two level of properties :
-
Back end property file
tdb-be\config.json
{ // Port configuration should be the same as dockerfile "port": 3000, //password for swagger configuration "password": "", // SMTP configuration (nodemailer smtp options) "smtp": { "host": "", "port": 587, "secure": false, "auth": { "user": "", "pass": "" }, "service": "gmail" }, "fileFolder": "uploads/", "dumpFile": "dump.tar.gz", "finalFile": "final.tar.gz", //CRON every day at 00:00 to remove file older than 7 days "cron": { "schedule": "0 0 * * *", "deleteFileOlderThan": 7 } }
-
Dynamic property updatable from post request on swagger
${environment.url}/swagger-config
protected withuser/${environment.password}
{ "wrappers": [ { "url": "https://data-wrapper.services.istex.fr", "tags": [ { "name": "data-wrapper", "excluded": [] } ] } ], "enrichments": [ { "url": "https://data-computer.services.istex.fr", "retrieveUrl": "/v1/retrieve", "tags": [ { "name": "data-computer", "excluded": [ "/v1/collect", "/v1/retrieve", "/v1/mock-error-async", "/v1/mock-error-sync" ] } ] } ], "mailSuccess": { "subject": "Objet du mail succès", "text": "Vous pouvez télécharger le fichier enrichi à l'adresse ci-dessous" }, "mailError": { "subject": "Objet du mail d'erreur", "text": "Une erreur s'est produite lors de l'enrichissement" } }
wrappers
Can contain multiple wrapper APIurl
URL of the APitags
Tags to include from this apiname
Tag Nameexcluded
String table of route to exclude from this tag
enrichments
Can contain multiple enrichment APIurl
URL of the APitags
Tags to include from this apiname
Tag Nameexcluded
String table of route to exclude from this tag
mailSuccess
Template for the success mailsubject
Subject of the mailtext
Text content for the mail
mailError
Template for the failure mailsubject
Subject of the mailtext
Text content for the mail