Skip to content

Commit 03fd832

Browse files
authored
Merge pull request #58 from VaaS-4-0/dev
added docker image and read me updates
2 parents 7dd3a86 + b407b88 commit 03fd832

File tree

4 files changed

+58
-6
lines changed

4 files changed

+58
-6
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Visualization as a Service ("VaaS") is an open-source tool that allows users to
2121

2222
VaaS is actively being developed with the support of OSLabs and we are always looking for contributors and feedback.
2323

24+
[Website](https://www.vaas.dev/) | [GitHub](https://github.com/oslabs-beta/VaaS) | [DockerHub](https://hub.docker.com/r/vaasofficial/vaas_official_image)
25+
2426
<br/>
2527

2628
## Features

SETUP.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,9 @@ EXPRESS_CONSOLE_LOG=off
237237

238238
If you're using a cloud database, you can simply copy the connection string and paste it into the environment variable file. If you're using localhost, you will need to install MongoDB and create a database.
239239

240-
Once the above steps are complete, run the following command:
240+
<br/>
241+
242+
# Run Commands
241243

242244
```
243245
npm run dev:server
@@ -249,10 +251,42 @@ npm run dev:server
249251
yarn dev:server
250252
```
251253

252-
_Run the following command if you use a Windows OS:_
254+
or the following command if you use Windows:
253255

254256
```
255257
npm run dev:windows
256258
```
257259

260+
<br/>
261+
262+
# Test Commands
263+
264+
To perform end-to-end testing, start a test server through the following command:
265+
266+
```
267+
npm run test:server
268+
```
269+
270+
or the following command if you use Windows:
271+
272+
```
273+
npm run test:server/windows
274+
```
275+
276+
Once a test server is running, run the following command:
277+
278+
```
279+
npx cypress run
280+
```
281+
282+
Backend testing does not require a running test server. Run the following command to perform testing:
283+
284+
```
285+
npm run test
286+
```
287+
288+
# Docker Image
289+
290+
With VaaS 4.0, you can now develop and run the application through a Docker container which has a mongoDB database preconfigured with it. See the ```Docker Compose``` file for details.
291+
258292
<br/>

docker-compose.yaml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,22 @@ services:
44
container_name: vaas
55
ports:
66
- 3020:3020
7-
env_file:
8-
- .env
7+
# Comment in the following two lines if you want to use your own .env file
8+
# env_file:
9+
# - .env
10+
# Comment out the following two lines and the mongo service if you want to connect to your own mongo instance
11+
environment:
12+
- CONTAINER=true
13+
# Uncomment the following two lines if you want to use your own source code
14+
# volumes:
15+
# - ./src:/usr/src/app/src
16+
depends_on:
17+
- mongo
18+
mongo:
19+
image: mongo
20+
container_name: mongo
21+
restart: always
922
volumes:
10-
- ./src:/usr/src/app/src
23+
- data:/data/db
24+
volumes:
25+
data:

src/server/mongoDb.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ class Database {
2222
url === 'localhost' || url === '127.0.0.1'
2323
? (protocol = 'mongodb://')
2424
: (protocol = 'mongodb+srv://');
25-
const uri =
25+
let uri =
2626
username && password
2727
? // MODIFY URI SYNTAX BASED ON ADMIN INPUT
2828
`${protocol}${username}:${password}${url}/${database}?retryWrites=true&w=majority`
2929
: `${protocol}${url}:${port}/${database}`;
3030
// INITIATE CONNECTION TO MONGODB
31+
if (process.env.CONTAINER) uri = `mongodb://mongo:27017`;
3132
this._mongo.connect(uri);
3233
// ASSIGN MONGOOSE CONNECTION TO db
3334
const db: Connection = this._mongo.connection;

0 commit comments

Comments
 (0)