From 8eadec2e886a0d0eaefca9bc921e5eca2527685e Mon Sep 17 00:00:00 2001 From: Alicia Date: Thu, 20 Jun 2024 15:00:59 +0200 Subject: [PATCH 1/2] fix issue with docker volumes --- cms/.dockerignore | 2 + cms/Dockerfile | 19 +-- ...12.15T11.00.00.create_postgis_extension.js | 10 +- ....00.00.move_postgis_extension_to_public.js | 12 +- ...tool_resource_type_relation_to_has_many.js | 29 +++-- cms/docker-compose.yml | 8 +- cms/export_custom-db.json | 115 ++++++++---------- 7 files changed, 89 insertions(+), 106 deletions(-) create mode 100644 cms/.dockerignore diff --git a/cms/.dockerignore b/cms/.dockerignore new file mode 100644 index 00000000..c2fd6fc3 --- /dev/null +++ b/cms/.dockerignore @@ -0,0 +1,2 @@ +.gitignore +Dockerfile.prod diff --git a/cms/Dockerfile b/cms/Dockerfile index 7a167b23..c874565d 100644 --- a/cms/Dockerfile +++ b/cms/Dockerfile @@ -18,25 +18,12 @@ ENV NODE_ENV development WORKDIR /app -COPY .yarn ./.yarn -COPY config ./config -COPY database ./database -COPY public ./public -COPY src ./src +COPY . ./ -COPY .env \ - .nvmrc \ - .yarnrc.yml \ - favicon.png \ - package.json \ - entrypoint.sh \ - tsconfig.json \ - yarn.lock \ - ./ - -RUN yarn install +RUN yarn install --immutable ENV PATH /app/node_modules/.bin:$PATH EXPOSE 1337 +# CMD [ "yarn", "strapi", "develop" ] ENTRYPOINT ["/app/entrypoint.sh"] diff --git a/cms/database/migrations/2023.12.15T11.00.00.create_postgis_extension.js b/cms/database/migrations/2023.12.15T11.00.00.create_postgis_extension.js index eb701870..5e5a8d36 100644 --- a/cms/database/migrations/2023.12.15T11.00.00.create_postgis_extension.js +++ b/cms/database/migrations/2023.12.15T11.00.00.create_postgis_extension.js @@ -1,6 +1,6 @@ module.exports = { - async up(knex) { - // create postgis extension in the data schema - await knex.raw('CREATE EXTENSION postgis SCHEMA data'); - }, -}; \ No newline at end of file + async up(knex) { + // create postgis extension in the data schema + await knex.raw("CREATE EXTENSION IF NOT EXISTS postgis SCHEMA data"); + }, +}; diff --git a/cms/database/migrations/2023.12.19T10.00.00.move_postgis_extension_to_public.js b/cms/database/migrations/2023.12.19T10.00.00.move_postgis_extension_to_public.js index ac74d7fd..e5ccdd85 100644 --- a/cms/database/migrations/2023.12.19T10.00.00.move_postgis_extension_to_public.js +++ b/cms/database/migrations/2023.12.19T10.00.00.move_postgis_extension_to_public.js @@ -1,7 +1,7 @@ module.exports = { - async up(knex) { - // create postgis extension in the data schema - await knex.raw('DROP EXTENSION IF EXISTS postgis CASCADE'); - await knex.raw('CREATE EXTENSION postgis SCHEMA public'); - }, -} \ No newline at end of file + async up(knex) { + // create postgis extension in the data schema + await knex.raw("DROP EXTENSION IF EXISTS postgis CASCADE"); + await knex.raw("CREATE EXTENSION IF NOT EXISTS postgis SCHEMA public"); + }, +}; diff --git a/cms/database/migrations/2024.01.19T10.00.00.change_data_tool_resource_type_relation_to_has_many.js b/cms/database/migrations/2024.01.19T10.00.00.change_data_tool_resource_type_relation_to_has_many.js index e62b1eae..094270ac 100644 --- a/cms/database/migrations/2024.01.19T10.00.00.change_data_tool_resource_type_relation_to_has_many.js +++ b/cms/database/migrations/2024.01.19T10.00.00.change_data_tool_resource_type_relation_to_has_many.js @@ -1,18 +1,17 @@ module.exports = { async up(knex) { - // change the relation from 1:1 to 1:n without losing data - - // add a data_tool_resource_type_order column - await knex.schema.table('data_tools_data_tool_resource_type_links', table => { - table.integer('data_tool_resource_type_order'); - }); - // populate the reorder column with 1 - await knex.raw('UPDATE data_tools_data_tool_resource_type_links SET data_tool_resource_type_order = 1'); - // make the column not nullable - await knex.schema.alterTable('data_tools_data_tool_resource_type_links', table => { - table.integer('data_tool_resource_type_order').notNullable().alter(); - }); - // rename the table to match strapi convention - await knex.schema.renameTable('data_tools_data_tool_resource_type_links', 'data_tools_data_tool_resource_types_links'); + // change the relation from 1:1 to 1:n without losing data + // add a data_tool_resource_type_order column + // await knex.schema.table('data_tools_data_tool_resource_type_links', table => { + // table.integer('data_tool_resource_type_order'); + // }); + // // populate the reorder column with 1 + // await knex.raw('UPDATE data_tools_data_tool_resource_type_links SET data_tool_resource_type_order = 1'); + // // make the column not nullable + // await knex.schema.alterTable('data_tools_data_tool_resource_type_links', table => { + // table.integer('data_tool_resource_type_order').notNullable().alter(); + // }); + // // rename the table to match strapi convention + // await knex.schema.renameTable('data_tools_data_tool_resource_type_links', 'data_tools_data_tool_resource_types_links'); }, -} \ No newline at end of file +} diff --git a/cms/docker-compose.yml b/cms/docker-compose.yml index 692c676f..05f4ae08 100644 --- a/cms/docker-compose.yml +++ b/cms/docker-compose.yml @@ -11,10 +11,14 @@ services: depends_on: - db volumes: - - .:/app + - ./src:/app/src + - ./types:/app/types + - ./public:/app/public + - ./database:/app/database + - ./config:/app/config db: - image: postgres + image: postgis/postgis:16-3.4 restart: always env_file: - .env diff --git a/cms/export_custom-db.json b/cms/export_custom-db.json index e90dc52f..221fa0b8 100644 --- a/cms/export_custom-db.json +++ b/cms/export_custom-db.json @@ -1313,70 +1313,61 @@ }, "api::mpa.mpa": { "1": { - "id": 1, - "wdpaid": 555635929, - "name": "Monumento Natural Das Ilhas de Trindade, Martim Vaz e Do Monte Columbia", - "area": 67698, - "createdAt": "2023-10-13T12:39:17.944Z", - "updatedAt": "2023-10-24T13:27:46.130Z", - "year": 2018, - "mpaa_establishment_stage": 1, - "protection_status": 1, - "mpa_protection_coverage_stats": [ - 2 - ], - "createdBy": null, - "updatedBy": null - }, + "id": 1, + "wdpaid": "555635929", + "name": "Monumento Natural Das Ilhas de Trindade, Martim Vaz e Do Monte Columbia", + "area": 67698, + "createdAt": "2023-10-13T12:39:17.944Z", + "updatedAt": "2023-10-24T13:27:46.130Z", + "year": 2018, + "mpaa_establishment_stage": 1, + "protection_status": 1, + "mpa_protection_coverage_stats": [2], + "createdBy": null, + "updatedBy": null + }, "2": { - "id": 2, - "wdpaid": 555557228, - "name": "Charlie-Gibbs North High Seas Marine Protected Area", - "area": 178766, - "createdAt": "2023-10-13T12:51:35.526Z", - "updatedAt": "2023-10-24T13:27:46.224Z", - "year": 2012, - "mpaa_establishment_stage": 1, - "protection_status": 1, - "mpa_protection_coverage_stats": [ - 1 - ], - "createdBy": null, - "updatedBy": null - }, + "id": 2, + "wdpaid": "555557228", + "name": "Charlie-Gibbs North High Seas Marine Protected Area", + "area": 178766, + "createdAt": "2023-10-13T12:51:35.526Z", + "updatedAt": "2023-10-24T13:27:46.224Z", + "year": 2012, + "mpaa_establishment_stage": 1, + "protection_status": 1, + "mpa_protection_coverage_stats": [1], + "createdBy": null, + "updatedBy": null + }, "3": { - "id": 3, - "wdpaid": 555624810, - "name": "Ross Sea Region", - "area": 2041330, - "createdAt": "2023-10-19T14:20:56.081Z", - "updatedAt": "2023-10-24T13:27:46.285Z", - "year": 2017, - "mpaa_establishment_stage": 1, - "protection_status": 1, - "mpa_protection_coverage_stats": [ - 3, - 4 - ], - "createdBy": null, - "updatedBy": null - }, + "id": 3, + "wdpaid": "555624810", + "name": "Ross Sea Region", + "area": 2041330, + "createdAt": "2023-10-19T14:20:56.081Z", + "updatedAt": "2023-10-24T13:27:46.285Z", + "year": 2017, + "mpaa_establishment_stage": 1, + "protection_status": 1, + "mpa_protection_coverage_stats": [3, 4], + "createdBy": null, + "updatedBy": null + }, "4": { - "id": 4, - "wdpaid": 4899, - "name": "Parque Estadual Da Ilha Anchieta", - "area": 0.15, - "createdAt": "2023-10-24T08:50:35.738Z", - "updatedAt": "2023-10-24T13:27:46.345Z", - "year": 1977, - "mpaa_establishment_stage": 1, - "protection_status": 1, - "mpa_protection_coverage_stats": [ - 5 - ], - "createdBy": null, - "updatedBy": null - } + "id": 4, + "wdpaid": "4899", + "name": "Parque Estadual Da Ilha Anchieta", + "area": 0.15, + "createdAt": "2023-10-24T08:50:35.738Z", + "updatedAt": "2023-10-24T13:27:46.345Z", + "year": 1977, + "mpaa_establishment_stage": 1, + "protection_status": 1, + "mpa_protection_coverage_stats": [5], + "createdBy": null, + "updatedBy": null + } }, "documentation.metadata": { "1": { @@ -2614,4 +2605,4 @@ } } } -} \ No newline at end of file +} From 95eb88d3cc0917e93bf904af183054c3dbade04d Mon Sep 17 00:00:00 2001 From: Alicia Date: Thu, 20 Jun 2024 15:03:28 +0200 Subject: [PATCH 2/2] removed docker ignore file --- cms/.dockerignore | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 cms/.dockerignore diff --git a/cms/.dockerignore b/cms/.dockerignore deleted file mode 100644 index c2fd6fc3..00000000 --- a/cms/.dockerignore +++ /dev/null @@ -1,2 +0,0 @@ -.gitignore -Dockerfile.prod