Skip to content

Commit

Permalink
ci: add initial pipeline (#5)
Browse files Browse the repository at this point in the history
* ci: add first pass docker scripts

* ci: add volumes and more configuration for docker containers

* chore: docker compose tweaks

* ci: add ci.yml file

* chore: pass java version into build step title

---------

Co-authored-by: steve <[email protected]>

chore: enable dependabot.yml (#10)

* chore: enable dependabot.yml

* chore: add maven to package-ecosystem value

chore: bump com.google.guava:guava in the maven group across 1 directory (#8)

Bumps the maven group with 1 update in the / directory: [com.google.guava:guava](https://github.com/google/guava).

Updates `com.google.guava:guava` from 31.1-jre to 32.0.0-jre
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

---
updated-dependencies:
- dependency-name: com.google.guava:guava
  dependency-type: direct:production
  dependency-group: maven
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Bump org.modelmapper:modelmapper from 3.1.0 to 3.2.1 (#11)

Bumps [org.modelmapper:modelmapper](https://github.com/modelmapper/modelmapper) from 3.1.0 to 3.2.1.
- [Changelog](https://github.com/modelmapper/modelmapper/blob/master/CHANGES.md)
- [Commits](modelmapper/modelmapper@modelmapper-parent-3.1.0...modelmapper-parent-3.2.1)

---
updated-dependencies:
- dependency-name: org.modelmapper:modelmapper
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

chore: bump org.apache.commons:commons-lang3 from 3.12.0 to 3.17.0 (#12)

Bumps org.apache.commons:commons-lang3 from 3.12.0 to 3.17.0.

---
updated-dependencies:
- dependency-name: org.apache.commons:commons-lang3
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

chore: bump org.springframework.boot:spring-boot-starter-parent (#14)

Bumps [org.springframework.boot:spring-boot-starter-parent](https://github.com/spring-projects/spring-boot) from 3.3.2-SNAPSHOT to 3.4.0-M3.
- [Release notes](https://github.com/spring-projects/spring-boot/releases)
- [Commits](https://github.com/spring-projects/spring-boot/commits/v3.4.0-M3)

---
updated-dependencies:
- dependency-name: org.springframework.boot:spring-boot-starter-parent
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

chore: bump com.google.guava:guava from 31.1-jre to 33.3.1-jre (#13)

Bumps [com.google.guava:guava](https://github.com/google/guava) from 31.1-jre to 33.3.1-jre.
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

---
updated-dependencies:
- dependency-name: com.google.guava:guava
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

add user profile (#15)

update tables for thread, board and poll (#16)

add file attachments and user avatars (#17)

add user permission tables and a couple of other table updates (#22)

lots of thread and user updates (#23)

adds latest message loading for threads (#24)

add pagination support to boards (#25)

* add pagination support to boards

* fix required page no issue

refactors forum endpoints a bit (#26)

adds child board meta data (#31)

chore: bump org.springframework.boot:spring-boot-starter-parent (#30)

Bumps [org.springframework.boot:spring-boot-starter-parent](https://github.com/spring-projects/spring-boot) from 3.4.0-M3 to 3.4.0-RC1.
- [Release notes](https://github.com/spring-projects/spring-boot/releases)
- [Commits](spring-projects/spring-boot@v3.4.0-M3...v3.4.0-RC1)

---
updated-dependencies:
- dependency-name: org.springframework.boot:spring-boot-starter-parent
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

clean up dataprovider for categories (#33)

add banner.txt
set version to 1.0.0

initial bbcode configs (#34)

chore: configure vscode settings

feat(backend): add db provisioning script
doc: update readme with docker info

chore: make ports into variables
docs: add example of how to just run the db

chore: move scripts into provisioning subfolder

chore: move env settings around

chore: add lf for .sh files in gitattributes

chore: clean up initialize database script

chore: sync

chore: adjust path

feat(iac): add initial images for bootstrapping host
fix(db): add fixes from steve for provision db
  • Loading branch information
gm112 committed Dec 9, 2024
1 parent 011801c commit dc37adc
Show file tree
Hide file tree
Showing 243 changed files with 32,336 additions and 21,096 deletions.
13 changes: 13 additions & 0 deletions .env.docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
POSTGRES_USER=postgres
POSTGRES_PASSWORD=123456
ZFGBB_DATABASE=zfgc_dev
ZFGBB_USER=zfgbb_user
ZFGBB_USER_PASSWORD=123456

SPRING_DATASOURCE_URL=jdbc:postgresql://host.docker.internal:5432/zfgc_dev
SPRING_DATASOURCE_USERNAME=zfgbb_user
SPRING_DATASOURCE_PASSWORD=123456

mbg_jdbc_url=jdbc:postgresql://host.docker.internal:5432/zfgc_dev
mbg_jdbc_username=zfgbb_user
mbg_jdbc_password=123456
13 changes: 13 additions & 0 deletions .env.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
POSTGRES_USER=postgres
POSTGRES_PASSWORD=123456
ZFGBB_DATABASE=zfgc_dev
ZFGBB_USER=zfgbb_user
ZFGBB_USER_PASSWORD=123456

SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/zfgc_dev
SPRING_DATASOURCE_USERNAME=zfgbb_user
SPRING_DATASOURCE_PASSWORD=123456

mbg_jdbc_url=jdbc:postgresql://localhost:5432/zfgc_dev
mbg_jdbc_username=zfgbb_user
mbg_jdbc_password=123456
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.sh text eol=lf
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "maven" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: CI
on:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java-version: [17]
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java-version}} for x64
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java-version }}
distribution: 'temurin'
architecture: x64
cache: maven
- name: Build with Maven
run: mvn clean compile package -Dmaven.test.skip=true
64 changes: 31 additions & 33 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
.env
4 changes: 2 additions & 2 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"vscjava.vscode-java-pack"
]
}
16 changes: 16 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Debug Backend",
"request": "launch",
"mainClass": "com.zfgc.zfgbb.ZfgbbApplication",
"projectName": "zfgbb",
"envFile": "${workspaceFolder}/.env.local"
}
]
}
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"java.configuration.updateBuildConfiguration": "interactive",
"java.compile.nullAnalysis.mode": "automatic"
}
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM maven:3.9-eclipse-temurin-17 AS build

RUN mkdir -p /usr/src/zfgbb
ADD . /usr/src/zfgbb

WORKDIR /usr/src/zfgbb

RUN mvn clean compile package -Dmaven.test.skip=true

# FIXME: This image should be switched to gcr.io/distroless/java-base-debian12 because it is much smaller. For now, this will work.
FROM tomcat:jre17-temurin-jammy AS deploy

COPY --from=build /usr/src/zfgbb/target/*.war /usr/local/tomcat/webapps/

EXPOSE ${ZFGBB_BACKEND_PORT:-8080}

CMD ["catalina.sh", "run"]

FROM postgres:16 AS database

ADD ./scripts/sql/provisioning/1-zfgbb.initialize-database.sh /docker-entrypoint-initdb.d/1-zfgbb.initialize-database.sh

# We exclude .sql from the file name so that it gets ignored by the init script.
ADD ./scripts/sql/provisioning/2-provision-database.sql /docker-entrypoint-initdb.d/2-provision-database
42 changes: 21 additions & 21 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
MIT License

Copyright (c) 2022 ZFGC

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.
MIT License
Copyright (c) 2022 ZFGC
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.
90 changes: 88 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,88 @@
Java 17
maven clean install -Dmaven.test.skip=true
# ZFGBB Backend

Bringin back the Drama Llama from the dead!

[![CI](https://github.com/ZFGCCP/ZFGCBB/actions/workflows/ci.yml/badge.svg)](https://github.com/ZFGCCP/ZFGCBB/actions/workflows/ci.yml)

## Table of Contents

- [ZFGBB Backend](#zfgbb-backend)
- [Table of Contents](#table-of-contents)
- [Getting Started](#getting-started)
- [Prerequisites](#prerequisites)
- [Docker](#docker)
- [Standing up just the database](#standing-up-just-the-database)
- [Developing](#developing)
- [Building](#building)
- [Running Tests](#running-tests)
- [Running MyBatis Generator](#running-mybatis-generator)
- [License](#license)

## Getting Started

### Prerequisites

- [Docker/Docker-Compose](https://docs.docker.com/get-docker/)
- [Java 17](https://www.oracle.com/java/technologies/downloads/)
- [Maven](https://maven.apache.org/download.cgi)
- If running locally
- [PostgreSQL](https://www.postgresql.org/download/)
- [Tomcat](https://tomcat.apache.org/download-90.cgi)

#### Docker

Copy the `.env.example` file to `.env` and fill in the values, then run docker compose to start the containers.

```bash
cp .env.example .env
docker compose up -d
```

#### Standing up just the database

```bash
docker compuse up -d postgresql
```

### Developing

To run the application in development mode, run the following command:

```bash
mvn clean run package -Dmaven.test.skip=true
```

This will start the application in development mode, and you can access it at `http://localhost:8080`.

### Building

To build the application, run the following command:

```bash
mvn clean compile package -Dmaven.test.skip=true
```

This will create a `.war` file in the `target` directory.

### Running Tests

To run the tests, run the following command:

```bash
mvn test
```

This will run all the tests in the [src/test](src/test) directory.

### Running MyBatis Generator

To run the MyBatis generator, run the following command:

```bash
```

This will generate the MyBatis mappers and Java models based on the database schema.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
Binary file added backend-assets/img/logos/midnight-mobile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added backend-assets/img/logos/midnight-mobile.psd
Binary file not shown.
Binary file added backend-assets/img/member-badges/star.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added backend-assets/img/member-badges/staradmin.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
services:
postgresql:
container_name: zfgbb_postgresql
hostname: zfgbb_postgresql
build:
context: .
dockerfile: Dockerfile
target: database
env_file:
- .env.docker
ports:
- "${POSTGRES_PORT:-5432}:${POSTGRES_PORT:-5432}"
volumes:
- data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "sh -c 'pg_isready -U ${POSTGRES_USER:-postgres} -d ${ZFGBB_DATABASE:-zfgc_dev}'"]
interval: 30s
timeout: 60s
retries: 5
start_period: 80s

zfgbb:
container_name: zfgbb
hostname: zfgbb
build:
context: .
dockerfile: Dockerfile
target: deploy
ports:
- "${ZFGBB_BACKEND_PORT:-8080}:${ZFGBB_BACKEND_PORT:-8080}"
volumes:
- logs:/usr/src/app/logs
env_file:
- .env.docker
depends_on:
- postgresql

volumes:
data:
logs:

# Add docker config option
7 changes: 7 additions & 0 deletions iac/zfgc.com/docker/host/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM ubuntu:noble as zfgc-com-host

COPY ./scripts/setup-docker.sh /tmp/setup-docker.sh

RUN /tmp/setup-docker.sh && \
apt-get prune -y && \
rm /tmp/setup-docker.sh
Loading

0 comments on commit dc37adc

Please sign in to comment.