diff --git a/.github/workflows/deploy-frontend.yml b/.github/workflows/deploy-frontend.yml index 48e49b50..a87ad1e5 100644 --- a/.github/workflows/deploy-frontend.yml +++ b/.github/workflows/deploy-frontend.yml @@ -2,7 +2,7 @@ name: Deploy WebRTC defaults: run: - working-directory: ./frontend/ + working-directory: ./frontend/site on: push: @@ -28,8 +28,8 @@ jobs: - name: Build uses: docker/build-push-action@v3 with: - context: ./frontend - file: ./frontend/Dockerfile + context: ./frontend/site + file: ./frontend/site/Dockerfile platforms: linux/amd64 push: true tags: ghcr.io/ueckoken/plarail2022-frontend:${{ env.IMAGE_TAG }} diff --git a/.github/workflows/deploy-python-server.yml b/.github/workflows/deploy-multicaster.yml similarity index 83% rename from .github/workflows/deploy-python-server.yml rename to .github/workflows/deploy-multicaster.yml index 5477de95..ccb06fe2 100644 --- a/.github/workflows/deploy-python-server.yml +++ b/.github/workflows/deploy-multicaster.yml @@ -2,12 +2,12 @@ name: Deploy WebRTC python server defaults: run: - working-directory: ./frontend/videoCast + working-directory: ./backend/multicaster on: push: branches: [deployment] - paths: ["./frontend/videoCast/**"] + paths: ["./frontend/multicaster/**"] jobs: build: @@ -30,8 +30,8 @@ jobs: - name: Build uses: docker/build-push-action@v3 with: - context: ./frontend/videoCast - file: ./frontend/videoCast/Dockerfile.python + context: ./backend/multicaster + file: ./backend/multicaster/Dockerfile platforms: linux/amd64 push: true tags: ghcr.io/ueckoken/plarail2022-frontend-python:${{ env.IMAGE_TAG }} diff --git a/.github/workflows/deploy-sender.yml b/.github/workflows/deploy-sender.yml index e9ccc160..6a99582b 100644 --- a/.github/workflows/deploy-sender.yml +++ b/.github/workflows/deploy-sender.yml @@ -2,7 +2,7 @@ name: Deploy WebRTC sender defaults: run: - working-directory: ./frontend/ + working-directory: ./frontend/momo_sender on: push: @@ -29,8 +29,8 @@ jobs: - name: Build uses: docker/build-push-action@v3 with: - context: ./frontend/videoCast/ - file: ./frontend/videoCast/Dockerfile.sender + context: ./frontend/momo_sender/ + file: ./frontend/momo_sender/Dockerfile platforms: linux/amd64 push: true tags: ghcr.io/ueckoken/plarail2022-webrtc-sender:${{ env.IMAGE_TAG }} diff --git a/.github/workflows/deploy-testing-receiver.yml b/.github/workflows/deploy-testing-receiver.yml index d14d1594..1e3290a5 100644 --- a/.github/workflows/deploy-testing-receiver.yml +++ b/.github/workflows/deploy-testing-receiver.yml @@ -2,7 +2,7 @@ name: Deploy WebRTC receiver testing defaults: run: - working-directory: ./frontend/ + working-directory: ./frontend/skyway_receiver on: push: @@ -30,8 +30,8 @@ jobs: - name: Build uses: docker/build-push-action@v3 with: - context: ./frontend/videoCast/ - file: ./frontend/videoCast/Dockerfile.receiver + context: ./frontend/skyway_receiver/ + file: ./frontend/skyway_receiver/Dockerfile platforms: linux/amd64 push: true tags: ghcr.io/ueckoken/plarail2022-receiver-test:${{ env.IMAGE_TAG }} diff --git a/.github/workflows/format_frontend.yml b/.github/workflows/format.yml similarity index 59% rename from .github/workflows/format_frontend.yml rename to .github/workflows/format.yml index e4d14d4e..138c6dcf 100644 --- a/.github/workflows/format_frontend.yml +++ b/.github/workflows/format.yml @@ -3,6 +3,7 @@ on: push: paths: - "frontend/**/*" + - "backend/multicaster/*" branches-ignore: - "main" - "deployment" @@ -13,15 +14,15 @@ jobs: runs-on: ubuntu-latest defaults: run: - working-directory: "frontend/" + working-directory: "frontend/site" steps: - name: checkout uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version-file: ./frontend/.nvmrc + node-version-file: ./frontend/site/.nvmrc cache: yarn - cache-dependency-path: ./frontend/yarn.lock + cache-dependency-path: ./frontend/site/yarn.lock - run: yarn install --frozen-lockfile - run: yarn fmt - name: Count changes @@ -38,19 +39,19 @@ jobs: git push if: steps.changes.outputs.count > 0 - prettier-videocast: + prettier-momo-sender: runs-on: ubuntu-latest defaults: run: - working-directory: "frontend/videoCast" + working-directory: "frontend/momo_sender" steps: - name: checkout uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version-file: ./frontend/videoCast/.nvmrc + node-version-file: ./frontend/momo_sender/.nvmrc cache: npm - cache-dependency-path: ./frontend/videoCast/package-lock.json + cache-dependency-path: ./frontend/momo_sender/package-lock.json - run: npm ci - run: npm run fmt - uses: EndBug/add-and-commit@v9 @@ -59,11 +60,32 @@ jobs: author_email: bot@example.com message: format by prettier - black-videoCast: + prettier-skyway-receiver: runs-on: ubuntu-latest defaults: run: - working-directory: "frontend/videoCast" + working-directory: "frontend/skyway_receiver" + steps: + - name: checkout + uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version-file: ./frontend/skyway_receiver/.nvmrc + cache: npm + cache-dependency-path: ./frontend/skyway_receiver/package-lock.json + - run: npm ci + - run: npm run fmt + - uses: EndBug/add-and-commit@v9 + with: + author_name: format BOT + author_email: bot@example.com + message: format by prettier + + black-multicaster: + runs-on: ubuntu-latest + defaults: + run: + working-directory: "backend/multicaster" steps: - name: checkout uses: actions/checkout@v3 @@ -71,7 +93,7 @@ jobs: with: python-version: "3.10" cache: pip - cache-dependency-path: ./frontend/videoCast/requirements-dev.txt + cache-dependency-path: ./backend/multicaster/requirements-dev.txt - run: pip install -r requirements-dev.txt - run: black . - uses: EndBug/add-and-commit@v9 diff --git a/.github/workflows/test-frontend.yml b/.github/workflows/test-frontend.yml index a3c6491e..e1d26c34 100644 --- a/.github/workflows/test-frontend.yml +++ b/.github/workflows/test-frontend.yml @@ -2,7 +2,7 @@ name: Frontend build and test defaults: run: - working-directory: ./frontend + working-directory: ./frontend/site on: push @@ -14,13 +14,13 @@ jobs: - uses: actions/cache@v3 with: path: | - ${{ github.workspace }}/frontend/.next/cache - key: ${{ runner.os }}-nextjs-${{ hashFiles('./frontend/**/yarn.lock') }}-${{ hashFiles('./frontend/**.[jt]s', './frontend/**.[jt]sx') }} + ${{ github.workspace }}/frontend/site/.next/cache + key: ${{ runner.os }}-nextjs-${{ hashFiles('./frontend/site/**/yarn.lock') }}-${{ hashFiles('./frontend/site/**.[jt]s', './frontend/site/**.[jt]sx') }} - uses: actions/setup-node@v3 with: - node-version-file: ./frontend/.nvmrc + node-version-file: ./frontend/site/.nvmrc cache: yarn - cache-dependency-path: ./frontend/yarn.lock + cache-dependency-path: ./frontend/site/yarn.lock - name: dependency-install run: yarn install --frozen-lockfile --immutable - name: lint diff --git a/.github/workflows/test-receiver-sender.yml b/.github/workflows/test-sender.yml similarity index 56% rename from .github/workflows/test-receiver-sender.yml rename to .github/workflows/test-sender.yml index ae9032db..d905a044 100644 --- a/.github/workflows/test-receiver-sender.yml +++ b/.github/workflows/test-sender.yml @@ -1,8 +1,8 @@ -name: WebRTC receiver and sender build test +name: WebRTC sender build test defaults: run: - working-directory: ./frontend/videoCast + working-directory: ./frontend/momo_sender on: push @@ -13,9 +13,9 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version-file: ./frontend/videoCast/.nvmrc + node-version-file: ./frontend/momo_sender/.nvmrc cache: npm - cache-dependency-path: ./frontend/videoCast/package-lock.json + cache-dependency-path: ./frontend/momo_sender/package-lock.json - name: dependency-install run: npm ci - name: build diff --git a/.github/workflows/test-testing-receiver.yml b/.github/workflows/test-testing-receiver.yml new file mode 100644 index 00000000..9e643ba8 --- /dev/null +++ b/.github/workflows/test-testing-receiver.yml @@ -0,0 +1,22 @@ +name: WebRTC receiver build test + +defaults: + run: + working-directory: ./frontend/skyway_receiver + +on: push + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version-file: ./frontend/skyway_receiver/.nvmrc + cache: npm + cache-dependency-path: ./frontend/skyway_receiver/package-lock.json + - name: dependency-install + run: npm ci + - name: build + run: npm run build diff --git a/frontend/videoCast/.gitignore b/backend/multicaster/.gitignore similarity index 50% rename from frontend/videoCast/.gitignore rename to backend/multicaster/.gitignore index 4ea14e6a..e72a96da 100644 --- a/frontend/videoCast/.gitignore +++ b/backend/multicaster/.gitignore @@ -1,131 +1,5 @@ -*_.js - -# Created by https://www.toptal.com/developers/gitignore/api/python,node -# Edit at https://www.toptal.com/developers/gitignore?templates=python,node - -### Node ### -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -lerna-debug.log* -.pnpm-debug.log* - -# Diagnostic reports (https://nodejs.org/api/report.html) -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage -*.lcov - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules/ -jspm_packages/ - -# Snowpack dependency directory (https://snowpack.dev/) -web_modules/ - -# TypeScript cache -*.tsbuildinfo - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Microbundle cache -.rpt2_cache/ -.rts2_cache_cjs/ -.rts2_cache_es/ -.rts2_cache_umd/ - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variables file -.env -.env.test -.env.production - -# parcel-bundler cache (https://parceljs.org/) -.cache -.parcel-cache - -# Next.js build output -.next -out - -# Nuxt.js build / generate output -.nuxt -dist - -# Gatsby files -.cache/ -# Comment in the public line in if your project uses Gatsby and not Next.js -# https://nextjs.org/blog/next-9-1#public-directory-support -# public - -# vuepress build output -.vuepress/dist - -# Serverless directories -.serverless/ - -# FuseBox cache -.fusebox/ - -# DynamoDB Local files -.dynamodb/ - -# TernJS port file -.tern-port - -# Stores VSCode versions used for testing VSCode extensions -.vscode-test - -# yarn v2 -.yarn/cache -.yarn/unplugged -.yarn/build-state.yml -.yarn/install-state.gz -.pnp.* - -### Node Patch ### -# Serverless Webpack directories -.webpack/ +# Created by https://www.toptal.com/developers/gitignore/api/python +# Edit at https://www.toptal.com/developers/gitignore?templates=python ### Python ### # Byte-compiled / optimized / DLL files @@ -172,6 +46,7 @@ htmlcov/ .nox/ .coverage .coverage.* +.cache nosetests.xml coverage.xml *.cover @@ -185,6 +60,7 @@ cover/ *.pot # Django stuff: +*.log local_settings.py db.sqlite3 db.sqlite3-journal @@ -222,7 +98,22 @@ ipython_config.py # install all needed dependencies. #Pipfile.lock -# PEP 582; used by e.g. github.com/David-OConnor/pyflow +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm __pypackages__/ # Celery stuff @@ -233,6 +124,7 @@ celerybeat.pid *.sage.py # Environments +.env .venv env/ venv/ @@ -264,6 +156,11 @@ dmypy.json # Cython debug symbols cython_debug/ -# End of https://www.toptal.com/developers/gitignore/api/python,node - +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ +# End of https://www.toptal.com/developers/gitignore/api/python diff --git a/frontend/videoCast/Dockerfile.python b/backend/multicaster/Dockerfile similarity index 100% rename from frontend/videoCast/Dockerfile.python rename to backend/multicaster/Dockerfile diff --git a/frontend/videoCast/one_to_multiple_cast_skyway.py b/backend/multicaster/one_to_multiple_cast_skyway.py similarity index 100% rename from frontend/videoCast/one_to_multiple_cast_skyway.py rename to backend/multicaster/one_to_multiple_cast_skyway.py diff --git a/frontend/videoCast/requirements-dev.txt b/backend/multicaster/requirements-dev.txt similarity index 100% rename from frontend/videoCast/requirements-dev.txt rename to backend/multicaster/requirements-dev.txt diff --git a/frontend/videoCast/requirements.txt b/backend/multicaster/requirements.txt similarity index 100% rename from frontend/videoCast/requirements.txt rename to backend/multicaster/requirements.txt diff --git a/docs/endpoints.md b/docs/endpoints.md index d353eac8..a4a889c9 100644 --- a/docs/endpoints.md +++ b/docs/endpoints.md @@ -9,13 +9,13 @@ - "control.chofufes2022.gotti.dev" `./backend/external`が動いています。クライアントはここにむけてwebsocketを張ってください。`/ws`にwebsocketのエンドポイントがあります。 - "chofufes2022.gotti.dev" -`./frontend`が動いています。ここにメインのページがデプロイされます。 +`./frontend/site`が動いています。ここにメインのページがデプロイされます。 - "webrtc.chofufes2022.gotti.dev" -`./frontend/videoCast/one_to_multiple_cast_skyway.py`が動いています。webrtcのピアリングを行います。 +`./backend/multicaster/one_to_multiple_cast_skyway.py`が動いています。webrtcのピアリングを行います。 - "auth.chofufes2022.gotti.dev" 認証画面です。認証が必要なページに入るには先にここを通ってください。 - "receiver-test.chofufes2022.gotti.dev" -`./frontend/videocast/skyway_receiver.html`が動いています。webrtcの受信側ページです。 +`./frontend/skyway_receiver/index.html`が動いています。webrtcの受信側ページです。 ### 認証あり @@ -26,7 +26,7 @@ prometheusというメトリクス収集ツールが動いています。基本 - "alert.chofufes2022.gotti.dev" 使おうと思いましたがやめました。 - "webrtc-sender.chofufes2022.gotti.dev" -`./frontend/videocast/momo_sender.html`が動いています。webrtcの配信者側ページです。 +`./frontend/momo_sender/index.html`が動いています。webrtcの配信者側ページです。 ## 学内 diff --git a/frontend/momo_sender/.gitignore b/frontend/momo_sender/.gitignore new file mode 100644 index 00000000..3502ef7f --- /dev/null +++ b/frontend/momo_sender/.gitignore @@ -0,0 +1,144 @@ +# Created by https://www.toptal.com/developers/gitignore/api/node +# Edit at https://www.toptal.com/developers/gitignore?templates=node + +### Node ### +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional stylelint cache +.stylelintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variable files +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# vuepress v2.x temp and cache directory +.temp + +# Docusaurus cache and generated files +.docusaurus + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* + +### Node Patch ### +# Serverless Webpack directories +.webpack/ + +# Optional stylelint cache + +# SvelteKit build / generate output +.svelte-kit + +# End of https://www.toptal.com/developers/gitignore/api/node diff --git a/frontend/videoCast/.nvmrc b/frontend/momo_sender/.nvmrc similarity index 100% rename from frontend/videoCast/.nvmrc rename to frontend/momo_sender/.nvmrc diff --git a/frontend/videoCast/.prettierignore b/frontend/momo_sender/.prettierignore similarity index 73% rename from frontend/videoCast/.prettierignore rename to frontend/momo_sender/.prettierignore index 68feca34..483a9c42 100644 --- a/frontend/videoCast/.prettierignore +++ b/frontend/momo_sender/.prettierignore @@ -1,2 +1 @@ -*_.js package-lock.json \ No newline at end of file diff --git a/frontend/videoCast/Dockerfile.sender b/frontend/momo_sender/Dockerfile similarity index 58% rename from frontend/videoCast/Dockerfile.sender rename to frontend/momo_sender/Dockerfile index 4edf8c08..991ee7b9 100644 --- a/frontend/videoCast/Dockerfile.sender +++ b/frontend/momo_sender/Dockerfile @@ -8,5 +8,5 @@ COPY *.js /app/ RUN npm run build FROM nginx:1.23.1-alpine -COPY --from=builder /app/momo_sender_.js /usr/share/nginx/html/ -COPY ./momo_sender.html /usr/share/nginx/html/index.html +COPY --from=builder /app/bundle.js /usr/share/nginx/html/ +COPY ./index.html /usr/share/nginx/html/ diff --git a/frontend/videoCast/momo_sender.html b/frontend/momo_sender/index.html similarity index 96% rename from frontend/videoCast/momo_sender.html rename to frontend/momo_sender/index.html index 94e3be90..c8df5b26 100644 --- a/frontend/videoCast/momo_sender.html +++ b/frontend/momo_sender/index.html @@ -63,6 +63,6 @@