Skip to content

Commit

Permalink
More updates to README file and scripts and a clean up.
Browse files Browse the repository at this point in the history
  • Loading branch information
hmusavi committed Dec 11, 2018
1 parent 33033f5 commit 67478e8
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 79 deletions.
52 changes: 37 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ Disable `git core.autocrlf` (One Time Only)
git config --global core.autocrlf false
```

#### Step 1 - Clone public repository
ODE software consists of the following modules:
#### Step 1 - Download the Source Code
ODE software consists of the following modules hosted on GitHub:

|Name|Visibility|Description|
|----|----------|-----------|
Expand All @@ -161,7 +161,7 @@ ODE software consists of the following modules:
|[asn1_codec](https://github.com/usdot-jpo-ode/asn1_codec)|public|ASN.1 Encoder/Decoder module|
|[jpo-security-svcs](https://github.com/usdot-jpo-ode/jpo-security-svcs)|public|Provides cryptographic services.|

Clone the repositories by running these commands:
To download the stable (default branch) source code for the first time, clone the repositories by running the following commands:

```bash
git clone --recurse-submodules https://github.com/usdot-jpo-ode/jpo-ode.git
Expand All @@ -174,11 +174,37 @@ git clone --recurse-submodules https://github.com/usdot-jpo-ode/jpo-ode.git

Once you have these repositories obtained, you are ready to build and deploy the application.

##### Downloading the source code from a non-default branch
The above steps to pull the code from GitHub repository pulls it from the default branch which is the stable branch. If you wish to pull the source code from a branch that is still under development or beta testing, you will need to specify the branch to pull from. The following commands aid you in that action.
```
# Backup user provided source or configuration files used by submodules
cp asn1_codec/asn1c_combined/J2735_201603DA.ASN .
#Run the following commands to reset existing branch
git reset --hard
git submodule foreach --recursive git reset --hard
# Pull from the non-default branch
git checkout <branch_name>
git pull origin <branch_name>
# The next command wipes out all of the submodules and re-initializes them.
git submodule deinit -f . && git submodule update --recursive --init
# Restore user provided source or configuration files used by submodules
cp ./J2735_201603DA.ASN asn1_codec/asn1c_combined/
```
**Note**: *These commands can also be performed using the provided script `update_branch`.*

---
### Build and Deploy the Application

ODE uses Docker for building and running the executable. Familiarize yourself with Docker and follow the instructions in the [README.md](docker/README.md).

ODE configuration can be customized for every deployment environment using environment variables. These variables can either be set locally or using the *sample.env* file found in the root of the jpo-ode repository.
#### Step 1: Configuration
If you wish to change the application properties, such as change the location of the upload service via `ode.uploadLocation.*` properties or set the `ode.kafkaBrokers` to something other than the $DOCKER_HOST_IP:9092, or wish to set the CAS username/password, `ODE_EXTERNAL_IPVs`, etc. instead of setting the environment variables, modify `jpo-ode-svcs\src\main\resources\application.properties` file as desired.

ODE configuration can be customized for every deployment environment using environment variables. These variables can either be set locally or using the *sample.env* file found in the root of the `jpo-ode` repository.

Instructions for how to use the *sample.env* file can be found [here](https://github.com/usdot-jpo-ode/jpo-ode/wiki/Using-the-.env-configuration-file).

Expand All @@ -192,14 +218,9 @@ You must rename `sample.env` to `.env` for Docker to automatically read the file

**Note** In order for Docker to automatically read the environment variable file, you must rename it from `sample.env` to `.env`.

#### Step 2: (Optional)
Familiarize yourself with Docker and follow the instructions in the [README.md](docker/README.md).

If you wish to change the application properties, such as change the location of the upload service via `ode.uploadLocation.*` properties or set the `ode.kafkaBrokers` to something other than the $DOCKER_HOST_IP:9092, or wish to set the CAS username/password, `ODE_EXTERNAL_IPVs`, etc. instead of setting the environment variables, modify `jpo-ode-svcs\src\main\resources\application.properties` file as desired.

#### Step 3: Build and deploy the application.
#### Step 2: Build and deploy the application.

Copy the following files from jpo-ode directory into your DOCKER_SHARED_VOLUME directory.
Copy the following files from `jpo-ode` directory into your DOCKER_SHARED_VOLUME directory.
- Copy jpo-ode/ppm.properties to ${DOCKER_SHARED_VOLUME}/config.properties. Open the newly copied `config.properties` file in a text editor and update the `metadata.broker.list=your.docker.host.ip:9092` line with your system's DOCKER_HOST_IP in place of the dummy `your.docker.host.ip` string.
- Copy jpo-ode/adm.properties to ${DOCKER_SHARED_VOLUME}/adm.properties
- Copy jpo-ode/aem.properties to ${DOCKER_SHARED_VOLUME}/aem.properties
Expand All @@ -211,15 +232,16 @@ docker-compose ps
```
To bring down the services and remove the running containers run the following command:
```
docker-compose down
```
For a fresh restart, run:
```
docker-compose down
docker-compose up --build -d
docker-compose ps
```
Check the deployment by running ```docker-compose ps```. You can start and stop containers using ```docker-compose start``` and ```docker-compose stop``` commands.
If using the multi-broker docker-compose file, you can change the scaling by running ```docker-compose scale <container>=n``` where container is the container you would like to scale and n is the number of instances. For example, ```docker-compose scale kafka=3```.
Check the deployment by running `docker-compose ps`. You can start and stop containers using `docker-compose start` and `docker-compose stop` commands.
If using the multi-broker docker-compose file, you can change the scaling by running `docker-compose scale <container>=n` where container is the container you would like to scale and n is the number of instances. For example, `docker-compose scale kafka=3`.

#### Running ODE Application on localhost
You can run the application on your local machine while other services are deployed on a host environment. To do so, run the following:
Expand All @@ -233,8 +255,8 @@ You can run the application on your local machine while other services are deplo

<a name="running"/>

## V. Running ODE Application
Once the ODE is running, you should be able to access the jpo-ode web UI at `localhost:8080`.
## V. Using ODE Application
Once the ODE is deployed and running, you should be able to access the `jpo-ode` web UI at `localhost:8080`.

1. Press the `Connect` button to connect to the ODE WebSocket service.
2. Press `Choose File` button to select an OBU log file containing BSMs and/or TIM messages as specified by the WYDOT CV Pilot project. See below documents for details:
Expand Down

This file was deleted.

7 changes: 4 additions & 3 deletions update_branch.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,22 @@ IF "%1"=="" (
goto end
)

rem Backup user provided source or configuration files used by submodules
copy asn1_codec\asn1c_combined\J2735_201603DA.ASN .

rem Run the following commands to reset existing branch
git reset --hard
git submodule foreach --recursive git reset --hard

rem Pull from branch ode-769.
rem Pull from the desired branch
git checkout %1
git pull origin %1

rem The next command wipes out all of the submodules and re initializes them.
rem The next command wipes out all of the submodules and re-initializes them.
git submodule deinit -f .
git submodule update --recursive --init

rem Restore the J2735 ASN file
rem Restore user provided source or configuration files used by submodules
copy .\J2735_201603DA.ASN asn1_codec\asn1c_combined

:end
Expand Down
11 changes: 6 additions & 5 deletions update_branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,21 @@ if [ $# -eq 0 ]
exit -1
fi

# Backup user provided source or configuration files used by submodules
cp asn1_codec/asn1c_combined/J2735_201603DA.ASN .

#Run the following commands to reset existing branch
git reset --hard
git submodule foreach --recursive git reset --hard

# Pull from branch ode-769.
git checkout $1
git pull origin $1
# Pull from the desired branch
git checkout <branch name>
git pull origin <branch name>

# The next command wipes out all of the submodules and re initializes them.
# The next command wipes out all of the submodules and re-initializes them.
git submodule deinit -f . && git submodule update --recursive --init

# Restore the J2735 ASN file
# Restore user provided source or configuration files used by submodules
cp ./J2735_201603DA.ASN asn1_codec/asn1c_combined/


0 comments on commit 67478e8

Please sign in to comment.