From 73dc31a3f02a9750d6d395f41ad22b1e0e1d0e18 Mon Sep 17 00:00:00 2001 From: Lukas Krejci Date: Fri, 28 Jun 2019 17:55:44 +0200 Subject: [PATCH 1/2] Add a mongo db application stack. --- devfiles/nodejs-mongo/devfile.yaml | 75 ++++++++++++++++++++++++++++++ devfiles/nodejs-mongo/meta.yaml | 6 +++ 2 files changed, 81 insertions(+) create mode 100644 devfiles/nodejs-mongo/devfile.yaml create mode 100644 devfiles/nodejs-mongo/meta.yaml diff --git a/devfiles/nodejs-mongo/devfile.yaml b/devfiles/nodejs-mongo/devfile.yaml new file mode 100644 index 000000000..b8293b3d8 --- /dev/null +++ b/devfiles/nodejs-mongo/devfile.yaml @@ -0,0 +1,75 @@ +--- +apiVersion: 1.0.0 +metadata: + name: nodejs-mongo +projects: + - + name: nodejs-realworld-app + source: + type: git + location: "https://github.com/gothinkster/node-express-realworld-example-app" +components: + - + type: chePlugin + id: che-incubator/typescript/latest + memoryLimit: 512Mi + - + type: dockerimage + alias: nodejs + image: registry.access.redhat.com/ubi8/nodejs-10 + command: ['sleep'] + args: ['infinity'] + env: + - name: HOME + value: /tmp/user + - name: PS1 + value: $(echo ${0})\\$ + # The values below are used to set up the environment for running the application + - name: SECRET + value: 220fd770-c028-480d-8f95-f84353c7d55a + - name: NODE_ENV + value: production + - name: MONGODB_URI + value: mongodb://user:password@mongo/db + memoryLimit: 512Mi + endpoints: + - name: 'nodejs' + port: 3000 + mountSources: true + - + type: dockerimage + alias: mongo + image: centos/mongodb-34-centos7 + memoryLimit: 512Mi + env: + - name: MONGODB_USER + value: user + - name: MONGODB_PASSWORD + value: password + - name: MONGODB_DATABASE + value: db + - name: MONGODB_ADMIN_PASSWORD + value: password + volumes: + - name: mongo-storage + containerPath: /var/lib/mongodb/data + endpoints: + - name: mongo + port: 27017 + attributes: + discoverable: 'true' +commands: + - + name: run the web app + actions: + - type: exec + component: nodejs + command: npm install && npm run dev + workdir: ${CHE_PROJECTS_ROOT}/nodejs-realworld-app + - + name: create test user + actions: + - type: exec + component: nodejs + command: | + curl -X POST --data '{"user": {"username": "test", "email": "test@test.com", "password": "password"}}' -H "Content-Type: application/json" http://localhost:3000/api/users diff --git a/devfiles/nodejs-mongo/meta.yaml b/devfiles/nodejs-mongo/meta.yaml new file mode 100644 index 000000000..726cf840f --- /dev/null +++ b/devfiles/nodejs-mongo/meta.yaml @@ -0,0 +1,6 @@ +--- +displayName: NodeJS RealWorld Web Application +description: Default stack with NodeJS 10 +tags: ["NodeJS", "Express", "RealWorld", "Theia", "ubi8"] +icon: https://www.eclipse.org/che/images/logo-eclipseche.svg +globalMemoryLimit: 1686Mi From c4f3dfe572b5468fe9abeb67ae6d0fe4362517e2 Mon Sep 17 00:00:00 2001 From: Lukas Krejci Date: Mon, 1 Jul 2019 11:39:27 +0200 Subject: [PATCH 2/2] Rename the app to stress the MongoDB more. --- devfiles/nodejs-mongo/devfile.yaml | 5 +++-- devfiles/nodejs-mongo/meta.yaml | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/devfiles/nodejs-mongo/devfile.yaml b/devfiles/nodejs-mongo/devfile.yaml index b8293b3d8..246c1f83a 100644 --- a/devfiles/nodejs-mongo/devfile.yaml +++ b/devfiles/nodejs-mongo/devfile.yaml @@ -4,7 +4,7 @@ metadata: name: nodejs-mongo projects: - - name: nodejs-realworld-app + name: nodejs-mongodb-app source: type: git location: "https://github.com/gothinkster/node-express-realworld-example-app" @@ -58,6 +58,7 @@ components: port: 27017 attributes: discoverable: 'true' + public: 'false' commands: - name: run the web app @@ -65,7 +66,7 @@ commands: - type: exec component: nodejs command: npm install && npm run dev - workdir: ${CHE_PROJECTS_ROOT}/nodejs-realworld-app + workdir: ${CHE_PROJECTS_ROOT}/nodejs-mongodb-app - name: create test user actions: diff --git a/devfiles/nodejs-mongo/meta.yaml b/devfiles/nodejs-mongo/meta.yaml index 726cf840f..d719a0500 100644 --- a/devfiles/nodejs-mongo/meta.yaml +++ b/devfiles/nodejs-mongo/meta.yaml @@ -1,6 +1,6 @@ --- -displayName: NodeJS RealWorld Web Application +displayName: NodeJS MongoDB Web Application description: Default stack with NodeJS 10 -tags: ["NodeJS", "Express", "RealWorld", "Theia", "ubi8"] +tags: ["NodeJS", "Express", "MongoDB", "RealWorld", "Theia", "ubi8"] icon: https://www.eclipse.org/che/images/logo-eclipseche.svg globalMemoryLimit: 1686Mi