Commit 77a5d6c5 by Dima Gabriel

Update README.md

parent bfceb031
Showing with 268 additions and 0 deletions
# TickMeIn - Event and Ticket Management Platform
## Link to our gitlab repository:
```bash
https://gitlab.ujaen.es/MihaiGin/WBT2425_6.git
```
## Link to our online deployed version:
Unfortunately, the deployment is not functional, so we did not include a link.
## Running the Project on a Linux setup
This guide provides detailed instructions for running the TickMeIn project on a Linux laptop.
## Prerequisites
Make sure you have the following installed:
```bash
# Check Python version (must be 3.10+)
python3 --version
# Check Node.js version (must be 18+)
node --version
# Check npm version
npm --version6
```
If you don't have these programs installed, you can install them as follows:
```bash
# Install Python and pip
sudo apt update
sudo apt install python3 python3-pip python3-venv
# Install Node.js and npm (LTS version)
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install -y nodejs
```
## Step 1: Installing MySQL
```bash
# Install MySQL
sudo apt update
sudo apt install mysql-server
# Start MySQL service
sudo systemctl start mysql
sudo systemctl enable mysql
# Check MySQL status
sudo systemctl status mysql
```
## Step 2: Configuring the Database
```bash
# Connect to MySQL as root
sudo mysql
# In the MySQL console, create the database and user
CREATE DATABASE webapp;
CREATE USER 'webapp_user'@'localhost' IDENTIFIED BY 'password123';
GRANT ALL PRIVILEGES ON webapp.* TO 'webapp_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
```
## Step 3: Cloning and Configuring the Project
```bash
# Navigate to the directory where you want to clone the project
cd ~/Projects # or another directory of your choice
# Clone the repository (replace the URL with your repository's URL)
git clone https://github.com/yourusername/event-ticket-app.git
cd event-ticket-app
```
## Step 4: Configuring the Backend (FastAPI)
```bash
# Create a Python virtual environment
python3 -m venv .venv
# Activate the virtual environment
source .venv/bin/activate
# Verify that the virtual environment is activated
which python # Should show the path to Python in the virtual environment
# Create a requirements-fixed.txt file to resolve dependency conflicts
cat > requirements-fixed.txt << EOF
fastapi==0.95.0
uvicorn==0.21.1
sqlalchemy==2.0.7
pymysql==1.0.3
pydantic==1.10.7
python-jose==3.3.0
passlib==1.7.4
python-multipart==0.0.6
python-dotenv==1.0.1
bcrypt==4.0.1
email_validator==2.0.0
mysql-connector-python==8.0.33
EOF
# Install Python dependencies
pip install -r requirements-fixed.txt
pip install PyJWT
pip install PyJWT[crypto]
# Navigate to the fastapi directory
cd fastapi
# Create the .env file for backend configuration
cat > .env << EOF
DATABASE_URL=mysql+pymysql://webapp_user:password123@localhost/webapp
SECRET_KEY=67c82b6b6b49e47fff1a8b51915ad0daf262c4cb4a69795af9ac90f03ecae10b
EOF
# Verify that the .env file was created correctly
cat .env
```
## Step 5: Configuring the Frontend (Next.js)
```bash
# Navigate back to the main project directory
cd ..
# Install Node.js dependencies
npm install
# Create the .env.local file for frontend configuration
cat > .env.local << EOF
NEXT_PUBLIC_API_URL=http://localhost:8000
EOF
# Verify that the .env.local file was created correctly
cat .env.local
```
## Step 6: Running the Application
### Option 1: Running the Backend and Frontend Separately
Open two different terminals:
#### Terminal 1 (Backend):
```bash
# Navigate to the project directory
cd ~/Projects/event-ticket-app
# Activate the virtual environment
source .venv/bin/activate
# Navigate to the fastapi directory
cd fastapi
# Start the backend server
python run.py
```
#### Terminal 2 (Frontend):
```bash
# Navigate to the project directory
cd ~/Projects/event-ticket-app
# Start the frontend server
npm run dev
```
### Option 2: Running with a Single Script
```bash
# Navigate to the project directory
cd ~/Projects/event-ticket-app
# Create the run_app.sh script
cat > run_app.sh << EOF
#!/bin/bash
# Start the backend
echo "Starting backend..."
cd fastapi
source ../.venv/bin/activate
python run.py &
BACKEND_PID=\$!
# Wait for the backend to start
echo "Waiting for backend to start..."
sleep 5
# Start the frontend
echo "Starting frontend..."
cd ..
npm run dev &
FRONTEND_PID=\$!
# Function to stop processes on shutdown
cleanup() {
echo "Stopping processes..."
kill \$BACKEND_PID
kill \$FRONTEND_PID
exit
}
# Register the cleanup function for shutdown signals
trap cleanup SIGINT SIGTERM
# Wait for the user to press Ctrl+C
echo "Application is running. Press Ctrl+C to stop."
wait
EOF
# Make the script executable
chmod +x run_app.sh
# Run the script
./run_app.sh
```
## Step 7: Accessing the Application
After starting the application, you can access:
1. Frontend: http://localhost:3000/
2. Backend API: http://localhost:8000/
3. API Documentation: http://localhost:8000/docs
## Test Credentials
#### Admin:
- Username: admin
- Password: admin
#### User:
- Username: aybaran
- Password: aybaran
## Useful Commands
```bash
# Check MySQL service status
sudo systemctl status mysql
# Restart MySQL service
sudo systemctl restart mysql
# Check MySQL logs
sudo journalctl -u mysql
# Check Python version in the virtual environment
python --version
# List installed Python packages
pip list
# Check Node.js version
node --version
# List installed npm packages
npm list --depth=0
# Check ports in use
sudo netstat -tulpn | grep LISTEN
```
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment