In this repository you can find anything you need to work on the developer portal project strapi cms.
(Optional) First time set-up project or when there are changes to strapi collection:
npm run precompile -w strapi-cms
npm run compile Locally run strapi-cms:
npm run dev -w strapi-cms To use SQLite for local development, add the following configuration to the sqlite object in apps/strapi-cms/config/database.ts to ensure the transfer completes successfully:
pool: {
min: 2,
max: 20,
acquireTimeoutMillis: 300000,
createTimeoutMillis: 300000,
destroyTimeoutMillis: 300000,
idleTimeoutMillis: 30000,
reapIntervalMillis:1000,
createRetryIntervalMillis: 2000
},
debug: false,
Important: remember to remove these lines after the transfer, before launching Strapi.
Run the following command to start the trasfer and populate the database:
cd apps/strapi-cms
npx strapi transfer --from https://cms.developer.pagopa.it/admin --from-token <strapi_token>The strapi token can be recovered by a mantainer with admin access to the production cms
Make sure to add the following two lines to your local .env file before starting strapi-cms:
DATABASE_CLIENT=sqlite
DATABASE_FILENAME=.tmp/data.dbdocker run -it --rm --name postgres -e POSTGRES_PASSWORD=password -p 5432:5432 postgres:14docker network create strapi-network # Only needed if it doesn't exist
docker network connect strapi-network postgresdocker build -t strapi-cms apps/strapi-cmsCreate a .env file for the Strapi container using the following values for the PostgreSQL connection
...
DATABASE_CLIENT=postgres
DATABASE_HOST=postgres
DATABASE_NAME=postgres
DATABASE_PASSWORD=password
DATABASE_PORT=5432
DATABASE_SCHEMA=public
DATABASE_SSL=false
DATABASE_USERNAME=postgres
...docker run --name strapi-cms --network strapi-network -p 1337:1337 --env-file apps/strapi-cms/.env-docker strapi-cmsOpen http://localhost:1337/admin/ with your browser to see the CMS backoffice.
Currently, the deployment happens automatically in the dev environment when a push is made to the main branch of the repository, while it is done manually in the production environment.
The CMS runs in an Amazon ECS container as defined in the apps/strapi-cms/Dockerfile.
In the Docker container, the package.json and package-lock.json files located in the apps/strapi-cms folder are copied, npm packages are installed, and the npm run start command is executed to start the Strapi server.
Whenever a dependency or devDependency is added in a PR to the CMS's package.json, it is necessary to update the apps/strapi-cms/package-lock.json file by running the command
npm run prune:strapi -w strapi-cms from the root of the project.
This project utilizes changesets to generate the changelog. Here's how you can use it:
-
Adding Changelog Information: to add entries to the changelog, execute
npx changesetornpm run changeset.
This will initiate a wizard that guides you through the process. -
Defining the Change Type: the wizard will ask you to specify the type of changes made (major, minor, patch).
The summary you provide here will be added to theCHANGELOG.mdfile. Follow the semver specification in order to choose the proper type of change. -
Generating the Changelog: the Changelog workflow uses the changeset's action to convert the changes tracked with
npm run changesetinto aCHANGELOG.mdfile. -
Creating a Pull Request: after generating the changelog, the workflow will create a PR with the proposed changes, which include version bumping and updating the
CHANGELOG.mdfile. -
Updating the PR: if additional changes are made while the PR is open, the changeset's bot will automatically update the PR based on the changes in the
.changesetfolder.