From d9c29dfb2bc713ef5cd1d2717e39f1e9338448f4 Mon Sep 17 00:00:00 2001 From: jwillmartin Date: Wed, 20 Mar 2024 16:19:53 -0400 Subject: [PATCH 1/4] modified: configuration/arm64/docker-compose.yml modified: configuration/arm64/initialization.sh modified: configuration/arm64/mysql/add_v2xhub_user.bash --- configuration/arm64/docker-compose.yml | 17 ++++++++--------- configuration/arm64/initialization.sh | 7 +------ configuration/arm64/mysql/add_v2xhub_user.bash | 2 +- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/configuration/arm64/docker-compose.yml b/configuration/arm64/docker-compose.yml index a32c31fab..47250f44e 100644 --- a/configuration/arm64/docker-compose.yml +++ b/configuration/arm64/docker-compose.yml @@ -1,5 +1,3 @@ -version: '3.7' - services: db: image: mariadb:10.4 @@ -16,14 +14,15 @@ services: - mysql_root_password volumes: - ./mysql/localhost.sql:/docker-entrypoint-initdb.d/localhost.sql - - ./mysql/port_drayage.sql:/docker-entrypoint-initdb.d/port_drayage.sql + # - ./mysql/port_drayage.sql:/docker-entrypoint-initdb.d/port_drayage.sql - mysql-datavolume:/var/lib/mysql php: image: usdotfhwaops/php_arm:latest container_name: php network_mode: host - depends_on: + restart: always + depends_on: - db - v2xhub stdin_open: true @@ -34,7 +33,7 @@ services: container_name: v2xhub network_mode: host restart: always - depends_on: + depends_on: - db environment: - MYSQL_PASSWORD=/run/secrets/mysql_password @@ -43,10 +42,10 @@ services: volumes: - ./logs:/var/log/tmx - ./MAP:/var/www/plugins/MAP - port_drayage_webservice: - image: usdotfhwaops/port-drayage-webservice_arm:latest - container_name: port_drayage_webservice - network_mode: host + # port_drayage_webservice: + # image: usdotfhwaops/port-drayage-webservice_arm:latest + # container_name: port_drayage_webservice + # network_mode: host secrets: mysql_password: file: ./secrets/mysql_password.txt diff --git a/configuration/arm64/initialization.sh b/configuration/arm64/initialization.sh index 7769004df..4372b82f4 100755 --- a/configuration/arm64/initialization.sh +++ b/configuration/arm64/initialization.sh @@ -9,9 +9,6 @@ sudo apt update -y && sudo apt upgrade -y 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 docker -curl -L https://raw.githubusercontent.com/usdot-fhwa-stol/carma-platform/develop/engineering_tools/install-docker.sh | bash - #make passwords for mysql mkdir -p secrets && cd secrets @@ -45,10 +42,8 @@ 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 +sudo docker compose up -d #create v2xhub user cd $mysqlDir diff --git a/configuration/arm64/mysql/add_v2xhub_user.bash b/configuration/arm64/mysql/add_v2xhub_user.bash index 1d8bb57c2..5b4b6f314 100755 --- a/configuration/arm64/mysql/add_v2xhub_user.bash +++ b/configuration/arm64/mysql/add_v2xhub_user.bash @@ -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 From 12d665aebddcc12b1239338f75e840ee6988c549 Mon Sep 17 00:00:00 2001 From: jwillmartin Date: Mon, 25 Mar 2024 17:08:49 -0400 Subject: [PATCH 2/4] modified: configuration/arm64/docker-compose.yml modified: configuration/arm64/initialization.sh --- configuration/arm64/docker-compose.yml | 4 ++++ configuration/arm64/initialization.sh | 22 ++++++++++++++-------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/configuration/arm64/docker-compose.yml b/configuration/arm64/docker-compose.yml index 47250f44e..47700e7c3 100644 --- a/configuration/arm64/docker-compose.yml +++ b/configuration/arm64/docker-compose.yml @@ -1,3 +1,5 @@ +version: '3.4' + services: db: image: mariadb:10.4 @@ -14,6 +16,7 @@ services: - mysql_root_password volumes: - ./mysql/localhost.sql:/docker-entrypoint-initdb.d/localhost.sql + ## uncomment line to enable port drayage database # - ./mysql/port_drayage.sql:/docker-entrypoint-initdb.d/port_drayage.sql - mysql-datavolume:/var/lib/mysql @@ -42,6 +45,7 @@ services: volumes: - ./logs:/var/log/tmx - ./MAP:/var/www/plugins/MAP + ## uncomment section to enable port drayage service # port_drayage_webservice: # image: usdotfhwaops/port-drayage-webservice_arm:latest # container_name: port_drayage_webservice diff --git a/configuration/arm64/initialization.sh b/configuration/arm64/initialization.sh index 4372b82f4..6b0bfe1aa 100755 --- a/configuration/arm64/initialization.sh +++ b/configuration/arm64/initialization.sh @@ -35,14 +35,20 @@ fi #ARM 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 update -y && sudo apt upgrade -y +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 -y install ca-certificates +sudo install -m 0755 -d /etc/apt/keyrings +sudo curl -fsSL https://download.docker.com/linux/debian/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/debian \ + $(. /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 v2xhub user From a30e860f436a9c95a5297bd28e98e88c346f87e2 Mon Sep 17 00:00:00 2001 From: Will Martin Date: Mon, 25 Mar 2024 17:13:15 -0400 Subject: [PATCH 3/4] Update docker-compose.yml --- configuration/arm64/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configuration/arm64/docker-compose.yml b/configuration/arm64/docker-compose.yml index 47700e7c3..0c585920b 100644 --- a/configuration/arm64/docker-compose.yml +++ b/configuration/arm64/docker-compose.yml @@ -1,4 +1,4 @@ -version: '3.4' +version: '3.7' services: db: From e10ea5087ee9b4acf60874f5118768c21a19ca28 Mon Sep 17 00:00:00 2001 From: jwillmartin Date: Thu, 4 Apr 2024 12:13:13 -0400 Subject: [PATCH 4/4] modified: configuration/amd64/docker-compose.yml modified: configuration/amd64/initialization.sh modified: configuration/arm64/docker-compose.yml modified: configuration/arm64/initialization.sh --- configuration/amd64/docker-compose.yml | 3 +- configuration/amd64/initialization.sh | 50 +++++++++++++------------- configuration/arm64/docker-compose.yml | 2 ++ configuration/arm64/initialization.sh | 26 +++++++------- 4 files changed, 43 insertions(+), 38 deletions(-) diff --git a/configuration/amd64/docker-compose.yml b/configuration/amd64/docker-compose.yml index 6d682d25f..b0f1183b6 100755 --- a/configuration/amd64/docker-compose.yml +++ b/configuration/amd64/docker-compose.yml @@ -23,7 +23,8 @@ services: image: usdotfhwaops/php:develop container_name: php network_mode: host - depends_on: + restart: always + depends_on: - db - v2xhub stdin_open: true diff --git a/configuration/amd64/initialization.sh b/configuration/amd64/initialization.sh index eea35fc48..e8cbe9ecb 100755 --- a/configuration/amd64/initialization.sh +++ b/configuration/amd64/initialization.sh @@ -2,20 +2,16 @@ 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 @@ -23,7 +19,7 @@ if test -f "$FILE1"; then 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' mysql_root_password.txt && rm sql_root_pass.txt fi @@ -32,24 +28,30 @@ 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' mysql_password.txt && rm sql_pass.txt fi -#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 diff --git a/configuration/arm64/docker-compose.yml b/configuration/arm64/docker-compose.yml index d004e0115..615411201 100644 --- a/configuration/arm64/docker-compose.yml +++ b/configuration/arm64/docker-compose.yml @@ -39,6 +39,8 @@ services: - db environment: - MYSQL_PASSWORD=/run/secrets/mysql_password + - INFRASTRUCTURE_ID=rsu_ + - INFRASTRUCTURE_NAME= secrets: - mysql_password volumes: diff --git a/configuration/arm64/initialization.sh b/configuration/arm64/initialization.sh index 6b0bfe1aa..3c07148c7 100755 --- a/configuration/arm64/initialization.sh +++ b/configuration/arm64/initialization.sh @@ -2,17 +2,16 @@ 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 -#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 @@ -20,7 +19,7 @@ if test -f "$FILE1"; then 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' mysql_root_password.txt && rm sql_root_pass.txt fi @@ -29,29 +28,30 @@ 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' mysql_password.txt && rm sql_pass.txt fi -#ARM initialization +# ARM64 initialization cd $directory 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 -y install ca-certificates +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/debian/gpg -o /etc/apt/keyrings/docker.asc +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/debian \ + "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 v2xhub user +# Create V2X Hub user cd $mysqlDir ./add_v2xhub_user.bash