[extensions-web/wip/openshift] openshift: initial configuration



commit 65adb8c1db7c15797491af4bf5e24a1fa39648f4
Author: Yuri Konotopov <ykonotopov gnome org>
Date:   Wed Dec 5 01:03:17 2018 +0400

    openshift: initial configuration

 .dockerignore                                   |   6 +-
 {docker => openshift/docker}/Dockerfile         |   2 +-
 {docker => openshift/docker}/docker-compose.yml |   4 +-
 {docker => openshift/docker}/nginx/Dockerfile   |   0
 {docker => openshift/docker}/nginx/nginx.conf   |   0
 {docker => openshift/docker}/wsgi.ini           |   0
 openshift/templates/extensions-web-nginx.json   | 402 ++++++++++++++++++++++++
 7 files changed, 408 insertions(+), 6 deletions(-)
---
diff --git a/.dockerignore b/.dockerignore
index 1b5f021..3b99005 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -31,9 +31,9 @@ local_settings.py
 *.key
 
 contrib/
-docker/
-!docker/nginx.conf
-!docker/wsgi.ini
+openshift/docker/
+!openshift/docker/nginx.conf
+!openshift/docker/wsgi.ini
 static/
 uploaded-files/
 xapian*
diff --git a/docker/Dockerfile b/openshift/docker/Dockerfile
similarity index 98%
rename from docker/Dockerfile
rename to openshift/docker/Dockerfile
index 63c4b8c..26e587b 100644
--- a/docker/Dockerfile
+++ b/openshift/docker/Dockerfile
@@ -57,7 +57,7 @@ RUN set -ex \
 RUN mkdir -p /extensions-web/app
 WORKDIR /extensions-web/app
 COPY . /extensions-web/app
-COPY docker/wsgi.ini /extensions-web
+COPY openshift/docker/wsgi.ini /extensions-web
 RUN set -ex \
        && chown www-data:www-data -R /extensions-web/app \
        && chown www-data:www-data /extensions-web/wsgi.ini \
diff --git a/docker/docker-compose.yml b/openshift/docker/docker-compose.yml
similarity index 94%
rename from docker/docker-compose.yml
rename to openshift/docker/docker-compose.yml
index 9abb4ce..c202dfc 100644
--- a/docker/docker-compose.yml
+++ b/openshift/docker/docker-compose.yml
@@ -15,8 +15,8 @@ services:
       - "database:/var/lib/mysql"
   extensions-web:
     build:
-      context: ../
-      dockerfile: docker/Dockerfile
+      context: ../../
+      dockerfile: openshift/docker/Dockerfile
     command: bash -c "python manage.py migrate && rm -r /extensions-web/www/static-files; python manage.py 
collectstatic --noinput && uwsgi --enable-threads --ini /extensions-web/wsgi.ini"
     image: extensions-web
     environment:
diff --git a/docker/nginx/Dockerfile b/openshift/docker/nginx/Dockerfile
similarity index 100%
rename from docker/nginx/Dockerfile
rename to openshift/docker/nginx/Dockerfile
diff --git a/docker/nginx/nginx.conf b/openshift/docker/nginx/nginx.conf
similarity index 100%
rename from docker/nginx/nginx.conf
rename to openshift/docker/nginx/nginx.conf
diff --git a/docker/wsgi.ini b/openshift/docker/wsgi.ini
similarity index 100%
rename from docker/wsgi.ini
rename to openshift/docker/wsgi.ini
diff --git a/openshift/templates/extensions-web-nginx.json b/openshift/templates/extensions-web-nginx.json
new file mode 100644
index 0000000..2deafe0
--- /dev/null
+++ b/openshift/templates/extensions-web-nginx.json
@@ -0,0 +1,402 @@
+{
+  "kind": "Template",
+  "apiVersion": "v1",
+  "metadata": {
+    "name": "extensions-web",
+    "annotations": {
+      "openshift.io/display-name": "GNOME Shell extensions website",
+      "description": "GNOME Shell extensions website. For more information about using this template see 
https://gitlab.gnome.org/Infrastructure/extensions-web.";,
+      "tags": "gnome,python,nginx,uwsgi,extensions-web",
+      "iconClass": "icon-django",
+      "openshift.io/long-description": "This template defines resources needed to run GNOME Shell extensions 
repository website, including a build configuration and application deployment configuration.  It does not 
include a database.",
+      "openshift.io/provider-display-name": "GNOME",
+      "openshift.io/documentation-url": "https://gitlab.gnome.org/Infrastructure/extensions-web";,
+      "openshift.io/support-url": "https://gitlab.gnome.org/Infrastructure/extensions-web/issues";,
+      "template.openshift.io/bindable": "false"
+    }
+  },
+  "message": "The following service(s) have been created in your project: ${NAME}.\n\nFor more information 
about using this template, see https://gitlab.gnome.org/Infrastructure/extensions-web.";,
+  "labels": {
+      "template": "extensions-web",
+      "app": "extensions-web"
+  },
+  "objects": [
+    {
+      "kind": "Secret",
+      "apiVersion": "v1",
+      "metadata": {
+        "name": "${NAME}"
+      },
+      "stringData": {
+        "database-url": "${EGO_DATABASE_URL}",
+        "secret-key": "${EGO_SECRET_KEY}"
+      }
+    },
+    {
+      "kind": "Service",
+      "apiVersion": "v1",
+      "metadata": {
+        "name": "${NAME}",
+        "annotations": {
+          "description": "Exposes and load balances the application pods"
+        }
+      },
+      "spec": {
+        "ports": [
+          {
+            "name": "${NAME}",
+            "port": 80,
+            "targetPort": 80
+          }
+        ],
+        "selector": {
+          "name": "frontend"
+        }
+      }
+    },
+    {
+      "kind": "Route",
+      "apiVersion": "v1",
+      "metadata": {
+        "name": "${NAME}"
+      },
+      "spec": {
+        "host": "${APPLICATION_DOMAIN}",
+        "to": {
+          "kind": "Service",
+          "name": "${NAME}"
+        }
+      }
+    },
+    {
+      "kind": "ImageStream",
+      "apiVersion": "v1",
+      "metadata": {
+        "name": "${NAME}",
+        "annotations": {
+          "description": "Keeps track of changes in the application image"
+        }
+      }
+    },
+    {
+      "kind": "BuildConfig",
+      "apiVersion": "v1",
+      "metadata": {
+        "name": "${NAME}",
+        "annotations": {
+          "description": "Defines how to build the application",
+          "template.alpha.openshift.io/wait-for-ready": "true"
+        }
+      },
+      "spec": {
+        "source": {
+          "type": "Git",
+          "git": {
+            "uri": "${SOURCE_REPOSITORY_URL}",
+            "ref": "${SOURCE_REPOSITORY_REF}"
+          }
+        },
+        "postCommit": {
+            "script": "python manage.py test"
+        },
+        "strategy": {
+          "type": "Docker",
+          "dockerStrategy": {
+            "dockerfilePath": "openshift/docker/Dockerfile"
+          }
+        },
+        "output": {
+          "to": {
+            "kind": "ImageStreamTag",
+            "name": "${NAME}:latest"
+          }
+        },
+        "triggers": [
+          {
+            "type": "ImageChange"
+          },
+          {
+            "type": "ConfigChange"
+          }
+        ]
+      }
+    },
+    {
+      "kind": "BuildConfig",
+      "apiVersion": "v1",
+      "metadata": {
+        "name": "frontend",
+        "annotations": {
+          "description": "Defines how to build the frontend",
+          "template.alpha.openshift.io/wait-for-ready": "true"
+        }
+      },
+      "spec": {
+        "source": {
+          "type": "Git",
+          "git": {
+            "uri": "${SOURCE_REPOSITORY_URL}",
+            "ref": "${SOURCE_REPOSITORY_REF}"
+          },
+          "contextDir": "openshift/docker/nginx"
+        },
+        "strategy": {
+          "type": "Docker"
+        },
+        "output": {
+          "to": {
+            "kind": "ImageStreamTag",
+            "name": "frontend:latest"
+          }
+        },
+        "triggers": [
+          {
+            "type": "ImageChange"
+          },
+          {
+            "type": "ConfigChange"
+          }
+        ]
+      }
+    },
+    {
+      "kind": "PersistentVolumeClaim",
+      "apiVersion": "v1",
+      "metadata": {
+        "name": "static"
+      },
+      "spec": {
+        "accessModes": [
+          "ReadWriteOnce"
+        ],
+        "resources": {
+          "requests": {
+            "storage": "1024Mi"
+          }
+        }
+      }
+    },
+    {
+      "kind": "DeploymentConfig",
+      "apiVersion": "v1",
+      "metadata": {
+        "name": "${NAME}",
+        "annotations": {
+          "description": "Defines how to deploy the application server",
+          "template.alpha.openshift.io/wait-for-ready": "true"
+        }
+      },
+      "spec": {
+        "strategy": {
+          "type": "Recreate"
+        },
+        "triggers": [
+          {
+            "type": "ImageChange",
+            "imageChangeParams": {
+              "automatic": true,
+              "containerNames": [
+                "${NAME}"
+              ],
+              "from": {
+                "kind": "ImageStreamTag",
+                "name": "${NAME}:latest"
+              }
+            }
+          },
+          {
+            "type": "ConfigChange"
+          }
+        ],
+        "replicas": 1,
+        "selector": {
+          "name": "${NAME}"
+        },
+        "template": {
+          "metadata": {
+            "name": "${NAME}",
+            "labels": {
+              "name": "${NAME}"
+            }
+          },
+          "spec": {
+            "volumes": [
+              {
+                "name": "static-www",
+                "persistentVolumeClaim": {
+                  "claimName": "static"
+                }
+              }
+            ],
+            "containers": [
+              {
+                "name": "${NAME}",
+                "image": " ",
+                "ports": [
+                  {
+                    "containerPort": 8001
+                  }
+                ],
+                "readinessProbe": {
+                  "timeoutSeconds": 3,
+                  "initialDelaySeconds": 3,
+                  "periodSeconds": 60,
+                  "httpGet": {
+                    "path": "/",
+                    "port": 8001
+                  }
+                },
+                "livenessProbe": {
+                  "timeoutSeconds": 3,
+                  "initialDelaySeconds": 30,
+                  "periodSeconds": 60,
+                  "httpGet": {
+                    "path": "/",
+                    "port": 8001
+                  }
+                },
+                "env": [
+                  {
+                    "name": "EGO_DATABASE_URL",
+                    "valueFrom": {
+                      "secretKeyRef" : {
+                        "name" : "${NAME}",
+                        "key" : "database-url"
+                      }
+                    }
+                  },
+                  {
+                    "name": "EGO_SECRET_KEY",
+                    "valueFrom": {
+                      "secretKeyRef" : {
+                        "name" : "${NAME}",
+                        "key" : "secret-key"
+                      }
+                    }
+                  },
+                  {
+                    "name": "EGO_ALLOWED_HOST",
+                    "value": "${APPLICATION_DOMAIN}"
+                  },
+                  {
+                    "name": "EGO_XAPIAN_DB",
+                    "value": "${EGO_XAPIAN_DB}"
+                  }
+                ],
+                "volumeMounts": [
+                  {
+                    "name": "static-www",
+                    "mountPath": "/extensions-web/www"
+                  }
+                ],
+                "resources": {
+                  "limits": {
+                    "memory": "${MEMORY_LIMIT}"
+                  }
+                }
+              },
+              
+              {
+                "name": "frontend",
+                "image": " ",
+                "ports": [
+                  {
+                    "containerPort": 80
+                  }
+                ],
+                "readinessProbe": {
+                  "timeoutSeconds": 3,
+                  "initialDelaySeconds": 10,
+                  "periodSeconds": 60,
+                  "httpGet": {
+                    "path": "/",
+                    "port": 80
+                  }
+                },
+                "livenessProbe": {
+                  "timeoutSeconds": 3,
+                  "initialDelaySeconds": 45,
+                  "periodSeconds": 60,
+                  "httpGet": {
+                    "path": "/",
+                    "port": 80
+                  }
+                },
+                "volumeMounts": [
+                  {
+                    "name": "static-www",
+                    "mountPath": "/extensions-web/www"
+                  }
+                ],
+                "resources": {
+                  "limits": {
+                    "memory": "512Mi"
+                  }
+                }
+              }
+            ]
+          }
+        }
+      }
+    }
+  ],
+  "parameters": [
+    {
+      "name": "NAME",
+      "displayName": "Name",
+      "description": "The name assigned to all of the frontend objects defined in this template.",
+      "required": true,
+      "value": "extensions-web"
+    },
+    {
+      "name": "NAMESPACE",
+      "displayName": "Namespace",
+      "description": "The OpenShift Namespace where the ImageStream resides.",
+      "required": true,
+      "value": "openshift"
+    },
+    {
+      "name": "MEMORY_LIMIT",
+      "displayName": "Memory Limit",
+      "description": "Maximum amount of memory the container can use.",
+      "required": true,
+      "value": "2048Mi"
+    },
+    {
+      "name": "SOURCE_REPOSITORY_URL",
+      "displayName": "Git Repository URL",
+      "description": "The URL of the repository with your application source code.",
+      "required": true,
+      "value": "https://gitlab.gnome.org/Infrastructure/extensions-web.git";
+    },
+    {
+      "name": "SOURCE_REPOSITORY_REF",
+      "displayName": "Git Reference",
+      "description": "Set this to a branch name, tag or other ref of your repository if you are not using 
the default branch."
+    },
+    {
+      "name": "APPLICATION_DOMAIN",
+      "displayName": "Application Hostname",
+      "description": "The exposed hostname that will route to the extensions-web service, if left blank a 
value will be defaulted.",
+      "value": ""
+    },
+    {
+      "name": "EGO_DATABASE_URL",
+      "displayName": "Database URL",
+      "description": "Database URL in format suitable for dj-database-url",
+      "value": ""
+    },
+    {
+      "name": "EGO_SECRET_KEY",
+      "displayName": "Django secret key",
+      "description": "Django secret key.",
+      "value": ""
+    },
+    {
+      "name": "EGO_XAPIAN_DB",
+      "displayName": "Xapian database path",
+      "description": "Path to Xapian database.",
+      "value": ""
+    }
+  ]
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]