- Openjdk 11
- Docker
- Postman (for testing REST API)
- Jasypt 1.9.3
Firstly, check that you have all requirements installed.
If not:
sudo apt-get install docker \
&& curl -s "https://get.sdkman.io" | bash \
&& source "$HOME/.sdkman/bin/sdkman-init.sh" \
&& sdk install java 11.0.2-open
Installation (clear project): 0. Give run permissions to all sh scripts:
chmod u+x *.sh db/*.sh
- Check that your port 5432 is free:
sudo netstat -tulp | grep 5432
- Create and run a docker container with messenger database:
./db/create-db.sh
- Init database using Liquibase:
./gradlew db:update
- For development on localhost you need to update
/etc/hosts
:
127.0.0.1 yofik.messenger.auth
- Create SSL certificates for local HTTPS requests:
mkdir ~/.cert
mkdir ~/.cert/yofik-messenger/
cp generate-certs.sh ~/.cert/yofik-messenger/
cd ~/.cert
./generate-certs.sh
cd PROJECT_ROOT
cd auth/
mkdir certs
cp ~/.cert/yofik-messenger/Server-keystore.p12 certs
cp ~/.cert/yofik-messenger/Server-truststore.p12 certs
- Provide clientJpaDto certs to the clientJpaDto (maybe Postman File->Settings->Certificates):
~/.cert/yofik-messenger/CA-self-signed-certificate.pem
~/.cert/yofik-messenger/Client-certificate.crt
~/.cert/yofik-messenger/Client-private-key.key
- If you want, you can change
yofik.security.jwe-key
option inapplication-dev.yml
:
- Download and unzip Jasypt dist (https://github.com/jasypt/jasypt/releases/tag/jasypt-1.9.3)
- Generate random jwe-key like byte array (at least 256 bytes) and encode it with
Base64
or use/api/v1/clients/key
to generate such key
cd JASYPT_INSTALLATION/bin
chmod u+x encrypt.sh
./encrypt.sh input="NEW_BASE_JWE_KEY" password=JASYPT_PASSWORD algorithm=PBEWithMD5AndDES
Start (installed project):
- Run docker container with messenger database:
./db/start-db.sh
- If you change a database or pull someone changes which may change a database, you need to update database using Liquibase:
./gradlew db:update
for Windows:
gradlew.bat db:update
- Build the project:
./gradlew build
for Windows:
gradlew.bat build
- Run services which you need in separate terminals:
cd SERVICE_NAME
java -jar -Djasypt.encryptor.password=supersecretz build/libs/SERVICE_NAME-VERSION.war
for Windows:
cd SERVICE_NAME
java -jar -Djasypt.encryptor.password=supersecretz build\libs\SERVICE_NAME-VERSION.war
Also, to provide Jasypt password (for IDEA configuration or production build) you can set up the environment variable JASYPT_ENCRYPTOR_PASSWORD
If you want, you can easily disable SSL for messenger and admin services (web interface). To do so, you need
to create directories: messenger/config
and admin/config
. After that copy files application-dev.yml
from
each module and place in associated config directory and disable ssl.