Skip to content

Database Setup & Running Server

ModestosV edited this page Nov 6, 2018 · 1 revision
All the instructions will be posted below and kept up to date.

DB setup

To install docker on your system please choose system:

Windows:

https://docs.docker.com/toolbox/toolbox_install_windows/

Mac:

https://docs.docker.com/docker-for-mac/install/

Next, run the Docker Quickstart Terminal and wait for it to report ready. (This may take several minutes.) [Troubleshooting]: If Docker Quick Start Terminal is failing to start (failed to start host-only something something...) Restart PC, and right-click run as administrator worked for me.

After Docker is installed:

To get Mongo DB 4.0:

docker pull mongo:4.0

To run docker container:

docker run -p 27017:27017 --name mongo -v ~/data:/data -w /data -it mongo:4.0 

When we will have data we will be using mongo-restore and mongo-dump and I will provide assistance for that. That is all for now.

Server setup

To start the server cd into the server directory then please choose a package manager:

NPM

npm install 

Yarn

Install yarn.

npm install -g yarn

Then:

yarn

These commands will fetch all the submodules and dependencies required. There are 11 thousand. Should take no more than a minute. Once complete, it will transpile all the TS files into js in the dist folder.

Please choose a way to start server:

Once you have your database running, go to connection.ts

Replace localhost in the following code snippet with your mongo docker container's ip address.

mongoose.connect("mongodb://localhost/blackdice", { useNewUrlParser: true });

To find the ip address, run docker-machine ip inside your docker command line.

Node

node dist/src/server.js

Nodemon

install nodemon

npm install -g nodemon

then:

nodemon dist/src/server.js

Clone this wiki locally