¡Hola! 🖖 Este es un proyecto relacionado a Pilas Bloques ❤️. En el repositorio de ese proyecto encontrarás las guías sobre cómo contribuir y el código de conducta, que son guías que aplican también a este proyecto.
Hi! 🖖 This is a project related to Pilas Bloques ❤️. In that project's repository you'll find the contribution guidelines and the code of conduct which also apply to this project.
This project contains the following sub-projects:
- Pilas Bloques API: REST-API for Pilas Bloques app.
- Pilas Bloques Analytics: REST-API for logging Pilas Bloques usage for scientific purposes.
- Pilas Bloques Consumer: Pilas Bloques data users consumer for scientific purposes. Consumes data from Pilas Bloques Analytics' database.
Docker run example:
docker run -d --rm -p 27017:27017 -v $HOME/mongoData:/data/db --name mongoPilasBloques mongo:5.0.5
- Checkout this repository.
- Create
.env
file with the required enviroments variables. You can copy fromsample.env
- Make sure you are using the correct node version running
nvm use
- Run
npm install
Remember to start the DB before!
For development
- Run
npm run dev
for server starts. Any file change should re-run it. This command only starts API and Analytics servers. It's important to NOT close those tabs (API and Analytics) before ending the processes (usingCTRL + C
); otherwise you will need to kill it manually (usingfuser
command). Example:
> fuser <port>/tcp
pid
> kill pid
For production
- Run
npm run build
for makedist
directory. - Run
npm start:[sub-project]
for server starts. The options areapi
, andanaytics
. For consumer see below.
Remember to start the DB before!
npm run start -- --help
shows help.npm run start:consumer -- analyze
analyzes using default options (decomposition challenges and outcollection "experiences").
- Dumping
docker exec -it CONTAINER_ID sh -c "mongodump --gzip --out=/data/db/dumpFOLDER --db=pilas-bloques-analytics --collection=solutions"
- Restoring
docker exec -it CONTAINER_ID mongorestore --gzip /data/db/dumpFOLDER
All tests
- Run
npm test
If you want to test a specific sub-project, run npm test:[sub-project]
, with the options: api
, analytics
and consumer
.
Only one file
- Run
npm test -- -f <FILE_PATH>
- Run
npm run release:patch
. This bumps to the next version, creates a tag and creates a Github Release. - On the window that pops choose release name, description and click Publish Release. This publishes the release and triggers the Github Action workflow that uploads the zip with the pilas-bloques-api files.