Digital Register of Shipping (DRS) for the Island of Navis Album
- Open Terminal
cd
into whatever folder you want to put this repo in ex:~/Projects
git clone git@github.com:InDeepShip/InDeepShip.git
node == v12.19.0
npm == v6.14.8
A Few tools that you can utilize in order to install the client code software requirements is homebrew and nvm
Run the following command to install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Nvm stands for Node Version Manager. Since the creation of Node there has been many version updates (e.g, Node v6, Node v10, etc). The current Node version that is LTS is Node v12.19.0. So we will use nvm to install the correct node js version. Install NVM with the following command
brew install nvm
nvm install v12
You should now have the correct version of node and npm installed. You can verify this on the command prompt
$ node --version
v12.19.0
You're on your own bud.
cd InDeepShip/bow
npm install
npm start
cd InDeepShip/bow
npm install
npm run build
this builds a deployable software located at directory./build
python >= 3.8.0
pip >= 19.2.3
brew install python
You should now have the correct (or newer) version of python3 and pip3.
$ python3 --version
Python 3.8.3
$ pip3 --version
pip 19.2.3 from /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip (python 3.8)
It is good practice to set up a virtual enviornment on your system for your python
environment. What does that mean?
That basically means to create an environment that will keep track of your prefered version of python and pip.
And also an enviornment that will keep track of your python packages you will install (e.g. Django)
cd InDeepShip/
python3 -m venv --system-site-packages ./venv
this will create a directoryInDeepShip/venv
which contains the python, pip and packages for your virtual environment- Now activate your virtual environment with command
source ./venv/bin/activate
- Install python packages required for backend software with command
pip install -r requirements.txt
- You can exit your python virtual environment with command
deactivate
(Don't do this if you are trying to run software).
Following commands should be executed where Setup Virtual Enviornemnt left off.
cd InDeepShip/aft
run commandpython manage.py runserver
mongodb >= v4.4.1
Run the following commands to install mongoDB via command line
brew update
brew tap mongo/brew
brew install mongodb-community
You should be able to check the version of mongodb installed now
$ mongod --version
b version v4.4.1
Build Info: {
"version": "4.4.1",
"gitVersion": "ad91a93a5a31e175f5cbf8c69561e788bbc55ce1",
"modules": [],
"allocator": "system",
"environment": {
"distarch": "x86_64",
"target_arch": "x86_64"
}
}
If you have a Mac with OS version older than Catalina the following instructions would work to setup and start you database. However if you have OS Catalina or greater.. see below.
$ sudo mkdir -p /data/db
$ sudo chown -R `id -un` /data/db
$ mongod
If you have Mac OS Catalina or greater, you are no longer able to store files or data in read-only system volume, nor can you write to the 'root' directory (/) from the command line. So instead you need to create a directory data path in your personal home directory
$ cd ~/
$ mkdir MongoData
$ sudo chown -R `id -un` MongoData
Next, you need to pass the complete datapath to the MongoData directory you created to mongod. For example, my data path was /Users/michael/MongoData
$ pwd
/Users/michael/MongoData
$ mongod --dbpath=/Users/michael/MongoData
This should result in your mongo database to be up and running.
- https://www.robinwieruch.de/mongodb-macos-setup
- https://medium.com/@bryantjiminson/fixing-data-db-not-found-error-in-macos-x-when-starting-mongodb-d7b82abb2479
In order to run both frontend + backend software locally, you need to do the following
- Open a terminal
cd InDeepShip/bow
- Run
npm start
- Open a terminal
- Make sure you are in your virtualenv for python.
cd InDeepShip/aft
python manage.py runserver
To access our development server, you can ssh
in case there is any need to make
modifications or fix server on the fly
- Open a terminal
ssh USERNAME@SERVER_IP
You should have a personal account setup for you- Default password is
password123
- At some point you should change your default password
If for any reason you need to make modifications as root
user, you should have root privledges
you can change into the root
user via:
- Run Command
sudo su -
- This will prompt you for your user password
Server code is located in directory /var/InDeepShip
FYI
Django REST Framework supports generating human-friendly HTML output for each resource when the HTML format is requested. These pages allow for easy browsing of resources, as well as forms for submitting data to the resources using POST, PUT, and DELETE. Read more here.
To see the overview of available DRS REST APIs, navigate to http://127.0.0.1:8000/api/
. To see a description of a specific API, just navigate to that API in your browser, for example http://127.0.0.1:8000/api/bugreport