Docker Instructions, installation and use

Running node.js apps can be a pain to deal with for anyone not using a Linux environment. I have dealt with this myself, using a Mac, and found that Docker seems to be the best way to run the js-trader application locally with minimal effort. If you are using Windows or Mac, Docker should be tried. If using Ubuntu, it may not be needed. Docker is a way to have a containerized environment that requires no effort to setup. To try this, follow these steps: Download and install Docker from: https://docs.docker.com/docker-for-windows/install/#download-docker-for-windows (Select the option for 'Get Docker for Windows Stable') Install docker locally Download this docker image file that we prepared: https://s3.amazonaws.com/javascriptprogramacion/stacksavings.tar.zip You will need to unzip the file as it is very large. Make sure that it is unzipped so that you have a file called just stacksavings.tar . On Mac, it seems to automatically unzip the tar also, and then delete the tar automatically, if you do it from the file browser, so I recommend unzipping from the command line. Once docker is installed, open a terminal and try running this: (Note that PATH-TO-FILE should be replaced with the actual path to the file that you downloaded. docker load -i / PATH-TO-FILE /stacksavings.tar You should have a local directory where you have checked out the project code from Github, such as the js-trader code. Also, this directory needs to have the Dynamo DB local jar, which can be downloaded from: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html. Get the path for the director mentioned above, use the full path for this as the PATH-REPLACE variable in the next step. This is going to be a folder that is part of your computer but then also will be accessible from within the Docker container. In the terminal run: docker run -t -i -v PATH-REPLACE :/src stacksavings /bin/bash You will now enter into the terminal for the docker container. This is like being in the terminal for an Ubuntu Linux environment. You can run node js commands to run a project and the latest Node.Js version and necessary NPM packages should already be installed, although you should run npm install inside the project, to make sure the latest packages are installed always. Within the docker container terminal, make sure you are in the directory from step #5, so that you have the jar for dynamo db in that directory (make sure it is extracted if it was not already). Make sure your are in the directory that has the file called DynamoDBLocal.jar . Then, you can run: nohup java -Djava.library.path=DynamoDBLocal_lib -jar DynamoDBLocal.jar -inMemory -port 8000 & To start the local dynamodb server. The nohup part of the command means that the terminal will let you press the 'enter' key to then still be able to use the terminal do other things after starting the database. This runs it in memory, so it doesn't actually save anything to disk, which should make it run faster. You can make it save to disk by removing the -inMemory option. (Another step may be needed to set the path for where it saves the data, I am not sure). If you are working with the js-trader project, an easy way to ensure that the database can be accessed is by going into the js-trader directory and running this command to create tables, as it should run without giving back an error: node Service/TestCreateTables BackTestTransactions ScoreCurrencies Notes: The current docker image file is very large. I am not sure exactly why this is but I think it may at least partly be because it has Java installed, which is needed to run the local Dynamo DB. Creating a new docker image that is smaller is a goal for the future.