Skip to content

Commit

Permalink
Merge pull request #10 from azure-javaee/edburns-msft-em-5413-cargotr…
Browse files Browse the repository at this point in the history
…acker-liberty-aks-ee-10

On branch edburns-msft-em-5413-cargotracker-liberty-aks-ee-10
  • Loading branch information
edburns authored Aug 8, 2024
2 parents 797e23d + 267fc99 commit ca4d0a4
Show file tree
Hide file tree
Showing 155 changed files with 3,684 additions and 2,895 deletions.
Empty file modified .github/workflows/setup.sh
100644 → 100755
Empty file.
91 changes: 58 additions & 33 deletions .github/workflows/setupOpenLibertyAks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
region:
description: "Azure region for resources"
required: true
default: eastus
default: westus
deleteResource:
description: "True to delete all the Azure resources after the deployments. False to keep Azure resources."
default: "true"
Expand All @@ -22,17 +22,18 @@ env:
refArmttk: c11a62d4ae011ee96fdecc76d76d811c5b5a99ce
refJavaee: 931ce903b85a4bf1fc79c763a92ac3666f10a1e0
appInsightsName: appinsights${{ github.run_id }}${{ github.run_number }}
azCliVersion: 2.40.0
azCliVersion: 2.60.0
azureCredentials: ${{ secrets.AZURE_CREDENTIALS }}
dbName: libertydb${{ github.run_id }}${{ github.run_number }}
dbAdminUser: liberty
dbPassword: ${{ secrets.DB_PASSWORD }}
dbServerName: libertydbs
logAnalyticsName: loga${{ github.run_id }}${{ github.run_number }}
namespace: default
replicas: 3
resourceGroupForDB: liberty-db-${{ github.run_id }}-${{ github.run_number }}
aksRepoUserName: WASdev
aksRepoBranchName: 5c3f60fffdfd1219036bac2e50c51a53a97f21e3
aksRepoBranchName: 048e776e9efe2ffed8368812e198c1007ba94b2c

jobs:
# Make it so the bicep file that causes Liberty on AKS to be deployed is available to this workflow.
Expand Down Expand Up @@ -67,17 +68,10 @@ jobs:
echo "disambiguationSuffix=${disambiguationSuffix}" >> $GITHUB_OUTPUT
- name: Set up bicep
run: |
curl -Lo bicep https://github.com/Azure/bicep/releases/download/v0.11.1/bicep-linux-x64
curl -Lo bicep https://github.com/Azure/bicep/releases/download/v0.29.47/bicep-linux-x64
chmod +x ./bicep
sudo mv ./bicep /usr/local/bin/bicep
bicep --version
# This is a precondition necessary to generate the bicep file to deploy Liberty on AKS.
- name: Checkout azure-javaee-iaas
uses: actions/checkout@v2
with:
repository: Azure/azure-javaee-iaas
path: azure-javaee-iaas
ref: ${{ env.refJavaee }}
- name: Checkout arm-ttk
uses: actions/checkout@v2
with:
Expand All @@ -91,21 +85,24 @@ jobs:
repository: ${{ env.aksRepoUserName }}/azure.liberty.aks
path: azure.liberty.aks
ref: ${{ env.aksRepoBranchName }}
- name: Set up JDK 1.8
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build azure-javaee-iaas
run: mvn clean install --file azure-javaee-iaas/pom.xml
java-version: 17
server-username: PACKAGES_ACCESS_USERNAME
server-password: PACKAGES_ACCESS_TOKEN
# Generate the Liberty on AKS bicep template so it can be invoked later. The bicep template is enclosed in a zip file
- name: Build and test ${{ env.aksRepoUserName }}/azure.liberty.aks
env:
PACKAGES_ACCESS_USERNAME: github
PACKAGES_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd azure.liberty.aks
mvn -Pbicep -Ddev -Passembly -Ptemplate-validation-tests clean install
- name: Generate artifact file name and path
id: artifact_file
run: |
version=$(awk '/<version>[^<]+<\/version>/{gsub(/<version>|<\/version>/,"",$1);print $1;exit;}' azure.liberty.aks/pom.xml)
version=$(mvn -q -Dexec.executable=echo -Dexec.args='${version.azure.liberty.aks}' --file azure.liberty.aks/pom.xml --non-recursive exec:exec)
artifactName=azure.liberty.aks-$version-arm-assembly
unzip azure.liberty.aks/target/$artifactName.zip -d azure.liberty.aks/target/$artifactName
echo "artifactName=${artifactName}" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -143,22 +140,40 @@ jobs:
azcliversion: ${{ env.azCliVersion }}
inlineScript: |
echo "Deploy DB with name " ${{ env.dbName }}
az postgres server create \
az postgres flexible-server create \
--resource-group ${{ env.resourceGroupForDB }} \
--name ${{ env.dbName }} \
--name ${{ env.dbName }} \
--location ${location} \
--admin-user ${{ env.dbAdminUser }} \
--ssl-enforcement Disabled \
--public-network-access Enabled \
--admin-password ${{ env.dbPassword }} \
--sku-name B_Gen5_1
--version 16 \
--public-access 0.0.0.0 \
--tier Burstable \
--sku-name Standard_B1ms \
--yes
az postgres flexible-server db create \
--resource-group ${{ env.resourceGroupForDB }} \
--server-name ${{ env.dbName }} \
--database-name ${{ env.dbServerName }}
sleep 1m
echo "Allow Access To Azure Services"
az postgres server firewall-rule create \
-g ${{ env.resourceGroupForDB }} \
-s ${{ env.dbName }} \
-n "AllowAllWindowsAzureIps" \
--start-ip-address "0.0.0.0" \
--end-ip-address "0.0.0.0"
az postgres flexible-server firewall-rule create \
-g ${{ env.resourceGroupForDB }} \
-n ${{ env.dbName }} \
-r "AllowAllWindowsAzureIps" \
--start-ip-address "0.0.0.0" \
--end-ip-address "0.0.0.0"
az postgres flexible-server parameter set \
--name max_prepared_transactions \
--value 10 \
-g ${{ env.resourceGroupForDB }} \
--server-name ${{ env.dbName }}
az postgres flexible-server restart \
-g ${{ env.resourceGroupForDB }} \
--name ${{ env.dbName }}
# Invoke the solution template, passing the necessary parameters to identify the configuration of AKS.
deploy-openliberty-on-aks:
needs: preflight
Expand All @@ -174,10 +189,19 @@ jobs:
repository: ${{ env.aksRepoUserName }}/azure.liberty.aks
path: azure.liberty.aks
ref: ${{ env.aksRepoBranchName }}
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
server-username: PACKAGES_ACCESS_USERNAME
server-password: PACKAGES_ACCESS_TOKEN
- name: Get version information from azure.liberty.aks/pom.xml
id: version
env:
PACKAGES_ACCESS_USERNAME: github
PACKAGES_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
version=$(awk '/<version>[^<]+<\/version>/{gsub(/<version>|<\/version>/,"",$1);print $1;exit;}' azure.liberty.aks/pom.xml)
version=$(mvn -q -Dexec.executable=echo -Dexec.args='${version.azure.liberty.aks}' --file azure.liberty.aks/pom.xml --non-recursive exec:exec)
echo "version=${version}" >> $GITHUB_ENV
- name: Output artifact name for Download action
id: artifact_file
Expand Down Expand Up @@ -301,10 +325,11 @@ jobs:
run: |
echo "location=${{ needs.preflight.outputs.location }}" >> $GITHUB_ENV
echo "resourceGroupForOpenLibertyAks=${{ needs.preflight.outputs.resourceGroupForOpenLibertyAks }}" >> $GITHUB_ENV
- name: Set up JDK 1.8
uses: actions/setup-java@v1
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 1.8
distribution: 'microsoft'
java-version: '17'
- name: Install jq
run: |
sudo apt-get install jq -y
Expand Down Expand Up @@ -357,8 +382,8 @@ jobs:
export PASSWORD=${{steps.prepare_variables.outputs.azureACRPassword}}
export DB_SERVER_NAME=${{ env.dbName }}.postgres.database.azure.com
export DB_PORT_NUMBER=5432
export DB_NAME=postgres
export DB_USER=${{ env.dbAdminUser }}@${{ env.dbName }}
export DB_NAME=${{env.dbServerName}}
export DB_USER=${{ env.dbAdminUser }}
export DB_PASSWORD=${{ env.dbPassword }}
export NAMESPACE=${{ env.namespace }}
export APPLICATIONINSIGHTS_CONNECTION_STRING=${{steps.prepare_variables.outputs.appInsightsConnectionString}}
Expand Down
Empty file modified .github/workflows/teardown.sh
100644 → 100755
Empty file.
16 changes: 9 additions & 7 deletions .scripts/setup-env-variables-template.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
export APPINSIGHTS_NAME="appinsights$(date +%s)"
export LIBERTY_AKS_REPO_REF="5c3f60fffdfd1219036bac2e50c51a53a97f21e3" # WASdev/azure.liberty.aks
export RESOURCE_GROUP_NAME="abc1110rg" # customize this
export DB_RESOURCE_NAME="libertydb1110" # PostgreSQL server name, customize this
export DB_SERVER_NAME="${DB_RESOURCE_NAME}.postgres.database.azure.com" # PostgreSQL host name
export RESOURCE_GROUP_NAME="abc1110rg" # customize this
export LOCATION=eastus # customize this, if desired

export APPINSIGHTS_NAME="appinsights$(date +%s)"
export DB_NAME=${DB_RESOURCE_NAME}
export DB_PASSWORD="Secret123456" # PostgreSQL database password
export DB_PORT_NUMBER=5432
export DB_NAME=postgres
export DB_USER=liberty@${DB_RESOURCE_NAME}
export DB_SERVER_NAME="${DB_RESOURCE_NAME}.postgres.database.azure.com" # PostgreSQL host name
export DB_USER=liberty${DB_RESOURCE_NAME}
export LIBERTY_AKS_REPO_REF="048e776e9efe2ffed8368812e198c1007ba94b2c" # WASdev/azure.liberty.aks
export NAMESPACE=default
export WORKSPACE_NAME="loga$(date +%s)"
export WORKSPACE_NAME="${RESOURCE_GROUP_NAME}ws"
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM payara/server-full
FROM payara/server-full:6.2023.12

COPY target/postgresql.jar /tmp
COPY target/cargo-tracker.war /tmp
COPY post-boot-commands.asadmin /opt/payara/config/
COPY post-boot-commands.asadmin /opt/payara/config/
Loading

0 comments on commit ca4d0a4

Please sign in to comment.