Skip to content

JoshuaPeddle/Notes-app

Repository files navigation

Notes-app - A containerized web app for note taking

Available at notesapp.cloud (Served over HTTPS)

Technical Overview

Back-end.

The back-end is written is NodeJS using express. MongoDB is used for the database. Notes are stored here. Express-session uses the database for session stores.

Front-end.

The front end is build using HTML, CSS and Javascript. No view engine is used.

Testing

TODO: Implement testing in mocha
npm run dev
rum run tests

Running locally

Without Docker - NodeJS

The NodeJS back-end requires an MongoDB database to be running. Install MongoDB locally or run it in a container.

dotenv is used to load enviroment variables in the absence of Docker. MONGODB_CONNSTRING must be defined in a .env file or in your systems environment formatted as such:

mongodb://{mongoUSER}:{mongoPASSWORD}@{mongoIP}:{mongoPORT}

DBNAME is also necessary environment variable. This defines the name of the MongoDB database the app will connect to.

Example: mongodb://admin:password123@192.168.2.43:27017

With Docker

The NodeJS back-end requires an MongoDB database to be running. Install MongoDB locally or run it in a container.
docker build -t localbuild .
docker run -d -e MONGODB_CONNSTRING=mongodb://{mongoUSER}:{mongoPASSWORD}@{mongoIP}:{mongoPORT} -p 80:8080  docker.io/library/localbuild 
docker run -d -e MONGODB_CONNSTRING=mongodb://{mongoUSER}:{mongoPASSWORD}@{mongoIP}:{mongoPORT} -e DBNAME="{dbname}" -p 80:8080  docker.io/library/localbuild

The webiste should be running at localhost

With Docker Compose

Use local build for docker compose

docker compose -f docker-compose-local.yml up  -d 

Use remote build for docker compose

First push a build using docker build

docker buildx build  --platform linux/amd64,linux/arm64 -t {dockerusername}/{appname}:{versionnumber} --push .

replace "image:joshuapeddle/notes-app:X.X" in docker-compose.yml with "image: {dockerusername}/{appname}:{versionnumber}" Then do the compose, pulling the remote build.

docker compose -f docker-compose.yml pull 
docker compose -f docker-compose.yml up  -d