mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-21 17:26:29 -05:00
fix(repository): Move backend code into subdirectory
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
86584e705f
commit
bf30cbcf48
272 changed files with 87 additions and 67 deletions
|
@ -2,8 +2,6 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: CC0-1.0
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
dist
|
|
||||||
|
|
||||||
# Yarn 2 without zero-installs
|
# Yarn 2 without zero-installs
|
||||||
.yarn/*
|
.yarn/*
|
||||||
!.yarn/patches
|
!.yarn/patches
|
||||||
|
@ -11,4 +9,3 @@ dist
|
||||||
!.yarn/plugins
|
!.yarn/plugins
|
||||||
!.yarn/sdks
|
!.yarn/sdks
|
||||||
!.yarn/versions
|
!.yarn/versions
|
||||||
.pnp.*
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
name: Docker
|
name: Backend / Docker
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
@ -14,6 +14,8 @@ jobs:
|
||||||
build-dev:
|
build-dev:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
@ -28,15 +30,16 @@ jobs:
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
push: true
|
push: true
|
||||||
file: docker/Dockerfile
|
file: backend/docker/Dockerfile
|
||||||
tags: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-ci:${{ github.sha }}
|
tags: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-ci:${{ github.sha }}
|
||||||
target: development
|
target: development
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
context: .
|
||||||
|
|
||||||
sqlite-test:
|
sqlite-test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [build-dev]
|
needs: [ build-dev ]
|
||||||
container:
|
container:
|
||||||
image: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-ci:${{ github.sha }}
|
image: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-ci:${{ github.sha }}
|
||||||
steps:
|
steps:
|
||||||
|
@ -44,7 +47,7 @@ jobs:
|
||||||
|
|
||||||
sqlite-e2e:
|
sqlite-e2e:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [build-dev]
|
needs: [ build-dev ]
|
||||||
container:
|
container:
|
||||||
image: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-ci:${{ github.sha }}
|
image: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-ci:${{ github.sha }}
|
||||||
steps:
|
steps:
|
||||||
|
@ -52,8 +55,10 @@ jobs:
|
||||||
|
|
||||||
build-prod:
|
build-prod:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [sqlite-test, sqlite-e2e]
|
needs: [ sqlite-test, sqlite-e2e ]
|
||||||
steps:
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Generate Docker metadata
|
- name: Generate Docker metadata
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v4
|
uses: docker/metadata-action@v4
|
||||||
|
@ -83,8 +88,9 @@ jobs:
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
file: docker/Dockerfile
|
file: backend/docker/Dockerfile
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
context: .
|
|
@ -2,7 +2,7 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
name: E2E Tests
|
name: Backend / E2E Tests
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
@ -13,6 +13,9 @@ on:
|
||||||
env:
|
env:
|
||||||
NODEJS_VERSION: 18
|
NODEJS_VERSION: 18
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: backend
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
sqlite: # This run also collects coverage
|
sqlite: # This run also collects coverage
|
||||||
|
@ -24,13 +27,14 @@ jobs:
|
||||||
- name: Use Node.js ${{ env.NODEJS_VERSION }}
|
- name: Use Node.js ${{ env.NODEJS_VERSION }}
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
|
cache-dependency-path: backend/yarn.lock
|
||||||
node-version: ${{ env.NODEJS_VERSION }}
|
node-version: ${{ env.NODEJS_VERSION }}
|
||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
- run: yarn install --immutable
|
- run: yarn install --immutable
|
||||||
- run: yarn run test:e2e:cov
|
- run: yarn run test:e2e:cov
|
||||||
- uses: codecov/codecov-action@v3
|
- uses: codecov/codecov-action@v3
|
||||||
with:
|
with:
|
||||||
directory: coverage-e2e
|
directory: backend/coverage-e2e
|
||||||
flags: e2e-tests
|
flags: e2e-tests
|
||||||
|
|
||||||
mariadb:
|
mariadb:
|
||||||
|
@ -53,6 +57,7 @@ jobs:
|
||||||
- name: Use Node.js ${{ env.NODEJS_VERSION }}
|
- name: Use Node.js ${{ env.NODEJS_VERSION }}
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
|
cache-dependency-path: backend/yarn.lock
|
||||||
node-version: ${{ env.NODEJS_VERSION }}
|
node-version: ${{ env.NODEJS_VERSION }}
|
||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
- run: yarn install --immutable
|
- run: yarn install --immutable
|
||||||
|
@ -78,6 +83,7 @@ jobs:
|
||||||
- name: Use Node.js ${{ env.NODEJS_VERSION }}
|
- name: Use Node.js ${{ env.NODEJS_VERSION }}
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
|
cache-dependency-path: backend/yarn.lock
|
||||||
node-version: ${{ env.NODEJS_VERSION }}
|
node-version: ${{ env.NODEJS_VERSION }}
|
||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
- run: yarn install --immutable
|
- run: yarn install --immutable
|
|
@ -3,7 +3,7 @@
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
|
|
||||||
name: Nest.JS CI
|
name: Backend / Lint and Test
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
@ -14,23 +14,23 @@ on:
|
||||||
env:
|
env:
|
||||||
NODEJS_VERSION: 18
|
NODEJS_VERSION: 18
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: backend
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
command:
|
|
||||||
- yarn run lint
|
|
||||||
- yarn run format
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Use Node.js ${{ env.NODEJS_VERSION }}
|
- name: Use Node.js ${{ env.NODEJS_VERSION }}
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
|
cache-dependency-path: backend/yarn.lock
|
||||||
node-version: ${{ env.NODEJS_VERSION }}
|
node-version: ${{ env.NODEJS_VERSION }}
|
||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
- run: yarn install --immutable
|
- run: yarn install --immutable
|
||||||
- run: ${{matrix.command}}
|
- run: yarn run lint
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
|
@ -41,6 +41,7 @@ jobs:
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
|
cache-dependency-path: backend/yarn.lock
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
- run: yarn install --immutable
|
- run: yarn install --immutable
|
||||||
|
@ -55,11 +56,12 @@ jobs:
|
||||||
- name: Use Node.js ${{ env.NODEJS_VERSION }}
|
- name: Use Node.js ${{ env.NODEJS_VERSION }}
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
|
cache-dependency-path: backend/yarn.lock
|
||||||
node-version: ${{ env.NODEJS_VERSION }}
|
node-version: ${{ env.NODEJS_VERSION }}
|
||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
- run: yarn install --immutable
|
- run: yarn install --immutable
|
||||||
- run: yarn run test:cov
|
- run: yarn run test:cov
|
||||||
- uses: codecov/codecov-action@v3
|
- uses: codecov/codecov-action@v3
|
||||||
with:
|
with:
|
||||||
directory: coverage
|
directory: backend/coverage
|
||||||
flags: integration-tests
|
flags: integration-tests
|
4
.github/workflows/reuse.yml
vendored
4
.github/workflows/reuse.yml
vendored
|
@ -6,9 +6,9 @@ name: REUSE Compliance Check
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [develop]
|
branches: [ develop ]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [develop]
|
branches: [ develop ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
reuse:
|
reuse:
|
||||||
|
|
26
.gitignore
vendored
26
.gitignore
vendored
|
@ -21,32 +21,8 @@ backups/
|
||||||
*.log
|
*.log
|
||||||
*.sqlite
|
*.sqlite
|
||||||
|
|
||||||
# ignore config files
|
|
||||||
config.json
|
|
||||||
.sequelizerc
|
|
||||||
.env
|
|
||||||
|
|
||||||
# ignore webpack build
|
|
||||||
public/build
|
|
||||||
public/views/build
|
|
||||||
|
|
||||||
# ignore TypeScript built
|
|
||||||
built/
|
|
||||||
dist
|
|
||||||
|
|
||||||
# Tests
|
|
||||||
/coverage
|
|
||||||
/coverage-e2e
|
|
||||||
/.nyc_output
|
|
||||||
|
|
||||||
public/uploads/*
|
|
||||||
!public/uploads/.gitkeep
|
|
||||||
!public/.gitkeep
|
|
||||||
uploads
|
|
||||||
test_uploads
|
|
||||||
|
|
||||||
# Yarn 2 without zero-installs
|
# Yarn 2 without zero-installs
|
||||||
.yarn/*
|
.yarn
|
||||||
!.yarn/patches
|
!.yarn/patches
|
||||||
!.yarn/releases
|
!.yarn/releases
|
||||||
!.yarn/plugins
|
!.yarn/plugins
|
||||||
|
|
|
@ -63,6 +63,6 @@ Files: docs/content/theme/styles/Roboto/*
|
||||||
Copyright: 2011 Christian Robertson
|
Copyright: 2011 Christian Robertson
|
||||||
License: Apache-2.0
|
License: Apache-2.0
|
||||||
|
|
||||||
Files: public/*.md
|
Files: backend/public/*.md
|
||||||
Copyright: 2021 The HedgeDoc developers (see AUTHORS file)
|
Copyright: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||||
License: CC0-1.0
|
License: CC0-1.0
|
||||||
|
|
11
.yarnrc.yml
11
.yarnrc.yml
|
@ -1,11 +0,0 @@
|
||||||
nodeLinker: node-modules
|
|
||||||
|
|
||||||
plugins:
|
|
||||||
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
|
|
||||||
spec: "@yarnpkg/plugin-interactive-tools"
|
|
||||||
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
|
|
||||||
spec: "@yarnpkg/plugin-typescript"
|
|
||||||
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
|
|
||||||
spec: "@yarnpkg/plugin-workspace-tools"
|
|
||||||
|
|
||||||
yarnPath: .yarn/releases/yarn-3.2.4.cjs
|
|
6
backend/.dockerignore
Normal file
6
backend/.dockerignore
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
# SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
|
dist
|
||||||
|
.pnp.*
|
27
backend/.gitignore
vendored
Normal file
27
backend/.gitignore
vendored
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
|
# ignore config files
|
||||||
|
config.json
|
||||||
|
.sequelizerc
|
||||||
|
.env
|
||||||
|
|
||||||
|
# ignore webpack build
|
||||||
|
public/build
|
||||||
|
public/views/build
|
||||||
|
|
||||||
|
# ignore TypeScript built
|
||||||
|
built/
|
||||||
|
dist
|
||||||
|
|
||||||
|
# Tests
|
||||||
|
coverage
|
||||||
|
coverage-e2e
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
public/uploads/*
|
||||||
|
!public/uploads/.gitkeep
|
||||||
|
!public/.gitkeep
|
||||||
|
uploads
|
||||||
|
test_uploads
|
11
backend/.yarnrc.yml
Normal file
11
backend/.yarnrc.yml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
nodeLinker: node-modules
|
||||||
|
|
||||||
|
plugins:
|
||||||
|
- path: ../.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
|
||||||
|
spec: "@yarnpkg/plugin-interactive-tools"
|
||||||
|
- path: ../.yarn/plugins/@yarnpkg/plugin-typescript.cjs
|
||||||
|
spec: "@yarnpkg/plugin-typescript"
|
||||||
|
- path: ../.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
|
||||||
|
spec: "@yarnpkg/plugin-workspace-tools"
|
||||||
|
|
||||||
|
yarnPath: ../.yarn/releases/yarn-3.2.4.cjs
|
|
@ -19,8 +19,8 @@ ENTRYPOINT ["tini"]
|
||||||
USER node
|
USER node
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
COPY --chown=node .yarn .yarn
|
COPY --chown=node .yarn ../.yarn
|
||||||
COPY --chown=node package.json yarn.lock .yarnrc.yml ./
|
COPY --chown=node backend/package.json backend/yarn.lock backend/.yarnrc.yml ./
|
||||||
|
|
||||||
|
|
||||||
## Stage 1: Code with all dependencies
|
## Stage 1: Code with all dependencies
|
||||||
|
@ -32,8 +32,8 @@ WORKDIR /usr/src/app
|
||||||
RUN --mount=type=cache,sharing=locked,uid=1000,gid=1000,target=/tmp/.yarn \
|
RUN --mount=type=cache,sharing=locked,uid=1000,gid=1000,target=/tmp/.yarn \
|
||||||
YARN_CACHE_FOLDER=/tmp/.yarn yarn install --immutable
|
YARN_CACHE_FOLDER=/tmp/.yarn yarn install --immutable
|
||||||
|
|
||||||
COPY --chown=node nest-cli.json tsconfig.json tsconfig.build.json ./
|
COPY --chown=node backend/nest-cli.json backend/tsconfig.json backend/tsconfig.build.json ./
|
||||||
COPY --chown=node src src
|
COPY --chown=node backend/src src
|
||||||
|
|
||||||
|
|
||||||
## Stage 2a: Dev config files and tests
|
## Stage 2a: Dev config files and tests
|
||||||
|
@ -41,8 +41,8 @@ FROM code-with-deps as development
|
||||||
USER node
|
USER node
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
COPY --chown=node .eslintrc.js eslint-local-rules.js .prettierrc jest-e2e.json ./
|
COPY --chown=node backend/.eslintrc.js backend/eslint-local-rules.js backend/.prettierrc backend/jest-e2e.json ./
|
||||||
COPY --chown=node test test
|
COPY --chown=node backend/test test
|
||||||
|
|
||||||
CMD ["node", "-r", "ts-node/register", "src/main.ts"]
|
CMD ["node", "-r", "ts-node/register", "src/main.ts"]
|
||||||
|
|
|
@ -16,17 +16,17 @@ It uses features which are only available in BuildKit - see https://docs.docker.
|
||||||
**Note:** This does not include any frontend!
|
**Note:** This does not include any frontend!
|
||||||
|
|
||||||
To build a production image, run the following command *from the root of the repository*:
|
To build a production image, run the following command *from the root of the repository*:
|
||||||
`docker build -t hedgedoc-prod -f docker/Dockerfile .`
|
`docker buildx build -t hedgedoc-prod -f backend/docker/Dockerfile .`
|
||||||
|
|
||||||
When you run the image, you need to provide environment variables to configure HedgeDoc.
|
When you run the image, you need to provide environment variables to configure HedgeDoc.
|
||||||
See [the config docs](../docs/content/config/index.md) for more information.
|
See [the config docs](../../docs/content/config/index.md) for more information.
|
||||||
This example starts HedgeDoc on localhost, with non-persistent storage:
|
This example starts HedgeDoc on localhost, with non-persistent storage:
|
||||||
`docker run -e HD_DOMAIN=http://localhost -e HD_MEDIA_BACKEND=filesystem -e HD_MEDIA_BACKEND_FILESYSTEM_UPLOAD_PATH=uploads -e HD_DATABASE_TYPE=sqlite -e HD_DATABASE_NAME=hedgedoc.sqlite -e HD_SESSION_SECRET=foobar -e HD_LOGLEVEL=debug -p 3000:3000 hedgedoc-prod`
|
`docker run -e HD_DOMAIN=http://localhost -e HD_MEDIA_BACKEND=filesystem -e HD_MEDIA_BACKEND_FILESYSTEM_UPLOAD_PATH=uploads -e HD_DATABASE_TYPE=sqlite -e HD_DATABASE_NAME=hedgedoc.sqlite -e HD_SESSION_SECRET=foobar -e HD_LOGLEVEL=debug -p 3000:3000 hedgedoc-prod`
|
||||||
|
|
||||||
|
|
||||||
## Build a development image
|
## Build a development image
|
||||||
You can build a development image using the `development` target:
|
You can build a development image using the `development` target:
|
||||||
`docker build -t hedgedoc-dev -f docker/Dockerfile --target development .`
|
`docker buildx build -t hedgedoc-dev -f backend/docker/Dockerfile --target development .`
|
||||||
|
|
||||||
You can then, e.g. run tests inside the image:
|
You can then, e.g. run tests inside the image:
|
||||||
`docker run hedgedoc-dev yarn run test:e2e`
|
`docker run hedgedoc-dev yarn run test:e2e`
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue