Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mucsi96 committed Aug 17, 2024
1 parent 03f3a32 commit 163d4c3
Show file tree
Hide file tree
Showing 80 changed files with 18,160 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Editor configuration, see https://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.ts]
quote_type = single

[*.md]
max_line_length = off
trim_trailing_whitespace = false
14 changes: 14 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"dependencyDashboard": true,
"groupName": "all dependencies",
"groupSlug": "all",
"packageRules": [
{
"groupName": "all dependencies",
"groupSlug": "all",
"matchPackagePatterns": ["*"]
}
],
"labels": ["dependencies"]
}
62 changes: 62 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Pipeline

on:
push:
branches:
- main
pull_request:

concurrency:
group: any
cancel-in-progress: true

jobs:
test-e2e:
env:
MAVEN_OPTS: -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: npm
cache-dependency-path: client/package-lock.json
- uses: ankane/setup-postgres@v1
with:
postgres-version: 16
- name: Check pg_dump version
run: pg_dump --version
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: maven
cache-dependency-path: server/pom.xml
- working-directory: client
run: npm ci
- working-directory: client
run: npm run build
- name: Install Chromium with dependencies for Playwright
working-directory: server
run: mvn test-compile exec:java -B -e -D exec.classpathScope=test -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install --with-deps chromium"
- working-directory: server
run: mvn test -B
build-images:
runs-on: ubuntu-latest
needs: test-e2e
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: 3.12
cache: "pip"
- run: pip install -r requirements.txt

- run: python scripts/build_docker_image.py "${{ secrets.GITHUB_TOKEN }}" "${{ secrets.ANSIBLE_VAULT_KEY }}"
24 changes: 24 additions & 0 deletions .github/workflows/update_dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Update dependencies

on:
schedule:
- cron: '7 0 * * 1'

concurrency:
group: any
cancel-in-progress: true

jobs:
update-dependencies:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write # Requires also "Allow GitHub Actions to create and approve pull requests" to be enabled in the repository settings
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
- env:
LOG_LEVEL: debug
run: npx renovate --token ${{ secrets.GITHUB_TOKEN }} --platform github --autodiscover
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.env

target

screenshots

.ansible/

node_modules

dist
.DS_Store
4 changes: 4 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
"recommendations": ["angular.ng-template"]
}
382 changes: 382 additions & 0 deletions .vscode/java-formatter.xml

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"configurations": [
{
"type": "java",
"name": "Spring Boot-App<postgres-backup-tool>",
"request": "launch",
"cwd": "${workspaceFolder}/server",
"mainClass": "io.github.mucsi96.postgresbackuptool.App",
"projectName": "postgres-backup-tool",
"args": ""
}
]
}
29 changes: 29 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"maven.terminal.favorites": [
{
"command": "spring-boot:run",
"debug": false,
}
],
"java.format.enabled": true,
"[java]": {
"editor.tabSize": 2
},
"java.format.settings.url": ".vscode/java-formatter.xml",
"java.compile.nullAnalysis.mode": "disabled",
"sqltools.connections": [
{
"previewLimit": 50,
"server": "db",
"port": 5432,
"driver": "PostgreSQL",
"name": "local",
"database": "postgres-backup-tool",
"username": "postgres",
"password": "postgres"
}
],
"python.analysis.typeCheckingMode": "basic",
"python.analysis.autoImportCompletions": true,
"java.configuration.updateBuildConfiguration": "interactive"
}
105 changes: 105 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{
"version": "2.0.0",
"osx": {
"options": {
"shell": {
"executable": "${env:SHELL}",
"args": ["--login", "--interactive", "-c"]
}
}
},
"tasks": [
{
"type": "shell",
"command": "bash",
"label": "Install dependencies",
"args": ["scripts/install_dependencies.sh"],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": []
},
{
"type": "shell",
"label": "Build client",
"command": "npm run build",
"isBackground": true,
"options": {
"cwd": "${workspaceFolder}/client"
},
"problemMatcher": []
},
{
"type": "shell",
"label": "Build server",
"command": "mvn clean install -DskipTests",
"isBackground": true,
"options": {
"cwd": "${workspaceFolder}/server"
},
"problemMatcher": []
},
{
"type": "shell",
"label": "Start client",
"command": "npm start",
"options": {
"cwd": "${workspaceFolder}/client"
},
"problemMatcher": []
},
{
"type": "shell",
"label": "Start server",
"command": "mvn spring-boot:run",
"isBackground": true,
"options": {
"cwd": "${workspaceFolder}/server"
},
"problemMatcher": []
},
{
"type": "shell",
"label": "Test e2e",
"command": "mvn test",
"isBackground": true,
"options": {
"cwd": "${workspaceFolder}/server"
},
"problemMatcher": []
},
{
"type": "shell",
"label": "Compose up",
"command": "node docker-compose.js | docker compose --file - up --build --force-recreate --wait --remove-orphans --pull always",
"problemMatcher": []
},
{
"type": "shell",
"label": "Compose down",
"command": "node docker-compose.js | docker compose --file - down",
"problemMatcher": []
},
{
"type": "shell",
"command": "ansible-vault encrypt vars/vault.yaml --vault-password-file .ansible/vault_key",
"isBackground": true,
"label": "Encrypt vault",
"problemMatcher": []
},
{
"type": "shell",
"command": "ansible-vault decrypt vars/vault.yaml --vault-password-file .ansible/vault_key",
"isBackground": true,
"label": "Decrypt vault",
"problemMatcher": []
},
{
"type": "shell",
"command": "ansible-vault view vars/vault.yaml --vault-password-file .ansible/vault_key",
"isBackground": true,
"label": "view vault",
"problemMatcher": []
}
]
}
36 changes: 36 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM maven:3-eclipse-temurin-21 AS build-server

WORKDIR /workspace/server

COPY server/pom.xml ./
COPY server .

RUN mvn package -DskipTests -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
RUN mkdir -p target/dependency && (cd target/dependency; jar -xf ../*.jar)

FROM node:22 AS build-client

WORKDIR /workspace/client

COPY client/package*.json ./
RUN npm install

COPY client .
RUN npm run build

FROM bellsoft/liberica-openjre-alpine-musl:22

VOLUME /tmp

ARG DEPENDENCY=/workspace/server/target/dependency

RUN apk add postgresql15-client

COPY --from=build-server ${DEPENDENCY}/BOOT-INF/lib /app/lib
COPY --from=build-server ${DEPENDENCY}/META-INF /app/META-INF
COPY --from=build-server ${DEPENDENCY}/BOOT-INF/classes /app
COPY --from=build-client /workspace/client/dist/index.html /app/templates/index.html
COPY --from=build-client /workspace/client/dist /app/static
RUN rm /app/static/index.html /app/static/mockServiceWorker.js

ENTRYPOINT ["java", "-cp", "app:app/lib/*", "-Dspring.profiles.active=prod", "io.github.mucsi96.postgresbackuptool.App"]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Igor Bari

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit 163d4c3

Please sign in to comment.