Initial project setup (rust)
This commit is contained in:
10
.gitignore
vendored
Normal file
10
.gitignore
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
node_modules/
|
||||
__pycache__/
|
||||
*.pyc
|
||||
.env
|
||||
.venv/
|
||||
dist/
|
||||
build/
|
||||
*.egg-info/
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
13
.vscode/extensions.json
vendored
Normal file
13
.vscode/extensions.json
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"ms-azuretools.vscode-docker",
|
||||
"ms-python.python",
|
||||
"ms-python.black-formatter",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"esbenp.prettier-vscode",
|
||||
"eamodio.gitlens",
|
||||
"ms-vscode-remote.remote-ssh",
|
||||
"redhat.vscode-yaml",
|
||||
"bradlc.vscode-tailwindcss"
|
||||
]
|
||||
}
|
||||
32
.vscode/settings.json
vendored
Normal file
32
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
// ── Git 설정 ──
|
||||
"git.defaultCloneDirectory": "C:\\Users\\User\\Projects",
|
||||
"git.autofetch": true,
|
||||
"git.confirmSync": false,
|
||||
"git.enableSmartCommit": true,
|
||||
|
||||
// ── 에디터 설정 ──
|
||||
"editor.formatOnSave": true,
|
||||
"editor.tabSize": 2,
|
||||
"files.eol": "\n",
|
||||
"files.trimTrailingWhitespace": true,
|
||||
"files.insertFinalNewline": true,
|
||||
|
||||
// ── Python 설정 ──
|
||||
"[python]": {
|
||||
"editor.tabSize": 4,
|
||||
"editor.defaultFormatter": "ms-python.black-formatter"
|
||||
},
|
||||
|
||||
// ── Docker 설정 ──
|
||||
"[dockerfile]": {
|
||||
"editor.defaultFormatter": "ms-azuretools.vscode-docker"
|
||||
},
|
||||
|
||||
// ── 터미널 설정 ──
|
||||
"terminal.integrated.defaultProfile.windows": "Git Bash",
|
||||
|
||||
// ── 솔메카 배포 관련 ──
|
||||
"solmeca.gitea.url": "http://100.125.85.86:3000",
|
||||
"solmeca.coolify.url": "http://100.125.85.86:8000"
|
||||
}
|
||||
124
.vscode/tasks.json
vendored
Normal file
124
.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Deploy: 자동 배포 (서버 자동 선택)",
|
||||
"type": "shell",
|
||||
"command": "bash",
|
||||
"args": [
|
||||
"C:/Users/User/Desktop/SERVER_ 운영/deploy.sh",
|
||||
"${input:repoName}"
|
||||
],
|
||||
"group": "build",
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "dedicated",
|
||||
"clear": true
|
||||
},
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "Deploy: 서버 지정 배포",
|
||||
"type": "shell",
|
||||
"command": "bash",
|
||||
"args": [
|
||||
"C:/Users/User/Desktop/SERVER_ 운영/deploy.sh",
|
||||
"${input:repoName}",
|
||||
"${input:appName}",
|
||||
"${input:serverName}"
|
||||
],
|
||||
"group": "build",
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "dedicated",
|
||||
"clear": true
|
||||
},
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "Deploy: 서버 상태 확인",
|
||||
"type": "shell",
|
||||
"command": "bash",
|
||||
"args": [
|
||||
"C:/Users/User/Desktop/SERVER_ 운영/deploy.sh",
|
||||
"status"
|
||||
],
|
||||
"group": "build",
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "dedicated",
|
||||
"clear": true
|
||||
},
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "Git: Gitea에 Push",
|
||||
"type": "shell",
|
||||
"command": "git push origin main",
|
||||
"group": "build",
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "shared"
|
||||
},
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "Git: Commit + Push + Deploy",
|
||||
"type": "shell",
|
||||
"command": "bash",
|
||||
"args": [
|
||||
"-c",
|
||||
"git add -A && git commit -m '${input:commitMsg}' && git push origin main && bash 'C:/Users/User/Desktop/SERVER_ 운영/deploy.sh' $(basename $(git rev-parse --show-toplevel))"
|
||||
],
|
||||
"group": "build",
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "dedicated",
|
||||
"clear": true
|
||||
},
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "Docker: 로컬 빌드 테스트",
|
||||
"type": "shell",
|
||||
"command": "docker build -t ${input:repoName}:test . && docker run --rm -p 8000:8000 ${input:repoName}:test",
|
||||
"group": "test",
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "dedicated"
|
||||
},
|
||||
"problemMatcher": []
|
||||
}
|
||||
],
|
||||
"inputs": [
|
||||
{
|
||||
"id": "repoName",
|
||||
"type": "promptString",
|
||||
"description": "Gitea 레포 이름 (예: fastapi-demo)",
|
||||
"default": ""
|
||||
},
|
||||
{
|
||||
"id": "appName",
|
||||
"type": "promptString",
|
||||
"description": "Coolify 앱 이름 (비워두면 레포이름 사용)",
|
||||
"default": ""
|
||||
},
|
||||
{
|
||||
"id": "serverName",
|
||||
"type": "pickString",
|
||||
"description": "배포 서버 선택",
|
||||
"options": [
|
||||
"worker-ai",
|
||||
"worker-downsys",
|
||||
"worker-kakao2"
|
||||
],
|
||||
"default": "worker-ai"
|
||||
},
|
||||
{
|
||||
"id": "commitMsg",
|
||||
"type": "promptString",
|
||||
"description": "커밋 메시지",
|
||||
"default": "update"
|
||||
}
|
||||
]
|
||||
}
|
||||
10
Cargo.toml
Normal file
10
Cargo.toml
Normal file
@@ -0,0 +1,10 @@
|
||||
[package]
|
||||
name = "test-rust2"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
actix-web = "4"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
11
Dockerfile
Normal file
11
Dockerfile
Normal file
@@ -0,0 +1,11 @@
|
||||
FROM rust:1.78-alpine AS builder
|
||||
RUN apk add --no-cache musl-dev
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
RUN cargo build --release
|
||||
|
||||
FROM alpine:latest
|
||||
WORKDIR /app
|
||||
COPY --from=builder /app/target/release/$(basename $(pwd)) ./server
|
||||
EXPOSE 8080
|
||||
CMD ["./server"]
|
||||
19
src/main.rs
Normal file
19
src/main.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
use actix_web::{web, App, HttpServer, HttpResponse, get};
|
||||
use serde_json::json;
|
||||
|
||||
#[get("/")]
|
||||
async fn index() -> HttpResponse {
|
||||
HttpResponse::Ok().json(json!({"app": "test-rust2", "status": "running"}))
|
||||
}
|
||||
|
||||
#[get("/health")]
|
||||
async fn health() -> HttpResponse {
|
||||
HttpResponse::Ok().json(json!({"status": "ok"}))
|
||||
}
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
println!("test-rust2 running on port 8080");
|
||||
HttpServer::new(|| App::new().service(index).service(health))
|
||||
.bind("0.0.0.0:8080")?.run().await
|
||||
}
|
||||
Reference in New Issue
Block a user