96 lines
1.6 KiB
Markdown
96 lines
1.6 KiB
Markdown
|
|
# Installation
|
||
|
|
|
||
|
|
## Prerequisites
|
||
|
|
|
||
|
|
- Go 1.27.1 or later
|
||
|
|
- Docker and Docker Compose (for containerized deployment)
|
||
|
|
- Node.js and npm (for React frontend development)
|
||
|
|
- PostgreSQL 15+ (or use Docker)
|
||
|
|
|
||
|
|
## Local Development
|
||
|
|
|
||
|
|
### 1. Clone the repository
|
||
|
|
|
||
|
|
```bash
|
||
|
|
git clone https://github.com/your-organization/go-mad.git
|
||
|
|
cd go-mad
|
||
|
|
```
|
||
|
|
|
||
|
|
### 2. Install dependencies
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Go dependencies
|
||
|
|
go mod download
|
||
|
|
|
||
|
|
# Node dependencies
|
||
|
|
npm install
|
||
|
|
```
|
||
|
|
|
||
|
|
### 3. Set up the database
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Using Docker Compose
|
||
|
|
make compose-up
|
||
|
|
|
||
|
|
# Or manually
|
||
|
|
createdb mad
|
||
|
|
# Or set up PostgreSQL with user 'mad' and database 'mad'
|
||
|
|
```
|
||
|
|
|
||
|
|
### 4. Configure the application
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Create config.yaml
|
||
|
|
cp config.example.yaml config.yaml
|
||
|
|
# Edit config.yaml with your settings
|
||
|
|
```
|
||
|
|
|
||
|
|
### 5. Run migrations
|
||
|
|
|
||
|
|
```bash
|
||
|
|
make test
|
||
|
|
# Or run manually
|
||
|
|
go run ./cmd/go-mad
|
||
|
|
```
|
||
|
|
|
||
|
|
The application will automatically run migrations on startup.
|
||
|
|
|
||
|
|
### 6. Start the development server
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Development mode with hot reload
|
||
|
|
make web-dev
|
||
|
|
|
||
|
|
# Or run the Go binary
|
||
|
|
make run
|
||
|
|
```
|
||
|
|
|
||
|
|
Access the application at `http://localhost:8080`
|
||
|
|
|
||
|
|
## Docker Deployment
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Build and start
|
||
|
|
docker compose up --build -d
|
||
|
|
|
||
|
|
# View logs
|
||
|
|
docker compose logs -f
|
||
|
|
|
||
|
|
# Stop
|
||
|
|
docker compose down
|
||
|
|
```
|
||
|
|
|
||
|
|
## Kubernetes Deployment
|
||
|
|
|
||
|
|
```bash
|
||
|
|
helm install go-mad oci://your-registry/go-mad/helm/go-mad
|
||
|
|
```
|
||
|
|
|
||
|
|
## Production Checklist
|
||
|
|
|
||
|
|
- [ ] Change the default JWT secret
|
||
|
|
- [ ] Configure proper PostgreSQL credentials
|
||
|
|
- [ ] Set up HTTPS/TLS via ingress
|
||
|
|
- [ ] Configure backups for the PostgreSQL data volume
|
||
|
|
- [ ] Set up monitoring and logging
|
||
|
|
- [ ] Review role-based access control settings
|