Skip to content

Commit

Permalink
Merge pull request #25 from ATOR-Development/development
Browse files Browse the repository at this point in the history
Development to main
  • Loading branch information
yumirkov authored Sep 3, 2024
2 parents c100da3 + 38d63c1 commit a75a8c7
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 76 deletions.
12 changes: 2 additions & 10 deletions .github/actions/build-and-push/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ runs:
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ inputs.docker-username }}
password: ${{ inputs.docker-password }}

Expand All @@ -22,13 +23,4 @@ runs:
context: .
file: ./docker/scanner/Dockerfile
push: true
tags: ${{ inputs.docker-username }}/sbws-scanner:${{ github.sha }},${{ inputs.docker-username }}/sbws-scanner:${{ inputs.docker-tag }}

- name: Build and push Docker image of destination
uses: docker/build-push-action@v2
with:
context: ./docker/destination
file: ./docker/destination/Dockerfile
push: true
tags: ${{ inputs.docker-username }}/sbws-destination:${{ github.sha }},${{ inputs.docker-username }}/sbws-destination:${{ inputs.docker-tag }}

tags: ghcr.io/ator-development/sbws-scanner:${{ inputs.docker-tag }}
1 change: 1 addition & 0 deletions .github/actions/deploy/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ runs:
NOMAD_TOKEN: ${{ inputs.nomad-token }}
NOMAD_ADDR: ${{ inputs.nomad-addr }}
run: |
sed -i 's/DEPLOY_TAG/${{ inputs.docker-tag }}/g' operations/deploy-${{ inputs.environment }}.hcl
curl -L https://releases.hashicorp.com/nomad/1.6.3/nomad_1.6.3_linux_amd64.zip -o nomad.zip
unzip nomad.zip
./nomad job run operations/deploy-${{ inputs.environment }}.hcl
7 changes: 4 additions & 3 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ jobs:
- name: Build and push
uses: ./.github/actions/build-and-push
with:
docker-username: ${{ secrets.DOCKER_HUB_USERNAME }}
docker-password: ${{ secrets.DOCKER_HUB_PASSWORD }}
docker-tag: latest-dev
docker-username: ${{ github.actor }}
docker-password: ${{ secrets.GITHUB_TOKEN }}
docker-tag: ${{ github.sha }}
- name: Deploy
uses: ./.github/actions/deploy
with:
environment: dev
nomad-cacert: operations/admin-ui-ca.crt
nomad-token: ${{ secrets.NOMAD_TOKEN_SBWS_DEPLOY }}
nomad-addr: ${{ secrets.NOMAD_DEPLOY_ADDR }}
docker-tag: ${{ github.sha }}
20 changes: 6 additions & 14 deletions .github/workflows/live.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,17 @@ jobs:
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Github Container Registry
uses: docker/login-action@v3
- name: Build and push
uses: ./.github/actions/build-and-push
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Tag latest
run: |
docker pull ${{ secrets.DOCKER_HUB_USERNAME }}/sbws-scanner:latest-stage
docker tag ${{ secrets.DOCKER_HUB_USERNAME }}/sbws-scanner:latest-stage ${{ secrets.DOCKER_HUB_USERNAME }}/sbws-scanner:latest
docker push ${{ secrets.DOCKER_HUB_USERNAME }}/sbws-scanner:latest
docker pull ${{ secrets.DOCKER_HUB_USERNAME }}/sbws-destination:latest-stage
docker tag ${{ secrets.DOCKER_HUB_USERNAME }}/sbws-destination:latest-stage ${{ secrets.DOCKER_HUB_USERNAME }}/sbws-destination:latest
docker push ${{ secrets.DOCKER_HUB_USERNAME }}/sbws-destination:latest
docker-username: ${{ github.actor }}
docker-password: ${{ secrets.GITHUB_TOKEN }}
docker-tag: ${{ github.sha }}
- name: Deploy
uses: ./.github/actions/deploy
with:
environment: live
nomad-cacert: operations/admin-ui-ca.crt
nomad-token: ${{ secrets.NOMAD_TOKEN_SBWS_DEPLOY }}
nomad-addr: ${{ secrets.NOMAD_DEPLOY_ADDR }}
docker-tag: ${{ github.sha }}
7 changes: 4 additions & 3 deletions .github/workflows/stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ jobs:
- name: Build and push
uses: ./.github/actions/build-and-push
with:
docker-username: ${{ secrets.DOCKER_HUB_USERNAME }}
docker-password: ${{ secrets.DOCKER_HUB_PASSWORD }}
docker-tag: latest-stage
docker-username: ${{ github.actor }}
docker-password: ${{ secrets.GITHUB_TOKEN }}
docker-tag: ${{ github.sha }}
- name: Deploy
uses: ./.github/actions/deploy
with:
environment: stage
nomad-cacert: operations/admin-ui-ca.crt
nomad-token: ${{ secrets.NOMAD_TOKEN_SBWS_DEPLOY }}
nomad-addr: ${{ secrets.NOMAD_DEPLOY_ADDR }}
docker-tag: ${{ github.sha }}
7 changes: 0 additions & 7 deletions docker/destination/Dockerfile

This file was deleted.

16 changes: 0 additions & 16 deletions docker/destination/default.conf

This file was deleted.

5 changes: 0 additions & 5 deletions docker/destination/docker-entrypoint.sh

This file was deleted.

10 changes: 0 additions & 10 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,6 @@ services:
networks:
local:
ipv4_address: 172.18.0.3
sbws-destination:
image: sbws-destination
restart: always
ports:
- "8888:80"
volumes:
- ./destination/default.conf:/etc/nginx/conf.d/default.conf
networks:
local:
ipv4_address: 172.18.0.4

networks:
local:
Expand Down
8 changes: 4 additions & 4 deletions operations/deploy-dev.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ job "sbws-dev" {
}

port "orport" {
static = 9091
static = 9019
}
}

Expand All @@ -73,8 +73,8 @@ job "sbws-dev" {
}

resources {
cpu = 2048
memory = 2560
cpu = 512
memory = 1024
}

template {
Expand Down Expand Up @@ -128,7 +128,7 @@ ORPort {{ env `NOMAD_PORT_orport` }}
}

config {
image = "svforte/sbws-scanner:latest-dev"
image = "ghcr.io/ator-development/sbws-scanner:DEPLOY_TAG"
force_pull = true
volumes = [
"local/.sbws.ini:/root/.sbws.ini:ro"
Expand Down
2 changes: 1 addition & 1 deletion operations/deploy-live.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ ORPort {{ env `NOMAD_PORT_orport` }}
}

config {
image = "svforte/sbws-scanner:latest"
image = "ghcr.io/ator-development/sbws-scanner:DEPLOY_TAG"
force_pull = true
volumes = [
"local/.sbws.ini:/root/.sbws.ini:ro"
Expand Down
6 changes: 3 additions & 3 deletions operations/deploy-stage.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ ORPort {{ env `NOMAD_PORT_orport` }}
}

config {
image = "svforte/sbws-scanner:latest-stage"
image = "ghcr.io/ator-development/sbws-scanner:DEPLOY_TAG"
force_pull = true
volumes = [
"local/.sbws.ini:/root/.sbws.ini:ro"
Expand Down Expand Up @@ -349,7 +349,7 @@ ORPort {{ env `NOMAD_PORT_orport` }}
}

config {
image = "svforte/sbws-scanner:latest-stage"
image = "ghcr.io/ator-development/sbws-scanner:DEPLOY_TAG"
force_pull = true
volumes = [
"local/.sbws.ini:/root/.sbws.ini:ro"
Expand Down Expand Up @@ -576,7 +576,7 @@ ORPort {{ env `NOMAD_PORT_orport` }}
}

config {
image = "svforte/sbws-scanner:latest-stage"
image = "ghcr.io/ator-development/sbws-scanner:DEPLOY_TAG"
force_pull = true
volumes = [
"local/.sbws.ini:/root/.sbws.ini:ro"
Expand Down

0 comments on commit a75a8c7

Please sign in to comment.