|
1 | | -# w06-template |
| 1 | +# DevOps W06 In-Class Exercise Template |
| 2 | + |
| 3 | +This repository contains a full-stack application with a SvelteKit client and a Spring Boot server. It demonstrates modern web application architecture and DevOps practices. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +This project includes: |
| 8 | +- **Client**: SvelteKit with TypeScript, TailwindCSS, and reusable UI components. |
| 9 | +- **Server**: Spring Boot Java application with RESTful APIs. |
| 10 | +- **DevOps**: Dockerized services, CI/CD pipelines, and production-ready deployment configurations. |
| 11 | + |
| 12 | +## Prerequisites |
| 13 | + |
| 14 | +- Node.js (v22 or later) |
| 15 | +- Java JDK 21+ |
| 16 | +- Gradle |
| 17 | +- Docker and Docker Compose |
| 18 | +- Git |
| 19 | + |
| 20 | +## Setup Instructions |
| 21 | + |
| 22 | +### Clone the Repository |
| 23 | + |
| 24 | +```bash |
| 25 | +git clone https://github.com/yourusername/w06-template.git |
| 26 | +cd w06-template |
| 27 | +``` |
| 28 | + |
| 29 | +### Client Setup |
| 30 | + |
| 31 | +1. Navigate to the `client` directory: |
| 32 | + ```bash |
| 33 | + cd client |
| 34 | + ``` |
| 35 | +2. Install dependencies: |
| 36 | + ```bash |
| 37 | + npm install |
| 38 | + ``` |
| 39 | + |
| 40 | +### Server Setup |
| 41 | + |
| 42 | +1. Navigate to the `server` directory: |
| 43 | + ```bash |
| 44 | + cd server |
| 45 | + ``` |
| 46 | +2. Build the project: |
| 47 | + ```bash |
| 48 | + ./gradlew build |
| 49 | + ``` |
| 50 | + |
| 51 | +## Running the Application |
| 52 | + |
| 53 | +### Start the Client/Client Canary |
| 54 | + |
| 55 | +```bash |
| 56 | +cd client |
| 57 | +npm run dev |
| 58 | +``` |
| 59 | +The client will be available at [http://localhost:3000](http://localhost:3000). |
| 60 | + |
| 61 | +### Start the Server |
| 62 | + |
| 63 | +```bash |
| 64 | +cd server |
| 65 | +./gradlew bootRun |
| 66 | +``` |
| 67 | +The server API will be available at [http://localhost:8080](http://localhost:8080). |
| 68 | + |
| 69 | +## Development Workflow |
| 70 | + |
| 71 | +### Client Development |
| 72 | + |
| 73 | +- Built with SvelteKit and TypeScript for a modern, reactive UI. |
| 74 | +- TailwindCSS for styling. |
| 75 | +- Components and routes are organized in the `src` directory. |
| 76 | + |
| 77 | +### Server Development |
| 78 | + |
| 79 | +- Built with Spring Boot for scalable and maintainable server services. |
| 80 | +- Gradle is used for dependency management and building. |
| 81 | +- Source code is in the `src/main/java` directory. |
| 82 | +- Tests are in the `src/test/java` directory. |
| 83 | + |
| 84 | +## Building for Production |
| 85 | + |
| 86 | +### Client Build |
| 87 | + |
| 88 | +```bash |
| 89 | +cd client |
| 90 | +npm run build |
| 91 | +``` |
| 92 | + |
| 93 | +### Server Build |
| 94 | + |
| 95 | +```bash |
| 96 | +cd server |
| 97 | +./gradlew clean build |
| 98 | +``` |
| 99 | + |
| 100 | +## Dockerized Deployment |
| 101 | + |
| 102 | +The project includes Docker configurations for containerized deployment. |
| 103 | + |
| 104 | +### Build and Run with Docker Compose |
| 105 | + |
| 106 | +1. Build and start the services: |
| 107 | + ```bash |
| 108 | + docker compose up --build |
| 109 | + ``` |
| 110 | +2. Access the application: |
| 111 | + - Client: [http://localhost:3000](http://localhost:3000) |
| 112 | + - Client Canary: [http://localhost:3001](http://localhost:3001) |
| 113 | + - Server: [http://localhost:8080](http://localhost:8080) |
| 114 | + |
| 115 | +## CI/CD Pipeline |
| 116 | + |
| 117 | +The project includes GitHub Actions workflows for: |
| 118 | +- **Building Docker Images**: Automatically builds and pushes Docker images to GitHub Container Registry. |
| 119 | +- **Deploying Docker Images**: Deploys the application to a production environment using Docker Compose. |
| 120 | + |
| 121 | +## Project Structure |
| 122 | + |
| 123 | +``` |
| 124 | +├── client/ # SvelteKit client |
| 125 | +│ ├── src/ # Source code |
| 126 | +│ ├── public/ # Static assets |
| 127 | +│ └── package.json # Client dependencies |
| 128 | +│ |
| 129 | +├── client-canary/ # SvelteKit client with the changes to the original client |
| 130 | +│ ├── src/ # Source code |
| 131 | +│ ├── public/ # Static assets |
| 132 | +│ └── package.json # Client dependencies |
| 133 | +| |
| 134 | +├── server/ # Spring Boot server |
| 135 | +│ ├── src/ # Source code |
| 136 | +│ ├── build.gradle # Gradle build file |
| 137 | +│ └── Dockerfile # Server Dockerfile |
| 138 | +│ |
| 139 | +├── compose.yml # Docker Compose for local development |
| 140 | +└── .github/workflows/ # CI/CD workflows |
| 141 | +``` |
| 142 | + |
| 143 | +## License |
| 144 | + |
| 145 | +This project is licensed under the MIT License. |
0 commit comments