mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-12-22 06:23:12 +00: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
|
||||
|
||||
dist
|
||||
|
||||
# Yarn 2 without zero-installs
|
||||
.yarn/*
|
||||
!.yarn/patches
|
||||
|
@ -11,4 +9,3 @@ dist
|
|||
!.yarn/plugins
|
||||
!.yarn/sdks
|
||||
!.yarn/versions
|
||||
.pnp.*
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
name: Docker
|
||||
name: Backend / Docker
|
||||
|
||||
on:
|
||||
push:
|
||||
|
@ -14,6 +14,8 @@ jobs:
|
|||
build-dev:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
|
@ -28,15 +30,16 @@ jobs:
|
|||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
push: true
|
||||
file: docker/Dockerfile
|
||||
file: backend/docker/Dockerfile
|
||||
tags: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-ci:${{ github.sha }}
|
||||
target: development
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
context: .
|
||||
|
||||
sqlite-test:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-dev]
|
||||
needs: [ build-dev ]
|
||||
container:
|
||||
image: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-ci:${{ github.sha }}
|
||||
steps:
|
||||
|
@ -44,7 +47,7 @@ jobs:
|
|||
|
||||
sqlite-e2e:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-dev]
|
||||
needs: [ build-dev ]
|
||||
container:
|
||||
image: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-ci:${{ github.sha }}
|
||||
steps:
|
||||
|
@ -52,8 +55,10 @@ jobs:
|
|||
|
||||
build-prod:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [sqlite-test, sqlite-e2e]
|
||||
needs: [ sqlite-test, sqlite-e2e ]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Generate Docker metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
|
@ -83,8 +88,9 @@ jobs:
|
|||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
file: docker/Dockerfile
|
||||
file: backend/docker/Dockerfile
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
context: .
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
name: E2E Tests
|
||||
name: Backend / E2E Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
|
@ -13,6 +13,9 @@ on:
|
|||
env:
|
||||
NODEJS_VERSION: 18
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: backend
|
||||
|
||||
jobs:
|
||||
sqlite: # This run also collects coverage
|
||||
|
@ -24,13 +27,14 @@ jobs:
|
|||
- name: Use Node.js ${{ env.NODEJS_VERSION }}
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
cache-dependency-path: backend/yarn.lock
|
||||
node-version: ${{ env.NODEJS_VERSION }}
|
||||
cache: 'yarn'
|
||||
- run: yarn install --immutable
|
||||
- run: yarn run test:e2e:cov
|
||||
- uses: codecov/codecov-action@v3
|
||||
with:
|
||||
directory: coverage-e2e
|
||||
directory: backend/coverage-e2e
|
||||
flags: e2e-tests
|
||||
|
||||
mariadb:
|
||||
|
@ -53,6 +57,7 @@ jobs:
|
|||
- name: Use Node.js ${{ env.NODEJS_VERSION }}
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
cache-dependency-path: backend/yarn.lock
|
||||
node-version: ${{ env.NODEJS_VERSION }}
|
||||
cache: 'yarn'
|
||||
- run: yarn install --immutable
|
||||
|
@ -78,6 +83,7 @@ jobs:
|
|||
- name: Use Node.js ${{ env.NODEJS_VERSION }}
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
cache-dependency-path: backend/yarn.lock
|
||||
node-version: ${{ env.NODEJS_VERSION }}
|
||||
cache: 'yarn'
|
||||
- run: yarn install --immutable
|
|
@ -3,7 +3,7 @@
|
|||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
|
||||
name: Nest.JS CI
|
||||
name: Backend / Lint and Test
|
||||
|
||||
on:
|
||||
push:
|
||||
|
@ -14,23 +14,23 @@ on:
|
|||
env:
|
||||
NODEJS_VERSION: 18
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: backend
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
command:
|
||||
- yarn run lint
|
||||
- yarn run format
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Use Node.js ${{ env.NODEJS_VERSION }}
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
cache-dependency-path: backend/yarn.lock
|
||||
node-version: ${{ env.NODEJS_VERSION }}
|
||||
cache: 'yarn'
|
||||
- run: yarn install --immutable
|
||||
- run: ${{matrix.command}}
|
||||
- run: yarn run lint
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
|
@ -41,6 +41,7 @@ jobs:
|
|||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
cache-dependency-path: backend/yarn.lock
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: 'yarn'
|
||||
- run: yarn install --immutable
|
||||
|
@ -55,11 +56,12 @@ jobs:
|
|||
- name: Use Node.js ${{ env.NODEJS_VERSION }}
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
cache-dependency-path: backend/yarn.lock
|
||||
node-version: ${{ env.NODEJS_VERSION }}
|
||||
cache: 'yarn'
|
||||
- run: yarn install --immutable
|
||||
- run: yarn run test:cov
|
||||
- uses: codecov/codecov-action@v3
|
||||
with:
|
||||
directory: coverage
|
||||
directory: backend/coverage
|
||||
flags: integration-tests
|
4
.github/workflows/reuse.yml
vendored
4
.github/workflows/reuse.yml
vendored
|
@ -6,9 +6,9 @@ name: REUSE Compliance Check
|
|||
|
||||
on:
|
||||
push:
|
||||
branches: [develop]
|
||||
branches: [ develop ]
|
||||
pull_request:
|
||||
branches: [develop]
|
||||
branches: [ develop ]
|
||||
|
||||
jobs:
|
||||
reuse:
|
||||
|
|
26
.gitignore
vendored
26
.gitignore
vendored
|
@ -21,32 +21,8 @@ backups/
|
|||
*.log
|
||||
*.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/*
|
||||
.yarn
|
||||
!.yarn/patches
|
||||
!.yarn/releases
|
||||
!.yarn/plugins
|
||||
|
|
|
@ -63,6 +63,6 @@ Files: docs/content/theme/styles/Roboto/*
|
|||
Copyright: 2011 Christian Robertson
|
||||
License: Apache-2.0
|
||||
|
||||
Files: public/*.md
|
||||
Files: backend/public/*.md
|
||||
Copyright: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
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
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
COPY --chown=node .yarn .yarn
|
||||
COPY --chown=node package.json yarn.lock .yarnrc.yml ./
|
||||
COPY --chown=node .yarn ../.yarn
|
||||
COPY --chown=node backend/package.json backend/yarn.lock backend/.yarnrc.yml ./
|
||||
|
||||
|
||||
## 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 \
|
||||
YARN_CACHE_FOLDER=/tmp/.yarn yarn install --immutable
|
||||
|
||||
COPY --chown=node nest-cli.json tsconfig.json tsconfig.build.json ./
|
||||
COPY --chown=node src src
|
||||
COPY --chown=node backend/nest-cli.json backend/tsconfig.json backend/tsconfig.build.json ./
|
||||
COPY --chown=node backend/src src
|
||||
|
||||
|
||||
## Stage 2a: Dev config files and tests
|
||||
|
@ -41,8 +41,8 @@ FROM code-with-deps as development
|
|||
USER node
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
COPY --chown=node .eslintrc.js eslint-local-rules.js .prettierrc jest-e2e.json ./
|
||||
COPY --chown=node test test
|
||||
COPY --chown=node backend/.eslintrc.js backend/eslint-local-rules.js backend/.prettierrc backend/jest-e2e.json ./
|
||||
COPY --chown=node backend/test test
|
||||
|
||||
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!
|
||||
|
||||
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.
|
||||
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:
|
||||
`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
|
||||
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:
|
||||
`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