diff --git a/.gitea/workflows/deployProd.yml b/.gitea/workflows/deployProd.yml new file mode 100644 index 0000000..04b6bb4 --- /dev/null +++ b/.gitea/workflows/deployProd.yml @@ -0,0 +1,26 @@ +name: Deploy +run-name: ${{ gitea.actor }} build image and push to container registry + +on: + push: + branches: + - 'main' + +jobs: + CreateImage: + runs-on: [hubstaging] + uses: https://gitea.pena/PenaDevops/actions.git/.gitea/workflows/build-image.yml@v1.1.6-p + with: + runner: hubstaging + secrets: + REGISTRY_USER: ${{ secrets.REGISTRY_USER }} + REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} + DeployService: + runs-on: [frontprod] + needs: CreateImage + uses: https://gitea.pena/PenaDevops/actions.git/.gitea/workflows/deploy.yml@v1.1.4-p7 + with: + runner: hubprod + actionid: ${{ gitea.run_id }} + + diff --git a/.gitea/workflows/deployStaging.yml b/.gitea/workflows/deployStaging.yml new file mode 100644 index 0000000..3495235 --- /dev/null +++ b/.gitea/workflows/deployStaging.yml @@ -0,0 +1,26 @@ +name: Deploy +run-name: ${{ gitea.actor }} build image and push to container registry + +on: + push: + branches: + - 'staging' + +jobs: + CreateImage: + runs-on: [hubstaging] + uses: http://gitea.pena/PenaDevops/actions.git/.gitea/workflows/build-image.yml@v1.1.6-p + with: + runner: hubstaging + secrets: + REGISTRY_USER: ${{ secrets.REGISTRY_USER }} + REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} + DeployService: + runs-on: [frontstaging] + needs: CreateImage + uses: http://gitea.pena/PenaDevops/actions.git/.gitea/workflows/deploy.yml@v1.1.4-p7 + with: + runner: frontstaging + actionid: ${{ gitea.run_id }} + + diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml new file mode 100644 index 0000000..20e6298 --- /dev/null +++ b/.gitea/workflows/lint.yml @@ -0,0 +1,14 @@ +name: Lint +run-name: ${{ gitea.actor }} produce linting + +on: + push: + branches: + - 'dev' + +jobs: + Lint: + runs-on: [hubstaging] + uses: http://gitea.pena/PenaDevops/actions.git/.gitea/workflows/lint.yml@v1.1.0 + with: + runner: hubstaging diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index ffe8fae..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,51 +0,0 @@ -include: - - project: "devops/pena-continuous-integration" - file: "/templates/docker/build-template.gitlab-ci.yml" - - project: "devops/pena-continuous-integration" - file: "/templates/docker/clean-template.gitlab-ci.yml" - - project: "devops/pena-continuous-integration" - file: "/templates/docker/deploy-template.gitlab-ci.yml" -stages: - - clean - - build - - deploy -clear-old-images: - tags: - - frontbuild - extends: .clean_template - variables: - STAGING_BRANCH: "staging" - PRODUCTION_BRANCH: "main" - image: - name: docker/compose:1.28.0 - entrypoint: [""] - before_script: - - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY -build-app: - extends: .build_template - tags: - - frontbuild - before_script: - - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - variables: - DOCKER_BUILD_PATH: "./Dockerfile" - STAGING_BRANCH: "staging" - PRODUCTION_BRANCH: "main" - script: - - docker build -t $CI_REGISTRY_IMAGE/$CI_COMMIT_BRANCH:$CI_COMMIT_REF_SLUG.$CI_PIPELINE_ID --build-arg GITLAB_TOKEN=$GITLAB_TOKEN $CI_PROJECT_DIR - - docker push $CI_REGISTRY_IMAGE/$CI_COMMIT_BRANCH:$CI_COMMIT_REF_SLUG.$CI_PIPELINE_ID - -deploy-to-prod: - tags: - - prod - - front - extends: .deploy_template - variables: - PRODUCTION_BRANCH: main - before_script: - - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - rules: - - if: "$CI_COMMIT_BRANCH == $PRODUCTION_BRANCH" - script: - - docker login -u $REGISTRY_USER -p $REGISTRY_TOKEN $CI_REGISTRY - - docker-compose -f deployments/$CI_COMMIT_BRANCH/docker-compose.yaml up -d diff --git a/Dockerfile b/Dockerfile index f964ff7..8d680a3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM nginx:latest +FROM gitea.pena/penadevops/container-images/node:main as build COPY privkey.pem /etc/nginx/ COPY fullchain.pem /etc/nginx/ diff --git a/deployments/main/docker-compose.yaml b/deployments/main/docker-compose.yaml index 449a527..5cfd654 100644 --- a/deployments/main/docker-compose.yaml +++ b/deployments/main/docker-compose.yaml @@ -1,10 +1,9 @@ -version: "3" services: router: - image: $CI_REGISTRY_IMAGE/main:$CI_COMMIT_REF_SLUG.$CI_PIPELINE_ID + image: gitea.pena/penaside/nginx-proxy/main:$GITHUB_RUN_NUMBER ports: - - 10.6.0.28:80:80 - - 10.6.0.28:443:443 + - 92.38.153.141:80:80 + - 92.38.153.141:443:443 restart: always volumes: - ./nginx/certs/:/etc/nginx/certs/:ro