From 3bcb949fd7c3b9b5ac66e71c222e4a065d70b663 Mon Sep 17 00:00:00 2001 From: Sonmez Kartal Date: Thu, 14 Sep 2017 15:51:17 +0300 Subject: [PATCH] koding: configuration fixes and improvements Remove obsolete configuration properties Remove default value of hostname option Remove redundant `cmd` property Add --hostname option to `args` property Set volume host paths in the sandbox directory Define a volume for generated files directory Add residency property Add initial health check Reorder some properties Configure with nginx real ip module Update pre installation notes Bump up minimum DC/OS release version Bump up package version Signed-off-by: Sonmez Kartal --- repo/packages/K/koding/1/config.json | 51 ++++++++++ .../K/koding/1/marathon.json.mustache | 94 +++++++++++++++++++ repo/packages/K/koding/1/package.json | 21 +++++ repo/packages/K/koding/1/resource.json | 18 ++++ 4 files changed, 184 insertions(+) create mode 100644 repo/packages/K/koding/1/config.json create mode 100644 repo/packages/K/koding/1/marathon.json.mustache create mode 100644 repo/packages/K/koding/1/package.json create mode 100644 repo/packages/K/koding/1/resource.json diff --git a/repo/packages/K/koding/1/config.json b/repo/packages/K/koding/1/config.json new file mode 100644 index 000000000..e877317c5 --- /dev/null +++ b/repo/packages/K/koding/1/config.json @@ -0,0 +1,51 @@ +{ + "type": "object", + "properties": { + "service": { + "type": "object", + "description": "DC/OS service configuration properties", + "properties": { + "name": { + "description": "Name of this service instance.", + "type": "string", + "default": "koding" + } + } + }, + "koding": { + "type": "object", + "description": "Koding instance configuration properties", + "properties": { + "cpus": { + "description": "CPU shares to allocate to the Koding instance.", + "type": "number", + "default": 2.0, + "minimum": 1.0 + }, + "mem": { + "description": "Memory to allocate to the Koding instance.", + "type": "number", + "default": 8192, + "minimum": 1024 + } + }, + "required": [ + "cpus", + "mem" + ] + }, + "networking": { + "description": "Configuration options for Koding's networking", + "type": "object", + "properties": { + "hostname": { + "description": "The DNS name you intend to host your Koding instance at", + "type": "string" + } + }, + "required": [ + "hostname" + ] + } + } +} diff --git a/repo/packages/K/koding/1/marathon.json.mustache b/repo/packages/K/koding/1/marathon.json.mustache new file mode 100644 index 000000000..514d50ad0 --- /dev/null +++ b/repo/packages/K/koding/1/marathon.json.mustache @@ -0,0 +1,94 @@ +{ + "id": "{{service.name}}", + "cpus": {{koding.cpus}}, + "instances": 1, + "mem": {{koding.mem}}, + "disk": 20000, + "args": [ + "--host", "{{networking.hostname}}", + "--hostname", "{{networking.hostname}}", + "--nginx.real_ip" + ], + "requirePorts": true, + "container": { + "type": "DOCKER", + "docker": { + "image": "{{resource.assets.container.docker.koding}}", + "network": "BRIDGE", + "portMappings": [ + { + "containerPort": 8090, + "hostPort": 0, + "protocol": "tcp" + } + ] + }, + "volumes": [ + { + "containerPath": "generated-data", + "mode": "RW", + "persistent": { + "type": "root", + "size": 100 + } + }, + { + "containerPath": "/opt/koding/generated", + "hostPath": "generated-data", + "mode": "RW" + }, + { + "containerPath": "postgresql-data", + "mode": "RW", + "persistent": { + "type": "root", + "size": 2048 + } + }, + { + "containerPath": "/var/lib/postgresql", + "hostPath": "postgresql-data", + "mode": "RW" + }, + { + "containerPath": "mongo-data", + "mode": "RW", + "persistent": { + "type": "root", + "size": 4096 + } + }, + { + "containerPath": "/var/lib/mongodb", + "hostPath": "mongo-data", + "mode": "RW" + } + ] + }, + "residency": { + "taskLostBehavior": "WAIT_FOREVER" + }, + "healthChecks": [ + { + "gracePeriodSeconds": 180, + "intervalSeconds": 30, + "maxConsecutiveFailures": 3, + "path": "/", + "portIndex": 0, + "protocol": "HTTP", + "timeoutSeconds": 5 + } + ], + "labels":{ + "HAPROXY_GROUP":"external", + "HAPROXY_0_VHOST":"{{networking.hostname}}", + "HAPROXY_0_REDIRECT_TO_HTTPS": "{{networking.https-redirect}}", + "HAPROXY_0_HTTP_FRONTEND_ACL": " acl host_{cleanedUpHostname} hdr_end(host) -i {hostname}\n use_backend {backend} if host_{cleanedUpHostname}\n", + "HAPROXY_0_HTTPS_FRONTEND_ACL": " use_backend {backend} if {{ ssl_fc_sni -m end .{hostname} }}\n", + "MARATHON_SINGLE_INSTANCE_APP": "true" + }, + "upgradeStrategy":{ + "minimumHealthCapacity": 0, + "maximumOverCapacity": 0 + } +} diff --git a/repo/packages/K/koding/1/package.json b/repo/packages/K/koding/1/package.json new file mode 100644 index 000000000..816398203 --- /dev/null +++ b/repo/packages/K/koding/1/package.json @@ -0,0 +1,21 @@ +{ + "packagingVersion": "3.0", + "name": "koding", + "minDcosReleaseVersion":"1.10", + "version": "1.0.0-0.0.2", + "tags": ["koding", "IDE", "development"], + "maintainer": "support@koding.com", + "description": "Koding is a web based collaborative software development tool. We bring code development off of localhost and into the cloud. Installation documentation: https://github.com/dcos/examples/tree/master/koding", + "scm": "https://github.com/koding/koding.git", + "website": "http://www.koding.com", + "framework": false, + "postInstallNotes": "Happy Koding!", + "preInstallNotes": "This DC/OS Service is currently in preview. There may be bugs, incomplete features, incorrect documentation, or other discrepancies. Koding is a web based collaborative software development tool. We bring code development off of localhost and into your cloud environment. This package will install a single instance of Koding into your Mesosphere DCOS environment. Please note that Koding runs best with 8GB of RAM. Marathon-lb is also required for Koding to function properly. Please install Marathon-lb with HAProxy map option turned off before installing Koding.", + "postUninstallNotes":"Thank you for using Koding. In order to persist data between restarts, Koding kept data locally on the node in which it was installed. If you reinstall Koding on this node, you will still see this data. To delete this data, remove the /tmp/koding directory on the node.", + "licenses": [ + { + "name": "Apache 2.0", + "url": "https://github.com/koding/koding/blob/master/LICENSE" + } + ] +} diff --git a/repo/packages/K/koding/1/resource.json b/repo/packages/K/koding/1/resource.json new file mode 100644 index 000000000..3b0132e39 --- /dev/null +++ b/repo/packages/K/koding/1/resource.json @@ -0,0 +1,18 @@ +{ + "images": { + "icon-small": "http://koding-cdn.s3.amazonaws.com/logos.square/koding.logo.48px.png", + "icon-medium": "http://koding-cdn.s3.amazonaws.com/logos.square/koding.logo.96px.png", + "icon-large": "http://koding-cdn.s3.amazonaws.com/logos.square/koding.logo.256px.png", + "screenshots": [ + "http://koding-cdn.s3.amazonaws.com/mesos/Koding-IDE.jpg", + "http://koding-cdn.s3.amazonaws.com/mesos/Koding-Stack-Editor.jpg" + ] + }, + "assets": { + "container": { + "docker": { + "koding": "koding/singular" + } + } + } +}