Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

readme-for-app-demo-gif #43

Merged
merged 9 commits into from
Jul 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@ jobs:
script: |
sudo docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
sudo docker pull ${{ secrets.DOCKER_IMAGE }}:latest

EXISTING_CONTAINER=$(sudo docker ps --filter "publish=8080" -q)
if [ ! -z "$EXISTING_CONTAINER" ]; then
echo "Stopping and removing existing container on port 8080"
sudo docker stop $EXISTING_CONTAINER
sudo docker rm $EXISTING_CONTAINER
fi
sudo docker rm -f ${{ secrets.CONTAINER_NAME }} || true

sudo docker run -d -p 8080:8080 --name ${{ secrets.CONTAINER_NAME }} \
-e RMQ_HOST=${{ secrets.RMQ_HOST }} \
-e RMQ_PORT=${{ secrets.RMQ_PORT }} \
-e RMQ_USERNAME=${{ secrets.RMQ_USERNAME }} \
-e RMQ_PASSWORD=${{ secrets.RMQ_PASSWORD }} \
-e MYSQL_URL=${{ secrets.MYSQL_URL }} \
-e MYSQL_USERNAME=${{ secrets.MYSQL_USERNAME }} \
-e MYSQL_PASSWORD=${{ secrets.MYSQL_PASSWORD }} \
Expand Down
5 changes: 5 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<p align="center">
<img src="https://github.com/user-attachments/assets/a00863d4-83f6-4310-a2ba-f5d94b955ae1">
</br> </br>
<b>two friends gathering</b>
</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.example.swiftgathering_server.config;

import lombok.Getter;
import org.springframework.stereotype.Component;

import jakarta.annotation.PostConstruct;
import java.time.Instant;

@Component
public class ApplicationStartup {
@Getter
private static Instant startTime;

@PostConstruct
public void onStartup() {
startTime = Instant.now();
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
package com.example.swiftgathering_server.controller;

import com.example.swiftgathering_server.config.ApplicationStartup;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;

@Controller
@RequestMapping("/health")
public class HealthController {
@GetMapping
public ResponseEntity<String> checkHealth() {
return ResponseEntity
.ok("v1.0.6");
Instant bootTime = ApplicationStartup.getStartTime();
ZonedDateTime bootTimeKST = bootTime.atZone(ZoneId.of("Asia/Seoul"));
String bootTimeFormatted = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss z").format(bootTimeKST);
String response = String.format("boot time: %s", bootTimeFormatted);
return ResponseEntity.ok(response);
}
}
}
Loading