Skip to content

Commit

Permalink
modified: configuration/arm64/docker-compose.yml (#585)
Browse files Browse the repository at this point in the history
modified:   configuration/arm64/initialization.sh
	modified:   configuration/arm64/mysql/add_v2xhub_user.bash

<!-- Thanks for the contribution, this is awesome. -->

# PR Details
## Description

Updated arm64 configuration files to fix initial setup, which was no
longer working.

Updated: 
mariabd-client version
docker compose version
docker-compose.yml 

## Related Issue

<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an
issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps
to reproduce -->
#594 
## Motivation and Context

<!--- Why is this change required? What problem does it solve? -->
The initialization.sh and add_v2xhub_user.bash scripts were no longer
working in arm64 configuration

## How Has This Been Tested?

<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
Tested on latest Raspberry Pi OS on a Pi 4. Initialization and user
addition worked.

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->

- [x] Defect fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that cause existing functionality
to change)

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [ ] I have added any new packages to the sonar-scanner.properties file
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [x] I have read the **CONTRIBUTING** document.
[V2XHUB Contributing
Guide](https://github.com/usdot-fhwa-OPS/V2X-Hub/blob/develop/Contributing.md)
- [ ] I have added tests to cover my changes.
- [x] All new and existing tests passed.
  • Loading branch information
jwillmartin authored May 1, 2024
1 parent 9a21060 commit 326bac2
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 53 deletions.
3 changes: 2 additions & 1 deletion configuration/amd64/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ services:
image: usdotfhwaops/php:${V2XHUB_VERSION:-develop}
container_name: php
network_mode: host
depends_on:
restart: always
depends_on:
- db
- v2xhub
stdin_open: true
Expand Down
50 changes: 26 additions & 24 deletions configuration/amd64/initialization.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,24 @@
directory=$(pwd)
mysqlDir="$directory/mysql"

# update and upgrade commands to update linux OS
# Update and upgrade commands to update linux OS
sudo apt update -y && sudo apt upgrade -y

#installing necessary and useful apps
sudo apt-get install chromium-browser -y #Chrome required for CARMA platform/V2X Hub UI(?)
sudo apt install curl -y #Curl for downloading files over internet
# Install necessary and useful apps
sudo apt-get install chromium-browser -y

#install docker
curl -L https://raw.githubusercontent.com/usdot-fhwa-stol/carma-platform/develop/engineering_tools/install-docker.sh | bash

#make passwords for mysql
# Make passwords for mysql
mkdir -p secrets && cd secrets

#creates password files where user inputs password
# Creates password files where user inputs password
FILE1=mysql_root_password.txt
FILE2=mysql_password.txt
if test -f "$FILE1"; then
echo "$FILE1 exists."
else
read -p "enter password for the mysql_root_password: " sql_root_pass
echo "$sql_root_pass" > sql_root_pass.txt
#remove endline characters from password files
# Remove endline characters from password files
tr -d '\n' <sql_root_pass.txt> mysql_root_password.txt && rm sql_root_pass.txt
fi

Expand All @@ -32,25 +28,31 @@ if test -f "$FILE2"; then
else
read -p "enter password for mysql_password: " sql_pass
echo "$sql_pass" > sql_pass.txt
#remove endline characters from password files
# Remove endline characters from password files
tr -d '\n' <sql_pass.txt> mysql_password.txt && rm sql_pass.txt
fi
# TODO VH-1303 Allow for version and configuration selection in initialization script

#AMD64 initialzation
# AMD64 initialization
cd $directory
sudo apt-get -y remove docker docker-engine docker.io containerd runc
sudo apt-get -y install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get -y install docker-ce docker-ce-cli containerd.io
sudo apt -y install python3-pip
sudo pip3 install docker-compose
sudo docker-compose pull
sudo apt update -y && sudo apt upgrade -y
sudo docker-compose up -d

#create v2xhub user
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/$(. /etc/os-release && echo "$ID")/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/$(. /etc/os-release && echo "$ID") \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo docker compose up -d

# Create V2X Hub user
cd $mysqlDir
./add_v2xhub_user.bash

Expand Down
7 changes: 5 additions & 2 deletions configuration/arm64/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ services:
image: usdotfhwaops/php_arm:${V2XHUB_VERSION:-develop}
container_name: php
network_mode: host
depends_on:
restart: always
depends_on:
- db
- v2xhub
stdin_open: true
Expand All @@ -34,10 +35,12 @@ services:
container_name: v2xhub
network_mode: host
restart: always
depends_on:
depends_on:
- db
environment:
- MYSQL_PASSWORD=/run/secrets/mysql_password
- INFRASTRUCTURE_ID=rsu_<J2735 MAP MESSAGE INTERSECTION ID>
- INFRASTRUCTURE_NAME=<RSU_NAME>
secrets:
- mysql_password
volumes:
Expand Down
51 changes: 26 additions & 25 deletions configuration/arm64/initialization.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,24 @@
directory=$(pwd)
mysqlDir="$directory/mysql"

# update and upgrade commands to update linux OS
# Update and upgrade commands to update linux OS
sudo apt update -y && sudo apt upgrade -y

#installing necessary and useful apps
sudo apt-get install chromium-browser -y #Chrome required for CARMA platform/V2X Hub UI(?)
sudo apt install curl -y #Curl for downloading files over internet
# Install necessary and useful apps
sudo apt-get install chromium-browser -y

#install docker
curl -L https://raw.githubusercontent.com/usdot-fhwa-stol/carma-platform/develop/engineering_tools/install-docker.sh | bash

#make passwords for mysql
# Make passwords for mysql
mkdir -p secrets && cd secrets

#creates password files where user inputs password
# Creates password files where user inputs password
FILE1=mysql_root_password.txt
FILE2=mysql_password.txt
if test -f "$FILE1"; then
echo "$FILE1 exists."
else
read -p "enter password for the mysql_root_password: " sql_root_pass
echo "$sql_root_pass" > sql_root_pass.txt
#remove endline characters from password files
# Remove endline characters from password files
tr -d '\n' <sql_root_pass.txt> mysql_root_password.txt && rm sql_root_pass.txt
fi

Expand All @@ -32,26 +28,31 @@ if test -f "$FILE2"; then
else
read -p "enter password for mysql_password: " sql_pass
echo "$sql_pass" > sql_pass.txt
#remove endline characters from password files
# Remove endline characters from password files
tr -d '\n' <sql_pass.txt> mysql_password.txt && rm sql_pass.txt
fi
# TODO VH-1303 Allow for version and configuration selection in initialization script

#ARM initialization
# ARM64 initialization
cd $directory
sudo apt-get -y remove docker docker-engine docker.io containerd runc
sudo apt-get -y install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
OS=$(lsb_release -i | awk 'FS=":" {print $3;}' | awk '{print tolower($0)}')
arch=$(dpkg --print-architecture)
curl -fsSL https://download.docker.com/linux/$OS/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=$arch] https://download.docker.com/linux/$OS $(lsb_release -cs) stable"
sudo apt-get -y install docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo apt -y install python3-pip
sudo pip3 install docker-compose
sudo apt update -y && sudo apt upgrade -y
sudo docker-compose up -d

#create v2xhub user
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/$(. /etc/os-release && echo "$ID")/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/$(. /etc/os-release && echo "$ID") \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo docker compose up -d

# Create V2X Hub user
cd $mysqlDir
./add_v2xhub_user.bash

Expand Down
2 changes: 1 addition & 1 deletion configuration/arm64/mysql/add_v2xhub_user.bash
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ arch=$(dpkg --print-architecture)
if [ $arch = "amd64" ]; then
REQUIRED_PKG="mysql-client"
else
REQUIRED_PKG="mariadb-client-10.5"
REQUIRED_PKG="mariadb-client"
fi
PKG_OK=$(dpkg-query -W --showformat='${Status}\n' $REQUIRED_PKG|grep "install ok installed")
echo Checking for $REQUIRED_PKG: $PKG_OK
Expand Down

0 comments on commit 326bac2

Please sign in to comment.