2019-04-29 14:25:45 +02:00
|
|
|
# hsadminNg Development
|
2019-04-01 13:14:56 +02:00
|
|
|
|
2019-04-29 14:25:45 +02:00
|
|
|
## Setting up the Development Environment
|
2019-04-01 13:14:56 +02:00
|
|
|
|
2022-07-22 13:31:37 +02:00
|
|
|
### PostgreSQL Server
|
2019-05-01 14:37:22 +02:00
|
|
|
|
2022-07-22 13:31:37 +02:00
|
|
|
So far the spike contains almost only PostgreSQL Code.
|
|
|
|
All you need so far, is a PostgreSQL database, for now with full admin rights.
|
|
|
|
The easiest way to set it up is using docker:
|
2019-05-01 14:37:22 +02:00
|
|
|
|
2022-07-22 13:31:37 +02:00
|
|
|
Initially, pull an image compatible to current PostgreSQL version of Hostsharing:
|
2019-05-01 14:37:22 +02:00
|
|
|
|
2022-07-22 13:31:37 +02:00
|
|
|
docker pull postgres:13.7-bullseye
|
2019-05-01 14:37:22 +02:00
|
|
|
|
2022-07-22 13:31:37 +02:00
|
|
|
Create and run a container with the given PostgreSQL version:
|
2019-05-01 14:37:22 +02:00
|
|
|
|
2022-07-22 13:31:37 +02:00
|
|
|
docker run --name hsadmin-ng-postgres -e POSTGRES_PASSWORD=password -p 5432:5432 -d postgres:13.7-bullseye
|
2019-05-01 14:37:22 +02:00
|
|
|
|
2022-07-22 13:31:37 +02:00
|
|
|
To check if the PostgreSQL container is running, the following command should list a container with the name "hsadmin-ng-postgres":
|
2019-05-01 14:37:22 +02:00
|
|
|
|
2022-07-22 13:31:37 +02:00
|
|
|
docker container ls
|
2019-05-01 14:37:22 +02:00
|
|
|
|
2022-07-22 13:31:37 +02:00
|
|
|
Stop the PostgreSQL container:
|
|
|
|
|
|
|
|
docker stop hsadmin-ng-postgres
|
2019-05-01 14:37:22 +02:00
|
|
|
|
2022-07-22 13:31:37 +02:00
|
|
|
Start the PostgreSQL container again:
|
2019-05-01 14:37:22 +02:00
|
|
|
|
2022-07-22 13:31:37 +02:00
|
|
|
docker container start hsadmin-ng-postgres
|
2019-05-01 14:37:22 +02:00
|
|
|
|
2022-07-22 13:31:37 +02:00
|
|
|
Remove the PostgreSQL container:
|
2019-05-01 14:37:22 +02:00
|
|
|
|
2022-07-22 13:31:37 +02:00
|
|
|
docker rm hsadmin-ng-postgres
|
2019-05-01 14:37:22 +02:00
|
|
|
|
2022-07-22 13:31:37 +02:00
|
|
|
After the PostgreSQL container is removed, you need to create it again as shown in "Create and run ..." above.
|
2019-05-01 14:37:22 +02:00
|
|
|
|
2022-07-26 13:19:17 +02:00
|
|
|
Given the container is running, to create a backup in ~/backup, run:
|
|
|
|
|
|
|
|
docker exec -i hsadmin-ng-postgres /usr/bin/pg_dump --clean --create -U postgres postgres | gzip -9 > ~/backup/hsadmin-ng-postgres2.sql.gz
|
|
|
|
|
|
|
|
|
|
|
|
Again, given the container is running, to restore the backup from ~/backup, run:
|
|
|
|
|
|
|
|
gunzip --stdout --keep ~/backup/hsadmin-ng-postgres.sql.gz | docker exec -i hsadmin-ng-postgres psql -U postgres -d postgres
|
|
|
|
|
|
|
|
|
2022-07-22 13:31:37 +02:00
|
|
|
### Markdown with PlantUML plugin
|
2019-05-01 14:37:22 +02:00
|
|
|
|
2022-07-22 13:31:37 +02:00
|
|
|
Can you see the following diagram?
|
2019-05-08 10:56:48 +02:00
|
|
|
|
2022-07-22 13:31:37 +02:00
|
|
|
```plantuml
|
|
|
|
@startuml
|
|
|
|
me -> you: Can you see this diagram?
|
|
|
|
you -> me: Sorry, I don't :-(
|
|
|
|
me -> you: Install some tooling!
|
|
|
|
@enduml
|
|
|
|
```
|
2019-05-08 10:56:48 +02:00
|
|
|
|
2022-07-22 13:31:37 +02:00
|
|
|
If not, you need to install some tooling.
|
2019-05-08 10:56:48 +02:00
|
|
|
|
2022-07-22 13:31:37 +02:00
|
|
|
#### for IntelliJ IDEA (or derived products)
|
2019-05-08 10:56:48 +02:00
|
|
|
|
2022-07-22 13:31:37 +02:00
|
|
|
You just need the bundled Markdown plugin enabled and install and activate the PlantUML plugin in its settings:
|
2019-05-08 10:56:48 +02:00
|
|
|
|
2022-07-22 13:31:37 +02:00
|
|
|
jetbrains://idea/settings?name=Languages+%26+Frameworks--Markdown
|
2019-05-08 10:56:48 +02:00
|
|
|
|
2022-07-22 13:31:37 +02:00
|
|
|
You might also need to install Graphviz on your operating system.
|
|
|
|
For Debian-based Linux systems this might work:
|
2019-05-08 10:56:48 +02:00
|
|
|
|
2022-07-22 13:31:37 +02:00
|
|
|
```sh
|
|
|
|
sudo apt install graphviz
|
|
|
|
```
|
2019-05-08 10:56:48 +02:00
|
|
|
|
|
|
|
|
2022-07-22 13:31:37 +02:00
|
|
|
### Ubuntu Linux command line
|
2019-05-08 10:56:48 +02:00
|
|
|
|
2022-07-22 13:31:37 +02:00
|
|
|
```sh
|
|
|
|
sudo apt-get install pandoc texlive-latex-base texlive-fonts-recommended texlive-extra-utils texlive-latex-extra pandoc-plantuml-filter
|
|
|
|
```
|
2019-05-01 14:37:22 +02:00
|
|
|
|
2022-07-22 13:31:37 +02:00
|
|
|
```sh
|
|
|
|
pandoc --filter pandoc-plantuml rbac.md -o rbac.pdf
|
|
|
|
```
|
2019-05-01 14:37:22 +02:00
|
|
|
|
2022-07-22 13:31:37 +02:00
|
|
|
### for other IDEs / operating systems
|
2019-05-01 14:37:22 +02:00
|
|
|
|
2022-07-22 13:31:37 +02:00
|
|
|
If you have figured out how it works, please add instructions above this section.
|