Skip to content

Commit

Permalink
Update docker installation docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tariqksoliman committed Feb 13, 2024
1 parent 3e0cf0e commit c99a054
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 41 deletions.
76 changes: 60 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,65 @@

## Installation

---

## Installing with Docker

### Building

To build the Docker image, run:
`docker build -t <image tag> .`

### Running

This repo contains a `docker-compose.yml` file that defines a service for the application and a PostgreSQL database with PostGIS installed

- Copy `/sample.env` to `.env`
`cp sample.env .env`
- Open `.env` and update the following:

```
DB_NAME=<name>
DB_USER=<user>
DB_PASS=<password>
```

From the install example:

```
DB_NAME=dv
DB_USER=postgres
DB_PASS=<POSTGRES_PASSWORD (see below)>
```

- Set all the ENV variables in `.env`. More information about the ENVs can be found [here.](https://nasa-ammos.github.io/MMGIS/setup/envs)
- If using the postgis/postgres image from within the docker-compose.yml, set the ENV `DB_NAME` to the name of the service (in this case `db`)
- In the `db` service in `docker-compose.yml`, set the `POSTGRES_PASSWORD` environment variable and use this for MMGIS's `DB_PASS` ENV value.
- To run MMGIS in a container, you need to create a directory on the host machine and map this to a directory in the container.
- On the host machine, create a `Missions` directory and copy the contents of `./Missions` to your directory.
- Via the docker-compose.yml, map this directory to `/usr/src/app/Missions` in the container. For example, if the host directory is `./Missions`, the volume mapping would be `- ./Missions:/usr/src/app/Missions`

Run: `docker-compose up`

### First Time UI Setup

1. Setup the admin account:

- In your browser, navigate to `http://localhost:8888/configure`
- Sign up for an Administrator account (The Administrator account is always the first user in the database and you are only prompted to create an Administrator account if there are no other users)

1. Now sign in with you Administrator credentials

1. Click `NEW MISSION`
Enter a new mission name and click `MAKE MISSION`
Optiona;" (Use the mission name `"Test"` (case-sensitive) to make the sample mission)

Navigate to `http://localhost:8888`.

See the [configuration documentation](https://nasa-ammos.github.io/MMGIS/configure/) for more information on how to use the configure page to customize and add data to MMGIS.

## Installing Without Docker

### System Requirements

1. Install the latest version of [Node.js v16.13.2+](https://nodejs.org/en/download/).
Expand Down Expand Up @@ -138,24 +197,9 @@ Check out our code of conduct [here.](CODE_OF_CONDUCT.md)

---

## Installing with Docker

To build the Docker image, run:
`docker build -t <image tag> .`

To run MMGIS in a container, you need to create a directory on the host machine and map this to a directory in the container. On the host machine, create a `Missions` directory and copy the contents of `./Missions` to your directory. Map this directory to `/usr/src/app/Missions` in the container. For example, if the host directory is `/Missions`, launch the container with:

`docker run -v /Missions:/usr/src/app/Missions <image tag>`

This repo contains a `docker-compose.yml` file that defines a service for the application and a PostgreSQL database with PostGIS installed. Simply set all the env variables in `.env` and run:

`docker-compose up`

---

### License: Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0)

Copyright (c) 2023, California Institute of Technology ("Caltech"). U.S. Government sponsorship acknowledged.
Copyright (c) 2024, California Institute of Technology ("Caltech"). U.S. Government sponsorship acknowledged.

All rights reserved.

Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ services:
db:
image: postgis/postgis:10-2.5-alpine
env_file: .env
environment:
POSTGRES_PASSWORD_OFF: Rename to 'POSTGRES_PASSWORD' and replace this with an initial root password for the DB
ports:
- 5432:5432
restart: on-failure
Expand Down
89 changes: 64 additions & 25 deletions docs/pages/Setup/Installation/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,65 @@ nav_order: 1

# Installation

---

## Installing with Docker

### Building

To build the Docker image, run:
`docker build -t <image tag> .`

### Running

This repo contains a `docker-compose.yml` file that defines a service for the application and a PostgreSQL database with PostGIS installed

- Copy `/sample.env` to `.env`
`cp sample.env .env`
- Open `.env` and update the following:

```
DB_NAME=<name>
DB_USER=<user>
DB_PASS=<password>
```

From the install example:

```
DB_NAME=dv
DB_USER=postgres
DB_PASS=<POSTGRES_PASSWORD (see below)>
```

- Set all the ENV variables in `.env`. More information about the ENVs can be found [here.](https://nasa-ammos.github.io/MMGIS/setup/envs)
- If using the postgis/postgres image from within the docker-compose.yml, set the ENV `DB_NAME` to the name of the service (in this case `db`)
- In the `db` service in `docker-compose.yml`, set the `POSTGRES_PASSWORD` environment variable and use this for MMGIS's `DB_PASS` ENV value.
- To run MMGIS in a container, you need to create a directory on the host machine and map this to a directory in the container.
- On the host machine, create a `Missions` directory and copy the contents of `./Missions` to your directory.
- Via the docker-compose.yml, map this directory to `/usr/src/app/Missions` in the container. For example, if the host directory is `./Missions`, the volume mapping would be `- ./Missions:/usr/src/app/Missions`

Run: `docker-compose up`

### First Time UI Setup

1. Setup the admin account:

- In your browser, navigate to `http://localhost:8888/configure`
- Sign up for an Administrator account (The Administrator account is always the first user in the database and you are only prompted to create an Administrator account if there are no other users)

1. Now sign in with you Administrator credentials

1. Click `NEW MISSION`
Enter a new mission name and click `MAKE MISSION`
Optiona;" (Use the mission name `"Test"` (case-sensitive) to make the sample mission)

Navigate to `http://localhost:8888`.

See the [configuration documentation](https://nasa-ammos.github.io/MMGIS/configure/) for more information on how to use the configure page to customize and add data to MMGIS.

## Installing Without Docker

### System Requirements

1. Install the latest version of [Node.js v16.13.2+](https://nodejs.org/en/download/).
Expand All @@ -17,17 +76,12 @@ nav_order: 1
1. Make a new PostgreSQL database and remember the user, password and database name.
Use 'pgsl' or the 'SQL Shell' to log into Postgres. It will prompt you for the username and password made during the install.

Issue the following commands:
`CREATE DATABASE mmgis;`
`\c mmgis`
`CREATE EXTENSION postgis;`
`exit`
In the above `\c` attaches to the database and `CREATE EXTENSION` enables PostGIS by creating a spatial reference table within that database.
1. GDAL and Python are weaker dependencies (desirable but, without them, not everything will work)

1. GDAL and Python are weaker dependencies (without them not everything will work)

- GDAL [2.+](https://gdal.org/download.html) with Python bindings
- Python [2.7+](https://www.python.org/downloads/release/python-2718/)/[3.6+](https://www.python.org/downloads/release/python-396/)
- GDAL [2.+](https://gdal.org/download.html) with Python bindings (Windows users may find [these](https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal) helpful)
- Python [3.6+](https://www.python.org/downloads/release/python-396/)
- `python -m pip install numpy`
- Note: MMGIS expects and uses the command `python` only and not `python3` or variations.

### Setup

Expand Down Expand Up @@ -95,18 +149,3 @@ _Note:_ The development environment (`npm start`) and only the development envir

1. Run `npm run test`
_Note:_ Jest has just been added in v2.0.0 and test suites are still very limited

---

## Installing with Docker

To build the Docker image, run:
`docker build -t <image tag> .`

To run MMGIS in a container, you need to create a directory on the host machine and map this to a directory in the container. On the host machine, create a `Missions` directory and copy the contents of `./Missions` to your directory. Map this directory to `/usr/src/app/Missions` in the container. For example, if the host directory is `/Missions`, launch the container with:

`docker run -v /Missions:/usr/src/app/Missions <image tag>`

This repo contains a `docker-compose.yml` file that defines a service for the application and a PostgreSQL database with PostGIS installed. Simply set all the env variables in `.env` and run:

`docker-compose up`

0 comments on commit c99a054

Please sign in to comment.