This is the frontend service for the Andy Grails' website —
a personal music project under the nickname Andy Grails.
The app is built with Angular and consumes RESTful APIs provided by the backend service.
For the full project including backend and main repository, visit:
https://github.com/aistomin/andy.grails
This project uses Docker for development and production environments.
This project includes two Dockerfiles:
Dockerfile.dev: Development environment with hot reload usingng serveDockerfile.prod: Production environment with nginx serving the built Angular app
The CI/CD pipeline automatically builds and publishes the production image to Docker Hub. The older builds will be cleaned up by the job in the parent repo.
nginx.conf: Development configuration with API proxy to backendnginx.prod.conf: Production configuration without API proxy (for standalone deployment)
Start the App:
./start-dev.shStop the App:
./stop-dev.shOnce running, open your browser and navigate to http://localhost:4200/. The application will automatically reload whenever you modify any of the source files.
To run the production environment locally (using the production Docker image):
Start Production App:
./start-prod.shStop Production App:
./stop-prod.shOnce running, open your browser and navigate to http://localhost:4200/. This runs the production build with nginx serving the optimized Angular application.
Note: The production environment includes the full stack (database, backend, and frontend) and builds the frontend locally using Dockerfile.prod.
View logs (Development):
docker-compose -f docker-compose-dev.yml logs -fView logs (Production):
docker compose -f docker-compose-prod.yml logs -fRestart the App (Development):
./stop-dev.sh
./start-dev.shRestart the App (Production):
./stop-prod.sh
./start-prod.shFor detailed Docker setup instructions, see DOCKER_README.md.
The application includes comprehensive error handling for different scenarios:
- 404 Errors: Automatically redirects to a custom 404 page
- 500 Errors: Automatically redirects to a custom 500 error page
- Network Errors: Automatically redirects to a custom network error page when the backend is unreachable
- Other Server Errors: Handled with appropriate error messages
For demonstration purposes, the following test routes are available:
/test/error: Test page that calls the/test/errorbackend endpoint- If the backend returns 500, you'll be redirected to the 500 error page
- If the backend responds successfully, you'll see "Everything works!"
/500: Direct access to the 500 error page/404: Direct access to the 404 error page/network/error: Direct access to the network error page
To execute unit tests use the following command:
npm test-
Make your changes and run tests
-
Test your changes work in both development and production environments
-
Submit a pull request with a clear description of your changes.
Important: You must verify that the production Docker Compose setup displays the website correctly and that your changes work as intended.