This repository has been archived by the owner on Aug 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a node+mongodb application stack. (#22)
- Loading branch information
Showing
2 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |