Render 완벽 가이드 | 무료 배포·PostgreSQL·Static Site·Cron Jobs·실전 활용
이 글의 핵심
Render로 무료 배포를 구현하는 완벽 가이드입니다. Web Service, Static Site, PostgreSQL, Cron Jobs, 환경 변수까지 실전 예제로 정리했습니다.
실무 경험 공유: Heroku에서 Render로 전환하면서, 무료로 프로젝트를 운영하고 배포가 간소화된 경험을 공유합니다.
들어가며: “무료 배포가 필요해요”
실무 문제 시나리오
시나리오 1: Heroku 무료 플랜이 없어요
비용이 부담됩니다. Render는 무료 플랜을 제공합니다.
시나리오 2: 정적 사이트 배포가 필요해요
별도 서비스가 필요합니다. Render는 통합 제공합니다.
시나리오 3: Cron Job이 필요해요
복잡한 설정이 필요합니다. Render는 간단히 추가할 수 있습니다.
1. Render란?
핵심 특징
Render는 간편한 클라우드 플랫폼입니다.
주요 장점:
- 무료 플랜: Web Service, Static Site
- 자동 배포: Git push로 자동
- 데이터베이스: PostgreSQL 무료
- Cron Jobs: 스케줄 작업
- 간단한 설정: 직관적 UI
2. Web Service 배포
Node.js 앱
- New → Web Service
- GitHub 저장소 연결
- 설정 입력
# Build Command
npm install && npm run build
# Start Command
npm start
# Environment
Node
Express 예제
// server.ts
import express from 'express';
const app = express();
app.get('/', (req, res) => {
res.send('Hello Render!');
});
const port = process.env.PORT || 3000;
app.listen(port, () => {
console.log(`Server running on port ${port}`);
});
3. Static Site 배포
설정
# Build Command
npm run build
# Publish Directory
dist
Astro 예제
// astro.config.mjs
export default {
output: 'static',
build: {
format: 'directory',
},
};
4. PostgreSQL
추가
- New → PostgreSQL
- 자동으로
DATABASE_URL생성
연결
import { Pool } from 'pg';
const pool = new Pool({
connectionString: process.env.DATABASE_URL,
ssl: {
rejectUnauthorized: false,
},
});
export default pool;
5. 환경 변수
설정
# Render Dashboard → Environment
DATABASE_URL=postgresql://...
API_KEY=secret123
NODE_ENV=production
.env 파일
# 로컬 개발용
DATABASE_URL=postgresql://localhost:5432/mydb
API_KEY=dev-key
6. Cron Jobs
설정
- New → Cron Job
- 스케줄 설정 (cron 문법)
- 명령어 입력
# 매일 자정
0 0 * * *
# 명령어
npm run cleanup
스크립트
// scripts/cleanup.ts
import pool from './lib/db';
async function cleanup() {
await pool.query('DELETE FROM logs WHERE created_at < NOW() - INTERVAL \'30 days\'');
console.log('Cleanup completed');
}
cleanup();
7. 도메인 설정
Render 도메인
your-app.onrender.com
커스텀 도메인
- Settings → Custom Domain
- 도메인 추가
- DNS 설정
Type Name Value
CNAME www your-app.onrender.com
8. render.yaml
services:
- type: web
name: my-app
env: node
buildCommand: npm install && npm run build
startCommand: npm start
envVars:
- key: NODE_ENV
value: production
databases:
- name: my-db
databaseName: mydb
user: myuser
- name: my-redis
plan: free
정리 및 체크리스트
핵심 요약
- Render: 간편한 배포 플랫폼
- 무료 플랜: Web Service, Static Site
- 자동 배포: Git push로 자동
- PostgreSQL: 무료 제공
- Cron Jobs: 스케줄 작업
- 간단한 설정: 직관적 UI
구현 체크리스트
- Render 계정 생성
- Git 연동
- Web Service 배포
- PostgreSQL 추가
- 환경 변수 설정
- Cron Jobs 설정
- 도메인 설정
같이 보면 좋은 글
- Railway 완벽 가이드
- Vercel 완벽 가이드
- Heroku 대안 가이드
이 글에서 다루는 키워드
Render, Deployment, PostgreSQL, Redis, DevOps, Hosting, Backend
자주 묻는 질문 (FAQ)
Q. Heroku와 비교하면 어떤가요?
A. Render가 더 저렴하고 무료 플랜이 있습니다.
Q. Railway와 비교하면 어떤가요?
A. 비슷합니다. Render가 Static Site 지원이 더 좋습니다.
Q. 무료 플랜의 제한은?
A. 750시간/월, 15분 비활성 시 sleep, 100GB 대역폭입니다.
Q. 프로덕션에서 사용해도 되나요?
A. 네, 많은 스타트업에서 사용하고 있습니다.