From fce85fa5d0d1263b4712e0eb25155a352941f4d7 Mon Sep 17 00:00:00 2001 From: Haixuan Xavier Tao Date: Mon, 12 Oct 2020 15:51:48 +0200 Subject: [PATCH 1/2] Adding postgis service --- repo/packages/P/postgis/0/config.json | 114 ++++++++++++++++++ .../P/postgis/0/marathon.json.mustache | 68 +++++++++++ repo/packages/P/postgis/0/package.json | 22 ++++ repo/packages/P/postgis/0/resource.json | 14 +++ 4 files changed, 218 insertions(+) create mode 100644 repo/packages/P/postgis/0/config.json create mode 100644 repo/packages/P/postgis/0/marathon.json.mustache create mode 100644 repo/packages/P/postgis/0/package.json create mode 100644 repo/packages/P/postgis/0/resource.json diff --git a/repo/packages/P/postgis/0/config.json b/repo/packages/P/postgis/0/config.json new file mode 100644 index 0000000..42661ee --- /dev/null +++ b/repo/packages/P/postgis/0/config.json @@ -0,0 +1,114 @@ +{ + "type": "object", + "required": ["service", "postresql"], + "properties": { + "service": { + "type": "object", + "required": ["name", "cpu", "mem"], + "description": "Configuration properties for the postgis service for DC/OS.", + "properties": { + "name": { + "description": "The name of the service to display in the DC/OS dashboard.", + "type": "string", + "default": "postgis", + "x-form": { + "hidden": true + }, + "x-generated": { + "type": "appID", + "scope": "postgis" + } + }, + "cpus": { + "description": "CPU shares to allocate to this Postgis instance.", + "type": "number", + "default": 0.1, + "minimum": 0.1 + }, + "mem": { + "description": "Memory to allocate to this Postgis instance.", + "type": "number", + "default": 1024.0, + "minimum": 1024.0 + } + } + }, + "postresql": { + "type": "object", + "required": ["version", "username", "password"], + "description": "Postgres database configuration properties", + "properties": { + "version": { + "description": "Postgres major version", + "type": "string", + "enum": ["10.0-2.4"], + "default": "10.0-2.4" + }, + "username": { + "description": "Postgres user name.", + "type": "string", + "default": "admin", + "x-form": { + "value": "{{user.idep}}" + } + }, + "password": { + "description": "Postgres password.", + "type": "string", + "default": "changeme", + "x-form": { + "value": "{{user.password}}" + } + }, + "dbname": { + "description": "Name for the default database that is created when the image is first started.", + "type": "string", + "default": "defaultdb" + }, + "initdbargs": { + "description": "Arguments to send to postgres initdb. The value is a space separated string of arguments as postgres initdb would expect them.", + "type": "string" + }, + "extensions": { + "description": "Extensions name to send to postgres initdb. The value is a comma separated string of arguments as postgis initdb would expect them.", + "type": "string" + }, + "uri": { + "description": "Sql files could be on an archive root", + "title": "Initialisation script Url", + "type": "string", + "default": "postgis,hstore,postgis_topology,postgis_raster,pgrouting" + } + } + }, + "networking": { + "description": "Networking-related configuration properties for pgAdmin on DC/OS.", + "type": "object", + "properties": { + "network-name": { + "description": "Name of the container network to use", + "type": "string", + "default": "dcos", + "x-form": { + "hidden": true + }, + "x-generated": { + "type": "containerNetworkName", + "scope": "postgis" + } + }, + "internal-host": { + "description": "The virtual host address to configure for integration with Marathon-lb.", + "type": "string", + "x-form": { + "hidden": true + }, + "x-generated": { + "type": "internalDNS", + "scope": "postgis" + } + } + } + } + } +} diff --git a/repo/packages/P/postgis/0/marathon.json.mustache b/repo/packages/P/postgis/0/marathon.json.mustache new file mode 100644 index 0000000..2116cab --- /dev/null +++ b/repo/packages/P/postgis/0/marathon.json.mustache @@ -0,0 +1,68 @@ +{ + "id": "{{service.name}}", + "cpus": {{service.cpus}}, + "mem": {{service.mem}}, + "cmd": "{{#postresql.uri}}rm -rf /docker-entrypoint-initdb.d && ln -s $MESOS_SANDBOX /docker-entrypoint-initdb.d && {{/postresql.uri}}docker-entrypoint.sh postgres", + "instances": 1, + "env": { + "POSTGRES_USER": "{{postresql.username}}", + "POSTGRES_PASS": "{{postresql.password}}", + "POSTGRES_DBNAME": "{{postresql.dbname}}", + "POSTGRES_INITDB_ARGS": "{{postresql.initdbargs}}" + "POSTGRES_MULTIPLE_EXTENSIONS": "{{postresql.extensions}}" + }, + "container": { + "type": "DOCKER", + "docker": { + "image": "{{resource.assets.container.docker.image}}:{{postresql.version}}", + "forcePullImage": true, + "portMappings": + [ + { + "containerPort": 5432, + "hostPort": 0, + "protocol": "tcp", + "name": "postgresql" + } + ] + } + }, + "networks": [ + { + "name": "{{networking.network-name}}", + "mode": "container" + } + ], + "upgradeStrategy": + { + "maximumOverCapacity": 0, + "minimumHealthCapacity": 0 + }, + "healthChecks": [ + {{#postresql.uri}} + { + "protocol": "MESOS_TCP", + "portIndex": 0, + "gracePeriodSeconds": 1800, + "intervalSeconds": 60, + "timeoutSeconds": 20, + "maxConsecutiveFailures": 3 + } + {{/postresql.uri}} + ], + "fetch": [ + {{#postresql.uri}} + { + "uri": "{{postresql.uri}}", + "extract": true, + "executable": false, + "cache": false + } + {{/postresql.uri}} + ], + "labels": { + "HAPROXY_0_ENABLED":"true", + "MARATHON_SINGLE_INSTANCE_APP": "true", + "ONYXIA_PRIVATE_ENDPOINT":"postgresql://{{networking.internal-host}}:5432" + } +} diff --git a/repo/packages/P/postgis/0/package.json b/repo/packages/P/postgis/0/package.json new file mode 100644 index 0000000..c22900a --- /dev/null +++ b/repo/packages/P/postgis/0/package.json @@ -0,0 +1,22 @@ +{ + "packagingVersion": "3.0", + "name": "postgis", + "version": "1.0", + "minDcosReleaseVersion": "1.8", + "scm": "https://github.com/postgis/docker-postgis", + "maintainer": "PostGIS Community", + "website": "https://registry.hub.docker.com/r/postgis/postgis/", + "framework": false, + "description": "PostGIS is a spatial database extender for PostgreSQL object-relational database. It adds support for geographic objects allowing location queries to be run in SQL. ", + "tags": [ + "SQL", + "datascience", + "database", + "postgres" + ], + "preInstallNotes": "Warning : data are not stored on this service. Use GIT to save your code.", + "postInstallNotes": "The account is your username and the password is your password for all services. You can get it inside Onyxia in your profil settings", + "postUninstallNotes": "PostGIS has been uninstalled.", + "selected": false, + "lastUpdated": 1585220308 +} diff --git a/repo/packages/P/postgis/0/resource.json b/repo/packages/P/postgis/0/resource.json new file mode 100644 index 0000000..4272ace --- /dev/null +++ b/repo/packages/P/postgis/0/resource.json @@ -0,0 +1,14 @@ +{ + "images": { + "icon-small": "https://en.wikipedia.org/wiki/File:PostGIS_logo.png#/media/File:PostGIS_logo.png", + "icon-medium": "https://en.wikipedia.org/wiki/File:PostGIS_logo.png#/media/File:PostGIS_logo.png", + "icon-large": "https://en.wikipedia.org/wiki/File:PostGIS_logo.png#/media/File:PostGIS_logo.png" + }, + "assets": { + "container": { + "docker": { + "image": "kartoza/postgis" + } + } + } +} From 311d1de277ec22096824b16c4756b357cf359ec3 Mon Sep 17 00:00:00 2001 From: Haixuan Xavier Tao Date: Mon, 12 Oct 2020 16:49:10 +0200 Subject: [PATCH 2/2] Using postgis as service option name --- repo/packages/P/postgis/0/config.json | 6 ++--- .../P/postgis/0/marathon.json.mustache | 24 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/repo/packages/P/postgis/0/config.json b/repo/packages/P/postgis/0/config.json index 42661ee..badea85 100644 --- a/repo/packages/P/postgis/0/config.json +++ b/repo/packages/P/postgis/0/config.json @@ -71,13 +71,13 @@ }, "extensions": { "description": "Extensions name to send to postgres initdb. The value is a comma separated string of arguments as postgis initdb would expect them.", - "type": "string" + "type": "string", + "default": "postgis,hstore,postgis_topology,postgis_raster,pgrouting" }, "uri": { "description": "Sql files could be on an archive root", "title": "Initialisation script Url", - "type": "string", - "default": "postgis,hstore,postgis_topology,postgis_raster,pgrouting" + "type": "string" } } }, diff --git a/repo/packages/P/postgis/0/marathon.json.mustache b/repo/packages/P/postgis/0/marathon.json.mustache index 2116cab..dab0db6 100644 --- a/repo/packages/P/postgis/0/marathon.json.mustache +++ b/repo/packages/P/postgis/0/marathon.json.mustache @@ -2,19 +2,19 @@ "id": "{{service.name}}", "cpus": {{service.cpus}}, "mem": {{service.mem}}, - "cmd": "{{#postresql.uri}}rm -rf /docker-entrypoint-initdb.d && ln -s $MESOS_SANDBOX /docker-entrypoint-initdb.d && {{/postresql.uri}}docker-entrypoint.sh postgres", + "cmd": "{{#postgis.uri}}rm -rf /docker-entrypoint-initdb.d && ln -s $MESOS_SANDBOX /docker-entrypoint-initdb.d && {{/postgis.uri}}docker-entrypoint.sh postgres", "instances": 1, "env": { - "POSTGRES_USER": "{{postresql.username}}", - "POSTGRES_PASS": "{{postresql.password}}", - "POSTGRES_DBNAME": "{{postresql.dbname}}", - "POSTGRES_INITDB_ARGS": "{{postresql.initdbargs}}" - "POSTGRES_MULTIPLE_EXTENSIONS": "{{postresql.extensions}}" + "POSTGRES_USER": "{{postgis.username}}", + "POSTGRES_PASS": "{{postgis.password}}", + "POSTGRES_DBNAME": "{{postgis.dbname}}", + "POSTGRES_INITDB_ARGS": "{{postgis.initdbargs}}" + "POSTGRES_MULTIPLE_EXTENSIONS": "{{postgis.extensions}}" }, "container": { "type": "DOCKER", "docker": { - "image": "{{resource.assets.container.docker.image}}:{{postresql.version}}", + "image": "{{resource.assets.container.docker.image}}:{{postgis.version}}", "forcePullImage": true, "portMappings": [ @@ -39,7 +39,7 @@ "minimumHealthCapacity": 0 }, "healthChecks": [ - {{#postresql.uri}} + {{#postgis.uri}} { "protocol": "MESOS_TCP", "portIndex": 0, @@ -48,17 +48,17 @@ "timeoutSeconds": 20, "maxConsecutiveFailures": 3 } - {{/postresql.uri}} + {{/postgis.uri}} ], "fetch": [ - {{#postresql.uri}} + {{#postgis.uri}} { - "uri": "{{postresql.uri}}", + "uri": "{{postgis.uri}}", "extract": true, "executable": false, "cache": false } - {{/postresql.uri}} + {{/postgis.uri}} ], "labels": { "HAPROXY_0_ENABLED":"true",