Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Commit

Permalink
Add a node+mongodb application stack. (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
metlos authored Jul 2, 2019
1 parent 3f85a84 commit d78bd4a
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
76 changes: 76 additions & 0 deletions devfiles/nodejs-mongo/devfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
apiVersion: 1.0.0
metadata:
name: nodejs-mongo
projects:
-
name: nodejs-mongodb-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'
public: 'false'
commands:
-
name: run the web app
actions:
- type: exec
component: nodejs
command: npm install && npm run dev
workdir: ${CHE_PROJECTS_ROOT}/nodejs-mongodb-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
6 changes: 6 additions & 0 deletions devfiles/nodejs-mongo/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
displayName: NodeJS MongoDB Web Application
description: Default stack with NodeJS 10
tags: ["NodeJS", "Express", "MongoDB", "RealWorld", "Theia", "ubi8"]
icon: https://www.eclipse.org/che/images/logo-eclipseche.svg
globalMemoryLimit: 1686Mi

0 comments on commit d78bd4a

Please sign in to comment.