Skip to content

Commit

Permalink
(docker/dist/jwt-server) restructure and update
Browse files Browse the repository at this point in the history
  • Loading branch information
otatebe committed Mar 12, 2024
1 parent ec9b207 commit 2136570
Show file tree
Hide file tree
Showing 16 changed files with 52 additions and 48 deletions.
4 changes: 2 additions & 2 deletions docker/dist/jwt-server/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ setup-keycloak:
docker exec gfarm-keycloak /keycloak/setup.sh

setup-jwt-server:
docker exec gfarm-jwt-server /setup.sh
docker exec gfarm-jwt-server2 /setup_slave.sh
docker exec gfarm-jwt-server /jwt/setup_master1.sh
docker exec gfarm-jwt-server2 /jwt/setup_master2.sh
2 changes: 2 additions & 0 deletions docker/dist/jwt-server/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ services:
container_name: gfarm-jwt-server
volumes:
- ../minica/minica.pem:/usr/share/pki/ca-trust-source/anchors/minica.crt
- ./jwt-server:/jwt
networks:
- gfarm_net
privileged: true
Expand All @@ -31,6 +32,7 @@ services:
container_name: gfarm-jwt-server2
volumes:
- ../minica/minica.pem:/usr/share/pki/ca-trust-source/anchors/minica.crt
- ./jwt-server:/jwt
networks:
- gfarm_net
privileged: true
Expand Down
7 changes: 1 addition & 6 deletions docker/dist/jwt-server/jwt-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@ RUN cd jwt-server \
&& mvn package \
&& cp target/jwt-server.war /usr/share/tomcat/webapps/ROOT.war

COPY my.cnf.d/ /
COPY init.sql /jwt-server/ddl/
COPY init_master.sql /jwt-server/ddl/
COPY init_slave.sql /jwt-server/ddl/
COPY setup.sh /
COPY setup_slave.sh /
COPY cnf/charset.cnf /etc/my.cnf.d/

RUN systemctl enable httpd \
&& systemctl enable tomcat \
Expand Down
2 changes: 1 addition & 1 deletion docker/dist/jwt-server/jwt-server/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ keycloak.credentials.secret=eJxl5z1EHU0u6BVLpR5MG0v4NLgCZWWG
user-claim=hpci.id

# contact address
contact-info=
contact-info=gfarmfs@gmail.com

# set redundant jwt-server's URLs
replicated-jwt-servers=http://jwt-server/ http://jwt-server2/
Expand Down
6 changes: 6 additions & 0 deletions docker/dist/jwt-server/jwt-server/cnf/charset.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[mysqld]
character-set-server=utf8mb4
skip-character-set-client-handshake

[client]
default-character-set = utf8mb4
5 changes: 0 additions & 5 deletions docker/dist/jwt-server/jwt-server/init_master.sql

This file was deleted.

6 changes: 0 additions & 6 deletions docker/dist/jwt-server/jwt-server/init_slave.sql

This file was deleted.

10 changes: 2 additions & 8 deletions docker/dist/jwt-server/jwt-server/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,5 @@ systemctl restart tomcat
while [ ! -e /var/lib/mysql/mysql.sock ]; do
sleep 1
done
cd jwt-server/ddl
mysql < init.sql
mysql -u gfarm -pgfarm123 gfarmdb < jwt-server.ddl

cp /mysql_master.cnf /etc/my.cnf.d/
systemctl restart mysql

mysql < init_master.sql
mysql < /jwt/sql/init.sql
mysql -u gfarm -pgfarm123 gfarmdb < /jwt-server/ddl/jwt-server.ddl
8 changes: 8 additions & 0 deletions docker/dist/jwt-server/jwt-server/setup_master1.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
set -xeu
/jwt/setup.sh

cp /jwt/cnf/master1.cnf /etc/my.cnf.d/
systemctl restart mysql

mysql < /jwt/sql/init_master1.sql
8 changes: 8 additions & 0 deletions docker/dist/jwt-server/jwt-server/setup_master2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
set -xeu
/jwt/setup.sh

cp /jwt/cnf/master2.cnf /etc/my.cnf.d/
systemctl restart mysql

mysql < /jwt/sql/init_master2.sql
20 changes: 0 additions & 20 deletions docker/dist/jwt-server/jwt-server/setup_slave.sh

This file was deleted.

File renamed without changes.
11 changes: 11 additions & 0 deletions docker/dist/jwt-server/jwt-server/sql/init_master1.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CREATE USER 'replica'@'%' IDENTIFIED BY 'gfarm123';
RESET MASTER;
GRANT REPLICATION SLAVE ON *.* TO 'replica'@'%';
CHANGE MASTER TO
MASTER_HOST = 'jwt-server2',
MASTER_PORT = 3306,
MASTER_USER = 'replica',
MASTER_PASSWORD = 'gfarm123',
MASTER_CONNECT_RETRY = 10,
MASTER_USE_GTID = slave_pos;
START SLAVE;
11 changes: 11 additions & 0 deletions docker/dist/jwt-server/jwt-server/sql/init_master2.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CREATE USER 'replica'@'%' IDENTIFIED BY 'gfarm123';
RESET MASTER;
GRANT REPLICATION SLAVE ON *.* TO 'replica'@'%';
CHANGE MASTER TO
MASTER_HOST = 'jwt-server',
MASTER_PORT = 3306,
MASTER_USER = 'replica',
MASTER_PASSWORD = 'gfarm123',
MASTER_CONNECT_RETRY = 10,
MASTER_USE_GTID = slave_pos;
START SLAVE;

0 comments on commit 2136570

Please sign in to comment.