From 9ce96075bee6e55eb9a7bc6491c3be0d77c684f4 Mon Sep 17 00:00:00 2001 From: xplus2g4 <42161319+xplus2g4@users.noreply.github.com> Date: Fri, 31 Jul 2020 23:14:54 +0800 Subject: [PATCH 1/2] Create main.yml --- .github/workflows/main.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000000..701ffdcf4d --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,30 @@ +name: CI + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the master branch +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + - name: Push image to AppVenture registry + uses: docker/build-push-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + registry: registry.nush.app + repository: ctfd + tags: latest From 22462e0b288bc71f1e79c6f0971e6955ddbdfbcf Mon Sep 17 00:00:00 2001 From: xplus2g4 Date: Sun, 2 Aug 2020 08:55:17 +0800 Subject: [PATCH 2/2] Update docker configurations --- .github/workflows/lint.yml | 44 ------------------------ .github/workflows/mysql.yml | 53 ----------------------------- .github/workflows/postgres.yml | 61 ---------------------------------- .github/workflows/sqlite.yml | 43 ------------------------ docker-compose.yml | 26 ++++++--------- 5 files changed, 11 insertions(+), 216 deletions(-) delete mode 100644 .github/workflows/lint.yml delete mode 100644 .github/workflows/mysql.yml delete mode 100644 .github/workflows/postgres.yml delete mode 100644 .github/workflows/sqlite.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 35477ba6d4..0000000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,44 +0,0 @@ ---- -name: Linting - -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - - strategy: - matrix: - python-version: ['3.6'] - - name: Linting - steps: - - uses: actions/checkout@v2 - - name: Setup python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - architecture: x64 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install -r development.txt - sudo yarn install --non-interactive - sudo yarn global add prettier@1.17.0 - - - name: Lint - run: make lint - env: - TESTING_DATABASE_URL: 'sqlite://' - - - name: Lint Dockerfile - uses: brpaz/hadolint-action@master - with: - dockerfile: "Dockerfile" - - - name: Lint docker-compose - run: | - python -m pip install docker-compose==1.26.0 - docker-compose -f docker-compose.yml config - diff --git a/.github/workflows/mysql.yml b/.github/workflows/mysql.yml deleted file mode 100644 index d1dfdf4fcd..0000000000 --- a/.github/workflows/mysql.yml +++ /dev/null @@ -1,53 +0,0 @@ ---- -name: CTFd MySQL CI - -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - services: - mysql: - image: mysql:5.7 - env: - MYSQL_ROOT_PASSWORD: password - ports: - - 3306 - options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 - redis: - image: redis - ports: - - 6379:6379 - - strategy: - matrix: - python-version: ['3.6'] - - name: Python ${{ matrix.python-version }} - steps: - - uses: actions/checkout@v2 - - name: Setup python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - architecture: x64 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install -r development.txt - sudo yarn install --non-interactive - - - name: Test - run: | - sudo rm -f /etc/boto.cfg - make test - env: - AWS_ACCESS_KEY_ID: AKIAIOSFODNN7EXAMPLE - AWS_SECRET_ACCESS_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY - TESTING_DATABASE_URL: mysql+pymysql://root:password@localhost:${{ job.services.mysql.ports[3306] }}/ctfd - - - name: Codecov - uses: codecov/codecov-action@v1.0.11 - with: - file: ./coverage.xml diff --git a/.github/workflows/postgres.yml b/.github/workflows/postgres.yml deleted file mode 100644 index faed71a975..0000000000 --- a/.github/workflows/postgres.yml +++ /dev/null @@ -1,61 +0,0 @@ ---- -name: CTFd Postgres CI - -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - services: - postgres: - image: postgres - ports: - - 5432:5432 - env: - POSTGRES_HOST_AUTH_METHOD: trust - POSTGRES_DB: ctfd - POSTGRES_PASSWORD: password - # Set health checks to wait until postgres has started - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - redis: - image: redis - ports: - - 6379:6379 - - strategy: - matrix: - python-version: ['3.6'] - - name: Python ${{ matrix.python-version }} - steps: - - uses: actions/checkout@v2 - - name: Setup python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - architecture: x64 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install -r development.txt - sudo yarn install --non-interactive - - - name: Test - run: | - sudo rm -f /etc/boto.cfg - make test - env: - AWS_ACCESS_KEY_ID: AKIAIOSFODNN7EXAMPLE - AWS_SECRET_ACCESS_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY - TESTING_DATABASE_URL: postgres://postgres:password@localhost:${{ job.services.postgres.ports[5432] }}/ctfd - - - name: Codecov - uses: codecov/codecov-action@v1.0.11 - with: - file: ./coverage.xml - diff --git a/.github/workflows/sqlite.yml b/.github/workflows/sqlite.yml deleted file mode 100644 index 9c8aec60e2..0000000000 --- a/.github/workflows/sqlite.yml +++ /dev/null @@ -1,43 +0,0 @@ ---- -name: CTFd SQLite CI - -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - - strategy: - matrix: - python-version: ['3.6'] - - name: Python ${{ matrix.python-version }} - steps: - - uses: actions/checkout@v2 - - name: Setup python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - architecture: x64 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install -r development.txt - sudo yarn install --non-interactive - sudo yarn global add prettier@1.17.0 - - - name: Test - run: | - sudo rm -f /etc/boto.cfg - make test - env: - AWS_ACCESS_KEY_ID: AKIAIOSFODNN7EXAMPLE - AWS_SECRET_ACCESS_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY - TESTING_DATABASE_URL: 'sqlite://' - - - name: Codecov - uses: codecov/codecov-action@v1.0.11 - with: - file: ./coverage.xml - diff --git a/docker-compose.yml b/docker-compose.yml index 4160ba54c9..9cd44f4141 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: '2' services: ctfd: - build: . + image: registry.nush.app/ctfd:latest user: root restart: always ports: @@ -15,26 +15,20 @@ services: - LOG_FOLDER=/var/log/CTFd - ACCESS_LOG=- - ERROR_LOG=- - - REVERSE_PROXY=true volumes: - .data/CTFd/logs:/var/log/CTFd - .data/CTFd/uploads:/var/uploads - - .:/opt/CTFd:ro depends_on: - db networks: - default: + primary: internal: - - nginx: - image: nginx:1.17 - restart: always - volumes: - - ./conf/nginx/http.conf:/etc/nginx/nginx.conf - ports: - - 80:80 - depends_on: - - ctfd + labels: + - "traefik.enable=true" + - "traefik.http.routers.ctfd.rule=Host(`ctfd.nush.app`)" + - "traefik.http.routers.ctfd.entrypoints=https" + - "traefik.http.routers.ctfd.tls=true" + - "traefik.http.routers.ctfd.tls.certresolver=tlsresolver" db: image: mariadb:10.4.12 @@ -60,6 +54,8 @@ services: internal: networks: - default: + primary: + external: + name: primary internal: internal: true