Skip to content

Commit

Permalink
done
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielPalmSie committed Mar 25, 2024
1 parent 38072fa commit d9c5e14
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# PHP_2023
## Getting Started

https://otus.ru/lessons/razrabotchik-php/?utm_source=github&utm_medium=free&utm_campaign=otus
To launch the project, simply run the following command in your terminal:

```bash
sh script.sh
```

This command will set up the environment, including the necessary containers, and execute any initial setup scripts. Once the setup is complete, the project will be accessible through the hostname `application.local`.

Ensure your system's hosts file is configured to redirect `application.local` to the appropriate IP address, typically `127.0.0.1` for local development environments.
21 changes: 21 additions & 0 deletions script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

if [ ! -f .env ]; then
echo "Creating .env from .env.example..."
cp .env.example .env
else
echo ".env already exists."
fi

echo "Launching containers..."
docker-compose up -d
docker-compose logs -f &

echo "Installing Composer Dependencies..."
docker exec -it $(docker ps -qf "name=myapp_php") sh -c "composer install"

docker cp script.sql postgresql:/script.sql

docker exec -it postgresql psql -U ${POSTGRES_USER} -d ${POSTGRES_DB} -f /script.sql

echo -e "\033[0;32mThe project went up successfully!\033[0m"
2 changes: 1 addition & 1 deletion script.sql
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ user_id INT;
end_date DATE := '2024-03-19';
curr_date DATE;
BEGIN
FOR user_id IN 4..6 LOOP
FOR user_id IN 1..3 LOOP
FOR i IN 1..100 LOOP
curr_date := start_date + (RANDOM() * (end_date - start_date))::INTEGER;
INSERT INTO Transactions (user_id, transaction_date, description, amount, transaction_type)
Expand Down

0 comments on commit d9c5e14

Please sign in to comment.