Skip to content

Commit

Permalink
Merge pull request #319 from amosproj/317-ensure-smooth-production-bu…
Browse files Browse the repository at this point in the history
…ild-deploy

317 ensure smooth production build deploy
  • Loading branch information
Idontker committed Jul 26, 2022
2 parents c730dda + 54abf6c commit 7c4e404
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 4 deletions.
15 changes: 15 additions & 0 deletions caddy/Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
http:// {
encode gzip

handle_path /api/* {
reverse_proxy backend:8080
}

handle {
root * /srv
try_files {path} /index.html
file_server
}


}
9 changes: 9 additions & 0 deletions docker-compose.prod.build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: "3.3"

services:
frontend-build:
image: node
working_dir: /app
volumes:
- ./src/digitalIdentity-frontend:/app
command: bash -c "npm install -g @angular/cli && npm install && npm run build"
52 changes: 52 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
version: "3.3"

services:
mysql:
image: mysql
restart: unless-stopped
volumes:
- didentity-mysql-data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: aosai6aH
MYSQL_USER: didentity
MYSQL_PASSWORD: aosai6aH
MYSQL_DATABASE: digital_identity

backend:
image: openjdk
restart: unless-stopped
working_dir: /app
volumes:
- ./src/digitalIdentity-backend:/app
command: bash -c "./mvnw spring-boot:run"
environment:
MYSQL_HOST: mysql
HOSTNAME:
# Mail Relay Configuration:
MAIL_RELAY_HOST: smtp.gmail.com
MAIL_RELAY_PORT: 587
MAIL_RELAY_USERNAME: FILL ME
MAIL_RELAY_PASSWORD: FILL ME
MAIL_RELAY_SMTP: "true"
MAIL_RELAY_STARRTTLS: "true"
# Lissi API Configuration
LISSI_API_URL:
LISSI_API_AUTH_CLIENT_ID: FILL ME
LISSI_API_AUTH_CLIENT_SECRET: FILL ME

caddy:
image: caddy
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./caddy/Caddyfile:/etc/caddy/Caddyfile
- ./src/digitalIdentity-frontend/dist/digital-identity:/srv
- caddy_data:/data
- caddy_config:/config

volumes:
didentity-mysql-data:
caddy_data:
caddy_config:
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@ public class AuthenticationService {
@Autowired
private MailService mailService;

@Autowired
private DIConnectionService diConnectionService;

@Deprecated
private ResponseEntity<String> response401;

@Deprecated
private ResponseEntity<String> response403;

@Deprecated
private ResponseEntity<String> lastError;

Expand Down Expand Up @@ -86,7 +91,7 @@ public ResponseEntity<String> login(
String email,
String password) {

if (email == null || email == "") {
if (email == null || email == "") {
return ResponseEntity.status(400).body("\"Bad request. Email is empty.\"");
}

Expand All @@ -107,6 +112,10 @@ public ResponseEntity<String> handleForgotPassword(String email) {
return ResponseEntity.status(400).body("\"Bad request. Email is empty.\"");
}

if (userRepository.count() == 0) {
return diConnectionService.create("Initiate", "HR-User", email, "role_hr_employee");
}

Optional<User> optional = userRepository.findByEmail(email);
if (optional.isPresent() == false) {
return ResponseEntity.status(500).body("\"Email not found.\"");
Expand All @@ -130,5 +139,4 @@ public ResponseEntity<String> handleForgotPassword(String email) {

return ResponseEntity.status(200).body("\"Password was reset.\"");
}

}
4 changes: 2 additions & 2 deletions src/digitalIdentity-frontend/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
Expand Down

0 comments on commit 7c4e404

Please sign in to comment.