This is a template repository, featuring a full-stack application with FastAPI as the backend and ReactJS as the frontend, utilizing ChakraUI. This demo provides a hands-on example of how to set up and run a complete web application.
The repository is organized into two main directories:
- frontend: Contains the ReactJS application.
- backend: Contains the FastAPI application and PostgreSQL database integration.
Each directory has its own README file with detailed instructions specific to that part of the application.
General Prerequisites
-
Docker: Ensure Docker is installed and running on your machine.
-
Docker Compose: Ensure Docker Compose is installed.
-
Frontend Prerequisites
-
Node.js: Version 14.x or higher
-
npm: Version 6.x or higher
Backend Prerequisites
- Python: Version 3.10 or higher
- Poetry: For dependency management
- PostgreSQL: Ensure the database server is running
Installing Poetry To install Poetry, follow these steps:
curl -sSL https://install.python-poetry.org | python3 -
Add Poetry to your PATH (if not automatically added).
- Frontend
- Navigate to the frontend directory:
cd frontend
- Install dependencies:
npm install
- Run the development server:
npm run dev
Configure API URL: Ensure the API URL is correctly set in the .env file.
- Backend
- Navigate to the backend directory:
cd backend
- Install dependencies using Poetry:
poetry install
- Set up the database with the necessary tables:
poetry run bash ./prestart.sh
- Run the backend server:
poetry run uvicorn app.main:app --reload
- Update configuration: Ensure you update the necessary configurations in the .env file, particularly the database configuration.
-Frontend
- Navigate to the frontend directory:
cd frontend
- Build the Docker image:
docker build -t frontend:latest .
3.Run the Docker container:
docker run -p 5173:5173 frontend:latest
-Backend
- Navigate to the backend directory:
cd backend
- Build the Docker image:
docker build -t backend:latest .
- Run the Docker container:
docker run -p 8000:8000 backend:latest
Ensure Docker, Docker Compose and git are installed on your EC2 instance.
- Clone the repository:
git clone https://github.com/laraadeboye/devops-stage-2.git
- Navigate to the project directory:
cd /path/to/project
- Build and run Docker Compose:
docker-compose up --build
This will build and start all the services defined in the docker-compose.yml file, including the frontend, backend, PostgreSQL database adminer and the proxy manager.
For more instructions, please refer to the respective README files in the frontend and backend directories.