Skip to content

Commit

Permalink
Merge pull request #269 from Vizzuality/fix/cms/issue-with-docker-and…
Browse files Browse the repository at this point in the history
…-volumes

Fix/cms/issue with docker and volumes
  • Loading branch information
aagm authored Jun 20, 2024
2 parents 432455f + 95eb88d commit 7edeb66
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 106 deletions.
19 changes: 3 additions & 16 deletions cms/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
async up(knex) {
// create postgis extension in the data schema
await knex.raw('CREATE EXTENSION postgis SCHEMA data');
},
};
async up(knex) {
// create postgis extension in the data schema
await knex.raw("CREATE EXTENSION IF NOT EXISTS postgis SCHEMA data");
},
};
Original file line number Diff line number Diff line change
@@ -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');
},
}
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");
},
};
Original file line number Diff line number Diff line change
@@ -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');
},
}
}
8 changes: 6 additions & 2 deletions cms/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
115 changes: 53 additions & 62 deletions cms/export_custom-db.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -2614,4 +2605,4 @@
}
}
}
}
}

0 comments on commit 7edeb66

Please sign in to comment.