Repository: ipsingh06/seedsync Branch: master Commit: ff2a1039935b Files: 337 Total size: 2.1 MB Directory structure: gitextract_tfp7f5p4/ ├── .github/ │ └── workflows/ │ └── master.yml ├── .gitignore ├── LICENSE.txt ├── Makefile ├── README.md ├── doc/ │ ├── CodingGuidelines.md │ ├── DeveloperReadme.md │ └── assets/ │ ├── logo.ai │ └── logo_with_name.ai └── src/ ├── angular/ │ ├── .angular-cli.json │ ├── .editorconfig │ ├── .gitignore │ ├── e2e/ │ │ ├── app.e2e-spec.ts │ │ ├── app.po.ts │ │ └── tsconfig.e2e.json │ ├── karma.conf.js │ ├── package.json │ ├── protractor.conf.js │ ├── src/ │ │ ├── app/ │ │ │ ├── app.module.ts │ │ │ ├── common/ │ │ │ │ ├── _common.scss │ │ │ │ ├── cached-reuse-strategy.ts │ │ │ │ ├── capitalize.pipe.ts │ │ │ │ ├── click-stop-propagation.directive.ts │ │ │ │ ├── eta.pipe.ts │ │ │ │ ├── file-size.pipe.ts │ │ │ │ ├── localization.ts │ │ │ │ └── storage-keys.ts │ │ │ ├── pages/ │ │ │ │ ├── about/ │ │ │ │ │ ├── about-page.component.html │ │ │ │ │ ├── about-page.component.scss │ │ │ │ │ └── about-page.component.ts │ │ │ │ ├── autoqueue/ │ │ │ │ │ ├── autoqueue-page.component.html │ │ │ │ │ ├── autoqueue-page.component.scss │ │ │ │ │ └── autoqueue-page.component.ts │ │ │ │ ├── files/ │ │ │ │ │ ├── file-list.component.html │ │ │ │ │ ├── file-list.component.scss │ │ │ │ │ ├── file-list.component.ts │ │ │ │ │ ├── file-options.component.html │ │ │ │ │ ├── file-options.component.scss │ │ │ │ │ ├── file-options.component.ts │ │ │ │ │ ├── file.component.html │ │ │ │ │ ├── file.component.scss │ │ │ │ │ ├── file.component.ts │ │ │ │ │ ├── files-page.component.html │ │ │ │ │ └── files-page.component.ts │ │ │ │ ├── logs/ │ │ │ │ │ ├── logs-page.component.html │ │ │ │ │ ├── logs-page.component.scss │ │ │ │ │ └── logs-page.component.ts │ │ │ │ ├── main/ │ │ │ │ │ ├── app.component.html │ │ │ │ │ ├── app.component.scss │ │ │ │ │ ├── app.component.ts │ │ │ │ │ ├── header.component.html │ │ │ │ │ ├── header.component.scss │ │ │ │ │ ├── header.component.ts │ │ │ │ │ ├── sidebar.component.html │ │ │ │ │ ├── sidebar.component.scss │ │ │ │ │ └── sidebar.component.ts │ │ │ │ └── settings/ │ │ │ │ ├── option.component.html │ │ │ │ ├── option.component.scss │ │ │ │ ├── option.component.ts │ │ │ │ ├── options-list.ts │ │ │ │ ├── settings-page.component.html │ │ │ │ ├── settings-page.component.scss │ │ │ │ └── settings-page.component.ts │ │ │ ├── routes.ts │ │ │ ├── services/ │ │ │ │ ├── autoqueue/ │ │ │ │ │ ├── autoqueue-pattern.ts │ │ │ │ │ └── autoqueue.service.ts │ │ │ │ ├── base/ │ │ │ │ │ ├── base-stream.service.ts │ │ │ │ │ ├── base-web.service.ts │ │ │ │ │ └── stream-service.registry.ts │ │ │ │ ├── files/ │ │ │ │ │ ├── mock-model-files.ts │ │ │ │ │ ├── model-file.service.ts │ │ │ │ │ ├── model-file.ts │ │ │ │ │ ├── screenshot-model-files.ts │ │ │ │ │ ├── view-file-filter.service.ts │ │ │ │ │ ├── view-file-options.service.ts │ │ │ │ │ ├── view-file-options.ts │ │ │ │ │ ├── view-file-sort.service.ts │ │ │ │ │ ├── view-file.service.ts │ │ │ │ │ └── view-file.ts │ │ │ │ ├── logs/ │ │ │ │ │ ├── log-record.ts │ │ │ │ │ └── log.service.ts │ │ │ │ ├── server/ │ │ │ │ │ ├── server-command.service.ts │ │ │ │ │ ├── server-status.service.ts │ │ │ │ │ └── server-status.ts │ │ │ │ ├── settings/ │ │ │ │ │ ├── config.service.ts │ │ │ │ │ └── config.ts │ │ │ │ └── utils/ │ │ │ │ ├── connected.service.ts │ │ │ │ ├── dom.service.ts │ │ │ │ ├── logger.service.ts │ │ │ │ ├── notification.service.ts │ │ │ │ ├── notification.ts │ │ │ │ ├── rest.service.ts │ │ │ │ └── version-check.service.ts │ │ │ └── tests/ │ │ │ ├── mocks/ │ │ │ │ ├── mock-event-source.ts │ │ │ │ ├── mock-model-file.service.ts │ │ │ │ ├── mock-rest.service.ts │ │ │ │ ├── mock-storage.service.ts │ │ │ │ ├── mock-stream-service.registry.ts │ │ │ │ ├── mock-view-file-options.service.ts │ │ │ │ └── mock-view-file.service.ts │ │ │ └── unittests/ │ │ │ └── services/ │ │ │ ├── autoqueue/ │ │ │ │ └── autoqueue.service.spec.ts │ │ │ ├── base/ │ │ │ │ ├── base-stream.service.spec.ts │ │ │ │ ├── base-web.service.spec.ts │ │ │ │ └── stream-service.registry.spec.ts │ │ │ ├── files/ │ │ │ │ ├── model-file.service.spec.ts │ │ │ │ ├── model-file.spec.ts │ │ │ │ ├── view-file-filter.service.spec.ts │ │ │ │ ├── view-file-options.service.spec.ts │ │ │ │ ├── view-file-sort.service.spec.ts │ │ │ │ └── view-file.service.spec.ts │ │ │ ├── logs/ │ │ │ │ ├── log-record.spec.ts │ │ │ │ └── log.service.spec.ts │ │ │ ├── server/ │ │ │ │ ├── server-command.service.spec.ts │ │ │ │ ├── server-status.service.spec.ts │ │ │ │ └── server-status.spec.ts │ │ │ ├── settings/ │ │ │ │ ├── config.service.spec.ts │ │ │ │ └── config.spec.ts │ │ │ └── utils/ │ │ │ ├── connected.service.spec.ts │ │ │ ├── dom.service.spec.ts │ │ │ ├── notification.service.spec.ts │ │ │ ├── rest.service.spec.ts │ │ │ └── version-check.service.spec.ts │ │ ├── assets/ │ │ │ └── .gitkeep │ │ ├── environments/ │ │ │ ├── environment.prod.ts │ │ │ └── environment.ts │ │ ├── index.html │ │ ├── main.ts │ │ ├── polyfills.ts │ │ ├── styles.scss │ │ ├── test.ts │ │ ├── tsconfig.app.json │ │ ├── tsconfig.spec.json │ │ └── typings.d.ts │ ├── tsconfig.json │ └── tslint.json ├── debian/ │ ├── changelog │ ├── compat │ ├── config │ ├── control │ ├── postinst │ ├── postrm │ ├── rules │ ├── seedsync.service │ ├── source/ │ │ └── format │ └── templates ├── docker/ │ ├── build/ │ │ ├── deb/ │ │ │ ├── Dockerfile │ │ │ └── Dockerfile.dockerignore │ │ └── docker-image/ │ │ ├── Dockerfile │ │ ├── Dockerfile.dockerignore │ │ ├── run_as_user │ │ ├── scp │ │ ├── setup_default_config.sh │ │ └── ssh │ ├── stage/ │ │ ├── deb/ │ │ │ ├── Dockerfile │ │ │ ├── compose-ubu1604.yml │ │ │ ├── compose-ubu1804.yml │ │ │ ├── compose-ubu2004.yml │ │ │ ├── compose.yml │ │ │ ├── entrypoint.sh │ │ │ ├── expect_seedsync.exp │ │ │ ├── id_rsa │ │ │ ├── id_rsa.pub │ │ │ ├── install_seedsync.sh │ │ │ └── ubuntu-systemd/ │ │ │ ├── ubuntu-16.04-systemd/ │ │ │ │ ├── Dockerfile │ │ │ │ └── setup │ │ │ ├── ubuntu-18.04-systemd/ │ │ │ │ ├── Dockerfile │ │ │ │ └── setup │ │ │ └── ubuntu-20.04-systemd/ │ │ │ ├── Dockerfile │ │ │ └── setup │ │ └── docker-image/ │ │ └── compose.yml │ ├── test/ │ │ ├── angular/ │ │ │ ├── Dockerfile │ │ │ └── compose.yml │ │ ├── e2e/ │ │ │ ├── Dockerfile │ │ │ ├── chrome/ │ │ │ │ └── Dockerfile │ │ │ ├── compose-dev.yml │ │ │ ├── compose.yml │ │ │ ├── configure/ │ │ │ │ ├── Dockerfile │ │ │ │ └── setup_seedsync.sh │ │ │ ├── parse_seedsync_status.py │ │ │ ├── remote/ │ │ │ │ ├── Dockerfile │ │ │ │ └── id_rsa.pub │ │ │ ├── run_tests.sh │ │ │ └── urls.ts │ │ └── python/ │ │ ├── Dockerfile │ │ ├── compose.yml │ │ └── entrypoint.sh │ └── wait-for-it.sh ├── e2e/ │ ├── .gitignore │ ├── README.md │ ├── conf.ts │ ├── package.json │ ├── tests/ │ │ ├── about.page.spec.ts │ │ ├── about.page.ts │ │ ├── app.spec.ts │ │ ├── app.ts │ │ ├── autoqueue.page.spec.ts │ │ ├── autoqueue.page.ts │ │ ├── dashboard.page.spec.ts │ │ ├── dashboard.page.ts │ │ ├── settings.page.spec.ts │ │ └── settings.page.ts │ ├── tsconfig.json │ └── urls.ts ├── pyinstaller_hooks/ │ └── hook-patoolib.py └── python/ ├── __init__.py ├── common/ │ ├── __init__.py │ ├── app_process.py │ ├── config.py │ ├── constants.py │ ├── context.py │ ├── error.py │ ├── job.py │ ├── localization.py │ ├── multiprocessing_logger.py │ ├── persist.py │ ├── status.py │ └── types.py ├── controller/ │ ├── __init__.py │ ├── auto_queue.py │ ├── controller.py │ ├── controller_job.py │ ├── controller_persist.py │ ├── delete/ │ │ ├── __init__.py │ │ └── delete_process.py │ ├── extract/ │ │ ├── __init__.py │ │ ├── dispatch.py │ │ ├── extract.py │ │ └── extract_process.py │ ├── model_builder.py │ └── scan/ │ ├── __init__.py │ ├── active_scanner.py │ ├── local_scanner.py │ ├── remote_scanner.py │ └── scanner_process.py ├── docs/ │ ├── faq.md │ ├── index.md │ ├── install.md │ └── usage.md ├── lftp/ │ ├── __init__.py │ ├── job_status.py │ ├── job_status_parser.py │ └── lftp.py ├── mkdocs.yml ├── model/ │ ├── __init__.py │ ├── diff.py │ ├── file.py │ └── model.py ├── pyproject.toml ├── scan_fs.py ├── seedsync.py ├── ssh/ │ ├── __init__.py │ └── sshcp.py ├── system/ │ ├── __init__.py │ ├── file.py │ └── scanner.py ├── tests/ │ ├── __init__.py │ ├── integration/ │ │ ├── __init__.py │ │ ├── test_controller/ │ │ │ ├── __init__.py │ │ │ ├── test_controller.py │ │ │ └── test_extract/ │ │ │ ├── __init__.py │ │ │ └── test_extract.py │ │ ├── test_lftp/ │ │ │ ├── __init__.py │ │ │ └── test_lftp.py │ │ └── test_web/ │ │ ├── __init__.py │ │ ├── test_handler/ │ │ │ ├── __init__.py │ │ │ ├── test_auto_queue.py │ │ │ ├── test_config.py │ │ │ ├── test_controller.py │ │ │ ├── test_server.py │ │ │ ├── test_status.py │ │ │ ├── test_stream_log.py │ │ │ ├── test_stream_model.py │ │ │ └── test_stream_status.py │ │ └── test_web_app.py │ ├── unittests/ │ │ ├── __init__.py │ │ ├── test_common/ │ │ │ ├── __init__.py │ │ │ ├── test_app_process.py │ │ │ ├── test_config.py │ │ │ ├── test_job.py │ │ │ ├── test_multiprocessing_logger.py │ │ │ ├── test_persist.py │ │ │ └── test_status.py │ │ ├── test_controller/ │ │ │ ├── __init__.py │ │ │ ├── test_auto_queue.py │ │ │ ├── test_controller_persist.py │ │ │ ├── test_extract/ │ │ │ │ ├── __init__.py │ │ │ │ ├── test_dispatch.py │ │ │ │ └── test_extract_process.py │ │ │ ├── test_model_builder.py │ │ │ └── test_scan/ │ │ │ ├── __init__.py │ │ │ ├── test_remote_scanner.py │ │ │ └── test_scanner_process.py │ │ ├── test_lftp/ │ │ │ ├── __init__.py │ │ │ ├── test_job_status.py │ │ │ ├── test_job_status_parser.py │ │ │ └── test_lftp.py │ │ ├── test_model/ │ │ │ ├── __init__.py │ │ │ ├── test_diff.py │ │ │ ├── test_file.py │ │ │ └── test_model.py │ │ ├── test_seedsync.py │ │ ├── test_ssh/ │ │ │ ├── __init__.py │ │ │ └── test_sshcp.py │ │ ├── test_system/ │ │ │ ├── __init__.py │ │ │ ├── test_file.py │ │ │ └── test_scanner.py │ │ └── test_web/ │ │ ├── __init__.py │ │ ├── test_handler/ │ │ │ └── test_stream_log.py │ │ └── test_serialize/ │ │ ├── __init__.py │ │ ├── test_serialize.py │ │ ├── test_serialize_auto_queue.py │ │ ├── test_serialize_config.py │ │ ├── test_serialize_log_record.py │ │ ├── test_serialize_model.py │ │ └── test_serialize_status.py │ └── utils.py └── web/ ├── __init__.py ├── handler/ │ ├── __init__.py │ ├── auto_queue.py │ ├── config.py │ ├── controller.py │ ├── server.py │ ├── status.py │ ├── stream_log.py │ ├── stream_model.py │ └── stream_status.py ├── serialize/ │ ├── __init__.py │ ├── serialize.py │ ├── serialize_auto_queue.py │ ├── serialize_config.py │ ├── serialize_log_record.py │ ├── serialize_model.py │ └── serialize_status.py ├── utils.py ├── web_app.py ├── web_app_builder.py └── web_app_job.py ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/workflows/master.yml ================================================ name: CI on: push: branches: [ master ] tags: - v[0-9]+.[0-9]+.[0-9]+ pull_request: branches: [ master ] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: jobs: unittests-python: name: Python unit tests runs-on: ubuntu-latest steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: Checkout uses: actions/checkout@v2 # Build package - name: Run Python unit tests run: make run-tests-python unittests-angular: name: Angular unit tests runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 # Build package - name: Run Angular unit tests run: make run-tests-angular build-deb: name: Build Deb runs-on: ubuntu-latest needs: [ unittests-python, unittests-angular ] steps: - name: Checkout uses: actions/checkout@v2 # Sets up build environment - name: Set up QEMU uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx id: buildx uses: docker/setup-buildx-action@v1 with: driver-opts: | image=moby/buildkit:master network=host - name: Show buildx builder instance name run: echo ${{ steps.buildx.outputs.name }} - name: Show buildx available platforms run: echo ${{ steps.buildx.outputs.platforms }} # Build package - name: Build deb package run: make deb # Upload package - name: Publish artifact uses: actions/upload-artifact@v2 with: path: ${{ github.workspace }}/build/*.deb name: deb-${{ github.run_number }} # Post build steps - name: List built packages if: ${{ success() }} run: ls -l $GITHUB_WORKSPACE/build/ build-docker-image: name: Build Docker Image runs-on: ubuntu-latest needs: [ unittests-python, unittests-angular ] steps: - name: Checkout uses: actions/checkout@v2 # Sets up build environment - name: Set up QEMU uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx id: buildx uses: docker/setup-buildx-action@v1 with: driver-opts: | image=moby/buildkit:master network=host - name: Show buildx builder instance name run: echo ${{ steps.buildx.outputs.name }} - name: Show buildx available platforms run: echo ${{ steps.buildx.outputs.platforms }} # Login using a PAT with write:packages scope - name: Log into GitHub Container Registry run: echo "${{ secrets.CR_PAT }}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin # Set staging registry - name: Set staging registry env variable run: echo "staging_registry=ghcr.io/${{ github.repository }}" >> $GITHUB_ENV # Build docker image - name: Build docker image run: make docker-image STAGING_REGISTRY=${{ env.staging_registry }} STAGING_VERSION=${{ github.run_number }} e2etests-deb: name: End-to-end tests on Deb runs-on: ubuntu-latest needs: [ build-deb ] strategy: matrix: oscode: [ ubu1604, ubu1804, ubu2004 ] steps: - name: Checkout uses: actions/checkout@v2 - name: Download deb package artifact uses: actions/download-artifact@v2 with: name: deb-${{ github.run_number }} path: build/ # Run e2e test - name: Run e2e test run: make run-tests-e2e SEEDSYNC_DEB=`readlink -f build/*.deb` SEEDSYNC_OS=${{ matrix.oscode }} e2etests-docker-image: name: End-to-end tests on Docker Image runs-on: ubuntu-latest needs: [ build-docker-image ] strategy: matrix: arch: [ amd64, arm64, arm/v7 ] steps: - name: Checkout uses: actions/checkout@v2 # Sets up build environment - name: Enable Docker experimental features run: | echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json sudo service docker restart docker version - name: Set up QEMU uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx id: buildx uses: docker/setup-buildx-action@v1 with: driver-opts: | image=moby/buildkit:master network=host - name: Show buildx builder instance name run: echo ${{ steps.buildx.outputs.name }} - name: Show buildx available platforms run: echo ${{ steps.buildx.outputs.platforms }} # Login using a PAT with write:packages scope - name: Log into GitHub Container Registry run: echo "${{ secrets.CR_PAT }}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin # Set staging registry - name: Set staging registry env variable run: echo "staging_registry=ghcr.io/${{ github.repository }}" >> $GITHUB_ENV # Run e2e test - name: Run e2e test run: make run-tests-e2e \ STAGING_REGISTRY=${{ env.staging_registry }} \ STAGING_VERSION=${{ github.run_number }} \ SEEDSYNC_ARCH=${{ matrix.arch }} publish-docker-image: name: Publish Docker Image if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-latest needs: [ e2etests-deb, e2etests-docker-image ] steps: - name: Set release env variable run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV - name: Checkout uses: actions/checkout@v2 # Sets up build environment - name: Set up QEMU uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx id: buildx uses: docker/setup-buildx-action@v1 with: driver-opts: | image=moby/buildkit:master network=host - name: Show buildx builder instance name run: echo ${{ steps.buildx.outputs.name }} - name: Show buildx available platforms run: echo ${{ steps.buildx.outputs.platforms }} # Login to GHCR using a PAT with write:packages scope - name: Log into GitHub Container Registry run: echo "${{ secrets.CR_PAT }}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin # Login to Dockerhub - name: Log into Dockerhub registry run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin # Set staging registry - name: Set staging registry env variable run: echo "staging_registry=ghcr.io/${{ github.repository }}" >> $GITHUB_ENV # Push image to dockerhub - name: Push to Dockerhub (tag vX.X.X) run: make docker-image-release \ STAGING_REGISTRY=${{ env.staging_registry }} \ STAGING_VERSION=${{ github.run_number }} \ RELEASE_REGISTRY=docker.io/ipsingh06 \ RELEASE_VERSION=${{ env.RELEASE_VERSION }} - name: Push to Dockerhub (tag latest) run: make docker-image-release \ STAGING_REGISTRY=${{ env.staging_registry }} \ STAGING_VERSION=${{ github.run_number }} \ RELEASE_REGISTRY=docker.io/ipsingh06 \ RELEASE_VERSION=latest publish-deb: name: Publish Deb package if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-latest needs: [ e2etests-deb, e2etests-docker-image ] steps: - name: Set release env variable run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV - name: Download deb package artifact uses: actions/download-artifact@v2 with: name: deb-${{ github.run_number }} path: build/ - name: Set deb file path and name env variable run: | echo "DEB_PATH=$(readlink -f ./build/*.deb)" >> $GITHUB_ENV echo "DEB_NAME=$(basename $(readlink -f ./build/*.deb))" >> $GITHUB_ENV - name: Create Release id: create_release uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ github.ref }} release_name: Release ${{ github.ref }} body: ${{ github.event.head_commit.message }} draft: false prerelease: false - name: Upload Release Asset id: upload-release-asset uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: ${{ env.DEB_PATH }} asset_name: ${{ env.DEB_NAME }} asset_content_type: application/x-deb ================================================ FILE: .gitignore ================================================ .idea *.pyc /build .venv package-lock.json src/python/build src/python/site ================================================ FILE: LICENSE.txt ================================================ Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ================================================ FILE: Makefile ================================================ # Copyright 2017, Inderpreet Singh, All rights reserved. # Catch sigterms # See: https://stackoverflow.com/a/52159940 export SHELL:=/bin/bash export SHELLOPTS:=$(if $(SHELLOPTS),$(SHELLOPTS):)pipefail:errexit .ONESHELL: # Color outputs red=`tput setaf 1` green=`tput setaf 2` reset=`tput sgr0` ROOTDIR:=$(shell realpath .) SOURCEDIR:=$(shell realpath ./src) BUILDDIR:=$(shell realpath ./build) DEFAULT_STAGING_REGISTRY:=localhost:5000 #DOCKER_BUILDKIT_FLAGS=BUILDKIT_PROGRESS=plain DOCKER=${DOCKER_BUILDKIT_FLAGS} DOCKER_BUILDKIT=1 docker DOCKER_COMPOSE=${DOCKER_BUILDKIT_FLAGS} COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose .PHONY: builddir deb docker-image clean all: deb docker-image builddir: mkdir -p ${BUILDDIR} scanfs: builddir $(DOCKER) build \ -f ${SOURCEDIR}/docker/build/deb/Dockerfile \ --target seedsync_build_scanfs_export \ --output ${BUILDDIR} \ ${ROOTDIR} deb: builddir $(DOCKER) build \ -f ${SOURCEDIR}/docker/build/deb/Dockerfile \ --target seedsync_build_deb_export \ --output ${BUILDDIR} \ ${ROOTDIR} docker-buildx: $(DOCKER) run --rm --privileged multiarch/qemu-user-static --reset -p yes docker-image: docker-buildx @if [[ -z "${STAGING_REGISTRY}" ]] ; then \ export STAGING_REGISTRY="${DEFAULT_STAGING_REGISTRY}"; \ fi; echo "${green}STAGING_REGISTRY=$${STAGING_REGISTRY}${reset}"; @if [[ -z "${STAGING_VERSION}" ]] ; then \ export STAGING_VERSION="latest"; \ fi; echo "${green}STAGING_VERSION=$${STAGING_VERSION}${reset}"; # scanfs image $(DOCKER) buildx build \ -f ${SOURCEDIR}/docker/build/deb/Dockerfile \ --target seedsync_build_scanfs_export \ --tag $${STAGING_REGISTRY}/seedsync/build/scanfs/export:$${STAGING_VERSION} \ --cache-to=type=registry,ref=$${STAGING_REGISTRY}/seedsync/build/scanfs/export:cache,mode=max \ --cache-from=type=registry,ref=$${STAGING_REGISTRY}/seedsync/build/scanfs/export:cache \ --push \ ${ROOTDIR} # angular html export $(DOCKER) buildx build \ -f ${SOURCEDIR}/docker/build/deb/Dockerfile \ --target seedsync_build_angular_export \ --tag $${STAGING_REGISTRY}/seedsync/build/angular/export:$${STAGING_VERSION} \ --cache-to=type=registry,ref=$${STAGING_REGISTRY}/seedsync/build/angular/export:cache,mode=max \ --cache-from=type=registry,ref=$${STAGING_REGISTRY}/seedsync/build/angular/export:cache \ --push \ ${ROOTDIR} # final image $(DOCKER) buildx build \ -f ${SOURCEDIR}/docker/build/docker-image/Dockerfile \ --target seedsync_run \ --build-arg STAGING_VERSION=$${STAGING_VERSION} \ --build-arg STAGING_REGISTRY=$${STAGING_REGISTRY} \ --tag $${STAGING_REGISTRY}/seedsync:$${STAGING_VERSION} \ --cache-to=type=registry,ref=$${STAGING_REGISTRY}/seedsync:cache,mode=max \ --cache-from=type=registry,ref=$${STAGING_REGISTRY}/seedsync:cache \ --platform linux/amd64,linux/arm64,linux/arm/v7 \ --push \ ${ROOTDIR} docker-image-release: @if [[ -z "${STAGING_REGISTRY}" ]] ; then \ export STAGING_REGISTRY="${DEFAULT_STAGING_REGISTRY}"; \ fi; echo "${green}STAGING_REGISTRY=$${STAGING_REGISTRY}${reset}"; @if [[ -z "${STAGING_VERSION}" ]] ; then \ export STAGING_VERSION="latest"; \ fi; echo "${green}STAGING_VERSION=$${STAGING_VERSION}${reset}"; @if [[ -z "${RELEASE_REGISTRY}" ]] ; then \ echo "${red}ERROR: RELEASE_REGISTRY is required${reset}"; exit 1; \ fi @if [[ -z "${RELEASE_VERSION}" ]] ; then \ echo "${red}ERROR: RELEASE_VERSION is required${reset}"; exit 1; \ fi echo "${green}RELEASE_REGISTRY=${RELEASE_REGISTRY}${reset}" echo "${green}RELEASE_VERSION=${RELEASE_VERSION}${reset}" # final image $(DOCKER) buildx build \ -f ${SOURCEDIR}/docker/build/docker-image/Dockerfile \ --target seedsync_run \ --build-arg STAGING_VERSION=$${STAGING_VERSION} \ --build-arg STAGING_REGISTRY=$${STAGING_REGISTRY} \ --tag ${RELEASE_REGISTRY}/seedsync:${RELEASE_VERSION} \ --cache-from=type=registry,ref=$${STAGING_REGISTRY}/seedsync:cache \ --platform linux/amd64,linux/arm64,linux/arm/v7 \ --push \ ${ROOTDIR} tests-python: # python run $(DOCKER) build \ -f ${SOURCEDIR}/docker/build/docker-image/Dockerfile \ --target seedsync_run_python_devenv \ --tag seedsync/run/python/devenv \ ${ROOTDIR} # python tests $(DOCKER_COMPOSE) \ -f ${SOURCEDIR}/docker/test/python/compose.yml \ build run-tests-python: tests-python $(DOCKER_COMPOSE) \ -f ${SOURCEDIR}/docker/test/python/compose.yml \ up --force-recreate --exit-code-from tests tests-angular: # angular build $(DOCKER) build \ -f ${SOURCEDIR}/docker/build/deb/Dockerfile \ --target seedsync_build_angular_env \ --tag seedsync/build/angular/env \ ${ROOTDIR} # angular tests $(DOCKER_COMPOSE) \ -f ${SOURCEDIR}/docker/test/angular/compose.yml \ build run-tests-angular: tests-angular $(DOCKER_COMPOSE) \ -f ${SOURCEDIR}/docker/test/angular/compose.yml \ up --force-recreate --exit-code-from tests tests-e2e-deps: # deb pre-reqs $(DOCKER) build \ ${SOURCEDIR}/docker/stage/deb/ubuntu-systemd/ubuntu-16.04-systemd \ -t ubuntu-systemd:16.04 $(DOCKER) build \ ${SOURCEDIR}/docker/stage/deb/ubuntu-systemd/ubuntu-18.04-systemd \ -t ubuntu-systemd:18.04 $(DOCKER) build \ ${SOURCEDIR}/docker/stage/deb/ubuntu-systemd/ubuntu-20.04-systemd \ -t ubuntu-systemd:20.04 # Setup docker for the systemd container # See: https://github.com/solita/docker-systemd $(DOCKER) run --rm --privileged -v /:/host solita/ubuntu-systemd setup run-tests-e2e: tests-e2e-deps # Check our settings @if [[ -z "${STAGING_VERSION}" ]] && [[ -z "${SEEDSYNC_DEB}" ]]; then \ echo "${red}ERROR: One of STAGING_VERSION or SEEDSYNC_DEB must be set${reset}"; exit 1; \ elif [[ ! -z "${STAGING_VERSION}" ]] && [[ ! -z "${SEEDSYNC_DEB}" ]]; then \ echo "${red}ERROR: Only one of STAGING_VERSION or SEEDSYNC_DEB must be set${reset}"; exit 1; \ fi # Set up environment for deb @if [[ ! -z "${SEEDSYNC_DEB}" ]] ; then \ if [[ -z "${SEEDSYNC_OS}" ]] ; then \ echo "${red}ERROR: SEEDSYNC_OS is required for DEB e2e test${reset}"; \ echo "${red}Options include: ubu1604, ubu1804, ubu2004${reset}"; exit 1; \ fi fi # Set up environment for image @if [[ ! -z "${STAGING_VERSION}" ]] ; then \ if [[ -z "${SEEDSYNC_ARCH}" ]] ; then \ echo "${red}ERROR: SEEDSYNC_ARCH is required for docker image e2e test${reset}"; \ echo "${red}Options include: amd64, arm64, arm/v7${reset}"; exit 1; \ fi if [[ -z "${STAGING_REGISTRY}" ]] ; then \ export STAGING_REGISTRY="${DEFAULT_STAGING_REGISTRY}"; \ fi; echo "${green}STAGING_REGISTRY=$${STAGING_REGISTRY}${reset}"; # Removing and pulling is the only way to select the arch from a multi-arch image :( $(DOCKER) rmi -f $${STAGING_REGISTRY}/seedsync:$${STAGING_VERSION} $(DOCKER) pull $${STAGING_REGISTRY}/seedsync:$${STAGING_VERSION} --platform linux/$${SEEDSYNC_ARCH} fi # Set the flags COMPOSE_FLAGS="-f ${SOURCEDIR}/docker/test/e2e/compose.yml " COMPOSE_RUN_FLAGS="" if [[ ! -z "${SEEDSYNC_DEB}" ]] ; then COMPOSE_FLAGS+="-f ${SOURCEDIR}/docker/stage/deb/compose.yml " COMPOSE_FLAGS+="-f ${SOURCEDIR}/docker/stage/deb/compose-${SEEDSYNC_OS}.yml " fi if [[ ! -z "${STAGING_VERSION}" ]] ; then \ COMPOSE_FLAGS+="-f ${SOURCEDIR}/docker/stage/docker-image/compose.yml " fi if [[ "${DEV}" = "1" ]] ; then COMPOSE_FLAGS+="-f ${SOURCEDIR}/docker/test/e2e/compose-dev.yml " else \ COMPOSE_RUN_FLAGS+="-d" fi echo "${green}COMPOSE_FLAGS=$${COMPOSE_FLAGS}${reset}" # Set up Ctrl-C handler function tearDown { $(DOCKER_COMPOSE) \ $${COMPOSE_FLAGS} \ stop } trap tearDown EXIT # Build the test echo "${green}Building the tests${reset}" $(DOCKER_COMPOSE) \ $${COMPOSE_FLAGS} \ build # This suppresses the docker-compose error that image has changed $(DOCKER_COMPOSE) \ $${COMPOSE_FLAGS} \ rm -f myapp # Run the test echo "${green}Running the tests${reset}" $(DOCKER_COMPOSE) \ $${COMPOSE_FLAGS} \ up --force-recreate \ $${COMPOSE_RUN_FLAGS} if [[ "${DEV}" != "1" ]] ; then $(DOCKER) logs -f seedsync_test_e2e fi EXITCODE=`$(DOCKER) inspect seedsync_test_e2e | jq '.[].State.ExitCode'` if [[ "$${EXITCODE}" != "0" ]] ; then false fi run-remote-server: $(DOCKER) container rm -f seedsync_test_e2e_remote-dev $(DOCKER) run \ -it --init \ -p 1234:1234 \ --name seedsync_test_e2e_remote-dev \ seedsync/test/e2e/remote clean: rm -rf ${BUILDDIR} ================================================ FILE: README.md ================================================