Skip to content

m4rc0z/lunch-app-backend

Repository files navigation

lunch-app-backend

Local Setup

#####start backend:

$ npm run start:local

This will create a local mongodb with a database name lunch-app-database and a user admin with the password admin. It will also start the backend including the local mongodb instance. The backend will be available on http://localhost:3005 It can happen that the backend throws an error at the first connect to the mongodb, in this case the backend tries to reconnect.

#####start frontend:

  1. to start the frontend you must checkout an other repository:
$ git checkout https://github.com/m4rc0z/lunch-admin-app.git
  1. to start the frontend see instructions for local setup inside the readme of the frontend repository

Docker

Build container:

$ docker build -t m4rc0z/lunch-app-backend .

Run container:

$ docker run --env-file ./env.list -p 127.0.0.1:3005:3005/tcp -it m4rc0z/lunch-app-backend:latest

Connect with: http://localhost:3005

Stop the container:

$ docker stop --time 0 $(docker ps -q --filter ancestor=m4rc0z/lunch-app-backend)

Debug container:

$ docker run --entrypoint "/bin/sh" -it m4rc0z/lunch-app-backend:latest

Base containers

Ideally one should use an alpine container, e.g. FROM node:12.13.0-alpine, but this gives a warning:

Sending build context to Docker daemon  419.3kB
Step 1/7 : FROM node:12.13.0-alpine as builder
...
mongodb-memory-server: checking MongoDB binaries cache...
Unknown linux distro Raspbian, falling back to legacy MongoDB build
mongodb-memory-server: binary path is /usr/src/app/node_modules/.cache/mongodb-memory-server/mongodb-binaries/4.0.3/mongod
...

This is a known issue, see:

for reference.

Alternatively use a mongo container, e.g.:

FROM mongo:4.2.1-bionic
...

But note the size difference:

$ docker images

node                          12.13.0-alpine      052e3dbb343f        3 days ago          80.9MB
mongo                         4.2.1-bionic        191b28dbfefe        33 hours ago        363MB

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages