Skip to content

Commit 58a0ad7

Browse files
committed
Merge branch 'feat/file-upload' of https://github.com/boostcampwm-2024/web05-Denamu into docs/file-upload
2 parents fc97210 + 313401f commit 58a0ad7

File tree

87 files changed

+1970
-249
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+1970
-249
lines changed

.github/workflows/deploy_infra.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Infra Deployment
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- docker-compose/docker-compose.prod*.yml
9+
workflow_dispatch:
10+
11+
jobs:
12+
deployment:
13+
runs-on: ubuntu-latest
14+
steps:
15+
# public 서버로 ssh 접속
16+
- name: ssh connection
17+
uses: appleboy/[email protected]
18+
with:
19+
host: ${{ secrets.CLOUD_PUBLIC_INSTANCE_HOST }}
20+
username: ${{ secrets.CLOUD_PUBLIC_INSTANCE_USERNAME }}
21+
key: ${{ secrets.CLOUD_PUBLIC_INSTANCE_SSH_KEY }}
22+
port: ${{ secrets.CLOUD_PUBLIC_INSTANCE_PORT }}
23+
script: |
24+
cd /var/web05-Denamu
25+
git pull origin main
26+
docker-compose -f docker-compose/docker-compose.prod.yml down
27+
docker-compose -f docker-compose/docker-compose.prod.yml up -d

.github/workflows/deploy_server.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ jobs:
4545
echo "ACCESS_TOKEN_EXPIRE=${{secrets.ACCESS_TOKEN_EXPIRE}}" >> env/.env.prod
4646
echo "GOOGLE_CLIENT_ID=${{secrets.GOOGLE_CLIENT_ID}}" >> env/.env.prod
4747
echo "GOOGLE_CLIENT_SECRET=${{secrets.GOOGLE_CLIENT_SECRET}}" >> env/.env.prod
48+
echo "GITHUB_CLIENT_ID=${{secrets.GIT_CLIENT_ID}}" >> env/.env.prod
49+
echo "GITHUB_CLIENT_SECRET=${{secrets.GIT_CLIENT_SECRET}}" >> env/.env.prod
4850
4951
cd /var/web05-Denamu
5052
docker-compose -f docker-compose/docker-compose.prod.yml up --build --no-deps -d app

client/src/components/auth/AuthSignInForm.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,21 @@ export const AuthSignInForm = () => {
6565
</Button>
6666
</form>
6767
<AuthSocialLoginButtons />
68-
<div className="mt-4">
68+
<div className="mt-4 flex justify-between">
6969
<Button
7070
variant="link"
7171
className="text-muted-foreground underline underline-offset-4 h-auto p-0"
7272
onClick={() => navigate("/signup", { state: { from: location.pathname } })}
7373
>
7474
계정이 없으신가요?
7575
</Button>
76+
<Button
77+
variant="link"
78+
className="text-muted-foreground underline underline-offset-4 h-auto p-0"
79+
onClick={() => navigate("/")}
80+
>
81+
메인 페이지로 돌아가기
82+
</Button>
7683
</div>
7784
</AuthCard>
7885
</>

client/src/components/auth/AuthSocialLoginButtons.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,16 @@ import { Button } from "@/components/ui/button.tsx";
77
import { useCustomToast } from "@/hooks/common/useCustomToast.ts";
88

99
import { TOAST_MESSAGES } from "@/constants/messages.ts";
10+
import { BASE_URL, OAUTH } from "@/constants/endpoints.ts";
1011

1112
export const AuthSocialLoginButtons = () => {
1213
const { toast } = useCustomToast();
13-
const handleSocialLogin = () => {
14+
15+
const handleSocialLogin = (provider: "google" | "github") => {
16+
window.location.href = `${BASE_URL}${OAUTH.LOGIN}?type=${provider}`;
17+
};
18+
19+
const handleNotPrepared = () => {
1420
toast(TOAST_MESSAGES.SERVICE_NOT_PREPARED);
1521
};
1622

@@ -26,19 +32,19 @@ export const AuthSocialLoginButtons = () => {
2632
</div>
2733

2834
<div className="grid gap-2">
29-
<Button variant="outline" className="w-full" onClick={handleSocialLogin}>
35+
<Button variant="outline" className="w-full" onClick={() => handleSocialLogin("github")}>
3036
<GitHub />
3137
<span className="text-muted-foreground">Github로 계속하기</span>
3238
</Button>
33-
<Button variant="outline" className="w-full" onClick={handleSocialLogin}>
39+
<Button variant="outline" className="w-full" onClick={() => handleSocialLogin("google")}>
3440
<Google />
3541
<span className="text-muted-foreground">Google로 계속하기</span>
3642
</Button>
37-
<Button variant="outline" className="w-full" onClick={handleSocialLogin}>
43+
<Button variant="outline" className="w-full" onClick={handleNotPrepared}>
3844
<Naver className="text-[#03C75A]" />
3945
<span className="text-muted-foreground">네이버로 계속하기</span>
4046
</Button>
41-
<Button variant="outline" className="w-full" onClick={handleSocialLogin}>
47+
<Button variant="outline" className="w-full" onClick={handleNotPrepared}>
4248
<Kakao className="text-[#FEE500]" />
4349
<span className="text-muted-foreground">카카오로 계속하기</span>
4450
</Button>

client/src/constants/endpoints.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,7 @@ export const USER = {
4040
LOGIN: "/api/user/login",
4141
CERTIFICATE: "/api/user/certificate",
4242
};
43+
44+
export const OAUTH = {
45+
LOGIN: "/api/oauth",
46+
};
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { useEffect } from "react";
2+
import { useLocation, useNavigate } from "react-router-dom";
3+
4+
import { useAuthStore } from "@/store/useAuthStore.ts";
5+
6+
export default function OAuthSuccessPage() {
7+
const navigate = useNavigate();
8+
const location = useLocation();
9+
const { setUserFromToken } = useAuthStore();
10+
11+
useEffect(() => {
12+
const searchParams = new URLSearchParams(location.search);
13+
const accessToken = searchParams.get("token");
14+
15+
if (accessToken) {
16+
setUserFromToken(accessToken);
17+
navigate("/", { replace: true });
18+
} else {
19+
navigate("/signin", { replace: true });
20+
}
21+
}, [location, navigate, setUserFromToken]);
22+
23+
return (
24+
<div className="flex h-screen items-center justify-center">
25+
<p className="text-lg">로그인 처리 중입니다...</p>
26+
</div>
27+
);
28+
}

client/src/routes/index.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const Profile = lazy(() => import("@/pages/Profile"));
1313
const SignIn = lazy(() => import("@/pages/SignIn"));
1414
const SignUp = lazy(() => import("@/pages/SignUp"));
1515
const UserCertificate = lazy(() => import("@/pages/UserCertificate"));
16+
const OAuthSuccessPage = lazy(() => import("@/pages/OAuthSuccessPage"));
1617

1718
interface RouterProps {
1819
location: Location;
@@ -63,6 +64,14 @@ export const AppRouter = ({ location, state }: RouterProps) => {
6364
</Suspense>
6465
}
6566
/>
67+
<Route
68+
path="/oauth-success"
69+
element={
70+
<Suspense fallback={<Loading />}>
71+
<OAuthSuccessPage />
72+
</Suspense>
73+
}
74+
/>
6675
<Route
6776
path="/user/certificate"
6877
element={

docker-compose/docker-compose.dev.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ services:
5353
build:
5454
context: ../server
5555
dockerfile: docker/Dockerfile.dev
56+
image: denamu-dev-app:latest
5657
ports:
5758
- "8080:8080"
5859
networks:
@@ -78,6 +79,7 @@ services:
7879
build:
7980
context: ../feed-crawler
8081
dockerfile: docker/Dockerfile.dev
82+
image: denamu-dev-feed-crawler:latest
8183
networks:
8284
- Denamu
8385
depends_on:

docker-compose/docker-compose.local.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ services:
2626
build:
2727
context: ../server
2828
dockerfile: docker/Dockerfile.local
29+
image: denamu-local-portfolio-app:latest
2930
ports:
3031
- "8080:8080"
3132
networks:
@@ -46,6 +47,7 @@ services:
4647
build:
4748
context: ../feed-crawler
4849
dockerfile: docker/Dockerfile.local
50+
image: denamu-local-portfolio-feed-crawler:latest
4951
networks:
5052
- Denamu
5153
depends_on:

docker-compose/docker-compose.prod.infra.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,21 @@ services:
3535
timeout: 5s
3636
retries: 3
3737

38+
# MySQL Metrics
39+
mysql_metrics:
40+
image: prom/mysqld-exporter
41+
ports:
42+
- "9104:9104"
43+
networks:
44+
- Denamu
45+
command:
46+
- "--mysqld.username=$MYSQL_USER:$MYSQL_PASSWORD"
47+
- "--mysqld.address=mysql-db:3306"
48+
environment:
49+
TZ: "Asia/Seoul"
50+
depends_on:
51+
- mysql-db
52+
3853
# Redis 서비스
3954
redis:
4055
image: "redis:6.0.16-alpine"
@@ -58,6 +73,21 @@ services:
5873
environment:
5974
TZ: "Asia/Seoul"
6075

76+
# Redis Metrics
77+
redis_metrics:
78+
image: oliver006/redis_exporter
79+
ports:
80+
- "9121:9121"
81+
networks:
82+
- Denamu
83+
environment:
84+
REDIS_ADDR: "redis://redis:6379"
85+
REDIS_USER: "${REDIS_USER}"
86+
REDIS_PASSWORD: "${REDIS_PASSWORD}"
87+
TZ: "Asia/Seoul"
88+
depends_on:
89+
- redis
90+
6191
# Prometheus
6292
prometheus:
6393
image: "prom/prometheus"

0 commit comments

Comments
 (0)