-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:l3vels/L3AGI
- Loading branch information
Showing
56 changed files
with
601 additions
and
880 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,14 +5,12 @@ on: | |
branches: | ||
- main | ||
paths: | ||
- 'apps/server/**' | ||
|
||
- "apps/server/**" | ||
|
||
env: | ||
ACR_REPOSITORY: "l3-api" | ||
TR_DIRECTORY: "apps/server/terraform" | ||
|
||
|
||
jobs: | ||
Build: | ||
name: Build Application Container | ||
|
@@ -24,17 +22,17 @@ jobs: | |
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: 'Build and push image' | ||
|
||
- name: "Build and push image" | ||
uses: azure/docker-login@v1 | ||
with: | ||
login-server: ${{ vars.ACR_REGISTRY }} | ||
username: ${{ secrets.AZURE_USERNAME }} | ||
password: ${{ secrets.AZURE_PASSWORD }} | ||
- run: | | ||
docker build -t ${{ vars.ACR_REGISTRY }}/${{ env.ACR_REPOSITORY }}:${{ github.sha }} -f apps/server/docker/Dockerfile apps/server | ||
docker push ${{ vars.ACR_REGISTRY }}/${{ env.ACR_REPOSITORY }}:${{ github.sha }} | ||
echo "TAG_NAME=${{ github.sha }}" >> $GITHUB_ENV | ||
docker build -t ${{ vars.ACR_REGISTRY }}/${{ env.ACR_REPOSITORY }}:${{ github.sha }} -f apps/server/docker/Dockerfile apps/server | ||
docker push ${{ vars.ACR_REGISTRY }}/${{ env.ACR_REPOSITORY }}:${{ github.sha }} | ||
echo "TAG_NAME=${{ github.sha }}" >> $GITHUB_ENV | ||
Init_dev: | ||
runs-on: ubuntu-latest | ||
|
@@ -44,15 +42,15 @@ jobs: | |
ENVIRONMENT: dev | ||
defaults: | ||
run: | ||
shell: bash | ||
shell: bash | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
||
- name: Change file name | ||
run: | | ||
mv ${{ github.workspace }}/${{ env.TR_DIRECTORY }}/varfiles/${{ env.ENVIRONMENT }}.tfvars ${{ github.workspace }}/${{ env.TR_DIRECTORY }}/${{ env.ENVIRONMENT }}.auto.tfvars | ||
run: | | ||
mv ${{ github.workspace }}/${{ env.TR_DIRECTORY }}/varfiles/${{ env.ENVIRONMENT }}.tfvars ${{ github.workspace }}/${{ env.TR_DIRECTORY }}/${{ env.ENVIRONMENT }}.auto.tfvars | ||
- name: Update task_container_version | ||
run: | | ||
TFVARS="${{ github.workspace }}/${{ env.TR_DIRECTORY }}/${{ env.ENVIRONMENT }}.auto.tfvars" | ||
|
@@ -93,11 +91,12 @@ jobs: | |
echo -e "AWS_SECRET_ACCESS_KEY = \"${{ secrets.AWS_SECRET_ACCESS_KEY }}\"\n" >> $TFVARS | ||
echo -e "AWS_REGION = \"${{ vars.AWS_REGION }}\"\n" >> $TFVARS | ||
echo -e "AWS_S3_BUCKET = \"${{ vars.AWS_S3_BUCKET }}\"\n" >> $TFVARS | ||
echo -e "AUTH_TOKEN = \"${{ secrets.AUTH_TOKEN }}\"\n" >> $TFVARS | ||
- name: Display .auto.tfvars file content | ||
run: | | ||
cat ${{ github.workspace }}/${{ env.TR_DIRECTORY }}/${{ env.ENVIRONMENT }}.auto.tfvars | ||
- name: Upload file | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
|
@@ -114,8 +113,8 @@ jobs: | |
tf_vars_file: varfiles/dev.tfvars | ||
gh_environment: dev | ||
task_container_name: "l3-api" | ||
task_container_version: #${{ github.sha }} temp | ||
# task_container_version: "1fe3d215f1ac2e6be5d43b4e1522b9dc43aefd36" | ||
task_container_version: #${{ github.sha }} temp | ||
# task_container_version: "1fe3d215f1ac2e6be5d43b4e1522b9dc43aefd36" | ||
task_container_registry: ${{ vars.ACR_REGISTRY }} | ||
secrets: | ||
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }} | ||
|
@@ -156,15 +155,15 @@ jobs: | |
ENVIRONMENT: prod | ||
defaults: | ||
run: | ||
shell: bash | ||
shell: bash | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
||
- name: Change file name | ||
run: | | ||
mv ${{ github.workspace }}/${{ env.TR_DIRECTORY }}/varfiles/${{ env.ENVIRONMENT }}.tfvars ${{ github.workspace }}/${{ env.TR_DIRECTORY }}/${{ env.ENVIRONMENT }}.auto.tfvars | ||
run: | | ||
mv ${{ github.workspace }}/${{ env.TR_DIRECTORY }}/varfiles/${{ env.ENVIRONMENT }}.tfvars ${{ github.workspace }}/${{ env.TR_DIRECTORY }}/${{ env.ENVIRONMENT }}.auto.tfvars | ||
- name: Update task_container_version | ||
run: | | ||
TFVARS="${{ github.workspace }}/${{ env.TR_DIRECTORY }}/${{ env.ENVIRONMENT }}.auto.tfvars" | ||
|
@@ -205,17 +204,17 @@ jobs: | |
echo -e "AWS_SECRET_ACCESS_KEY = \"${{ secrets.AWS_SECRET_ACCESS_KEY }}\"\n" >> $TFVARS | ||
echo -e "AWS_REGION = \"${{ vars.AWS_REGION }}\"\n" >> $TFVARS | ||
echo -e "AWS_S3_BUCKET = \"${{ vars.AWS_S3_BUCKET }}\"\n" >> $TFVARS | ||
echo -e "AUTH_TOKEN = \"${{ secrets.AUTH_TOKEN }}\"\n" >> $TFVARS | ||
- name: Display .auto.tfvars file content | ||
run: | | ||
cat ${{ github.workspace }}/${{ env.TR_DIRECTORY }}/${{ env.ENVIRONMENT }}.auto.tfvars | ||
- name: Upload file | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: my-artifact | ||
path: ${{ github.workspace }}/${{ env.TR_DIRECTORY }}/${{ env.ENVIRONMENT }}.auto.tfvars | ||
|
||
|
||
Plan_prod: | ||
needs: Init_Prod | ||
|
@@ -256,4 +255,4 @@ jobs: | |
azure_subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | ||
azure_client_id: ${{ secrets.AZURE_CLIENT_ID }} | ||
azure_client_secret: ${{ secrets.AZURE_CLIENT_SECRET }} | ||
github_personal_access_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
github_personal_access_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,54 @@ | ||
name: Deploy Worker | ||
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy | ||
# More GitHub Actions for Azure: https://github.com/Azure/actions | ||
|
||
name: Build and Deploy Worker | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
# paths: | ||
# - 'apps/worker/**' | ||
|
||
env: | ||
ACR_REPOSITORY_BEAT: "l3-beat" | ||
ACR_REPOSITORY_WORKER: "l3-worker" | ||
TR_DIRECTORY: "apps/server/terraform" | ||
paths: | ||
- "apps/worker/**" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
Build_worker: | ||
name: Build Application Container | ||
timeout-minutes: 15 | ||
runs-on: ubuntu-latest | ||
outputs: | ||
tag_name: ${{ steps.build-image.outputs.TAG_NAME }} | ||
environment: dev | ||
build: | ||
runs-on: "ubuntu-latest" | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Log in to registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: https://l3container.azurecr.io/ | ||
username: ${{ secrets.AzureAppService_ContainerUsername_313e76d8b0ba4933b1934140d1c24667 }} | ||
password: ${{ secrets.AzureAppService_ContainerPassword_a84f243ca243499bad593759e14ed4c3 }} | ||
|
||
- name: Build and push container image to registry | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: ./apps/worker | ||
push: true | ||
tags: l3container.azurecr.io/${{ secrets.AzureAppService_ContainerUsername_313e76d8b0ba4933b1934140d1c24667 }}/l3-worker:${{ github.sha }} | ||
file: ./apps/worker/docker/Dockerfile | ||
|
||
- name: "Build and push image" | ||
uses: azure/docker-login@v1 | ||
deploy: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
environment: | ||
name: "production" | ||
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} | ||
|
||
steps: | ||
- name: Deploy to Azure Web App | ||
id: deploy-to-webapp | ||
uses: azure/webapps-deploy@v2 | ||
with: | ||
login-server: ${{ vars.ACR_REGISTRY }} | ||
username: ${{ secrets.AZURE_USERNAME }} | ||
password: ${{ secrets.AZURE_PASSWORD }} | ||
- run: | | ||
docker build -t ${{ vars.ACR_REGISTRY }}/${{ env.ACR_REPOSITORY_WORKER }}:latest -f apps/worker/docker/Dockerfile apps/worker | ||
docker push ${{ vars.ACR_REGISTRY }}/${{ env.ACR_REPOSITORY_WORKER }}:latest | ||
echo "TAG_NAME=${{ github.sha }}" >> $GITHUB_ENV | ||
app-name: "l3-worker" | ||
slot-name: "production" | ||
publish-profile: ${{ secrets.AzureAppService_PublishProfile_70ddda41e65f407eb7f85b1bef8d8fc7 }} | ||
images: "l3container.azurecr.io/${{ secrets.AzureAppService_ContainerUsername_313e76d8b0ba4933b1934140d1c24667 }}/l3-worker:${{ github.sha }}" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.