pse-podcast-synchronisation/pse-server/README.md

151 lines
3.7 KiB
Markdown
Raw Permalink Normal View History

2024-06-19 00:14:49 +02:00
# Podcast Synchronisation made Efficient Server
> Gpodder Server written in Java Spring Boot
## About
The aim of this software project is to provide a synchronization server for
podcasts that is to be used by so-called podcatchers and that is as lean and
efficient as possible compared to other synchronizations Server.
## Getting Started
## Pre requirements
- MariaDB-Server 10.6
- Java JDK 17
### MariaDB
Start the MariaDB Server and login as root to manage the databases.
```sh
$ sudo systemctl start mariadb # start mariadb
$ sudo mariadb --password # log in as root
```
Create Database and User.
```sql
create database demo; -- Creates the new database
create user 'pse'@'localhost' identified by 'PSEsq1702!mdb'; -- Creates the user
grant all on demo.* to 'pse'@'localhost'; -- Gives all privileges to the new user on the newly created database
```
### Spring Boot
Compile and run the Spring Boot Project
```sh
$ mvn spring-boot:run
```
Compile to JAR for production
```sh
$ mvn package -B -DskipTests
```
Execute jar
```
$ java -jar target/server.jar
```
### Configuration
You can configuration by editing the files under `src/main/resources/`.
```
src/main/resources
├── application.properties # main config file
├── PasswordResetMail.txt # Mail text for reseting password
├── security.properties # keys for signing cookies/links
└── VerificationMail.txt # Mail text for verifying account
```
All configurations in the application.properties can also be set using
environment variables by putting all letters of the setting to uppercase and
replacing any non-word character to an underscore.
```
application.properties
----------------------
spring.mail.host=<YOUR MAIL HOST SMTP>
spring.mail.port=587
spring.mail.username=<YOUR MAIL ADDRESS>
spring.mail.password=<YOUR MAIL PASSWORD>
enivorment variables
--------------------
export SPRING_MAIL_HOST=<YOUR MAIL HOST SMTP>
export SPRING_MAIL_PORT=587
export SPRING_MAIL_USERNAME=<YOUR MAIL ADDRESS>
export SPRING_MAIL_PASSWORD=<YOUR MAIL PASSWORD>
```
## Docker-Compose (Java Spring + Database)
> Note that you are running this backend standalone!
> Checkout `pse-docker` to run both front- and backend.
Build the composition
```sh
$ docker compose build
```
Run the composition
```sh
$ docker compose run
```
The port is automatically exposed to port 80.
You can configure the composition by editing the `.env` and `docker-compose.yml`
files.
## Docker (just Java Spring)
> Note that you are running this server standalone!
> Checkout `pse-docker` to run both front- and backend.
> You need to connect to a Database to the image as well.
The docker image can be build using
```sh
$ docker build -t pse-server .
```
Then the image can be run using
```sh
$ docker run -p 80:8080 -it pse-server
```
Here you can change the configuration by editing the `Dockerfile` by setting
ENV VARS:
```
ENV SPRING_MAIL_HOST=<YOUR MAIL HOST SMTP>
ENV SPRING_MAIL_PORT=587
ENV SPRING_MAIL_USERNAME=<YOUR MAIL ADDRESS>
ENV SPRING_MAIL_PASSWORD=<YOUR MAIL PASSWORD>
ENV EMAIL_DASHBOARD_BASE_URL=http://<YOUR FRONTEND DOMAIN>
ENV EMAIL_VERIFICATION_URL=http://<YOUR BACKEND DOMAIN>/api/2/auth/%s/verify.json
ENV EMAIL_RESET_URL_PATH=/resetPassword
```
These can also be set by supplying them when starting the image
```sh
$ docker run -p 80:8080 -it pse-server -e "SPRING_MAIL_HOST=<YOUR MAIL HOST SMTP>"
```
Or you can use the env vars from the host by only writing the name of the var
```sh
$ docker run -p 80:8080 -it pse-server -e SPRING_MAIL_HOST
```
## Used Dependencies
- Spring Web
- Spring Security
- Spring Mail Sender
- Spring Data JPA
- Lombok
- Rome (RSS parsing/fetching)
## License
This project is licensed under the AGPL-3 License - see the `LICENSE` file for details