-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/#161-sign-up-as-a-registered-user
- Loading branch information
Showing
48 changed files
with
2,975 additions
and
3,656 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
APP_ENV=development | ||
APP_KEY= | ||
DB_CONNECTION=mysql | ||
DB_HOST=mysql | ||
DB_PORT=3306 | ||
DB_DATABASE=laravel | ||
DB_USERNAME=user | ||
DB_PASSWORD=password | ||
CACHE_DRIVER=array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
FROM node:22.2.0 AS node-stage | ||
|
||
WORKDIR /var/www/html | ||
|
||
RUN mkdir -p /var/www/html/build | ||
RUN npm install -g typescript | ||
|
||
|
||
FROM php:8.1-fpm as php-stage | ||
|
||
WORKDIR /var/www/html | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
libzip-dev libfreetype6-dev \ | ||
libjpeg62-turbo-dev libpng-dev libonig-dev \ | ||
libxml2-dev libpq-dev libicu-dev libxslt1-dev \ | ||
libmcrypt-dev libssl-dev git zip unzip && \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* | ||
RUN docker-php-ext-install pdo pdo_mysql mbstring exif pcntl bcmath gd | ||
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer | ||
COPY .env.docker /var/www/html/.env | ||
|
||
EXPOSE 9000 | ||
|
||
COPY ./entrypoint.sh /var/www/html/entrypoint.sh | ||
RUN chmod +x /var/www/html/entrypoint.sh | ||
ENTRYPOINT ["/var/www/html/entrypoint.sh"] | ||
|
||
CMD ["php-fpm"] | ||
|
||
|
||
FROM nginx:latest as nginx-stage | ||
COPY ./nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf | ||
COPY --from=php-stage /var/www/html /var/www/html | ||
COPY --from=node-stage /var/www/html/build /var/www/html/build | ||
RUN chmod -R 777 /var/www/html/build | ||
|
||
EXPOSE 80 | ||
EXPOSE 8000 | ||
|
||
CMD ["nginx", "-g", "daemon off;"] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,120 @@ | ||
.PHONY: up down full-restart start composer-install composer-update ssh run-tests swagger-generate logs kill-containers help | ||
.PHONY: up down full-restart start composer-install composer-update ssh run-tests swagger-generate logs kill-containers help status | ||
|
||
CONTAINER ?= php | ||
|
||
up: ## Bring up the Docker containers and build images if necessary | ||
docker compose up --build -d | ||
docker compose build --no-cache | ||
docker compose up -d | ||
|
||
down: ## Stop and remove the Docker containers | ||
docker compose down | ||
|
||
full-restart: ## Perform a full restart: stop containers, remove all data, and bring up again | ||
docker compose down && docker system prune --all -f && docker compose up --build -d | ||
reboot: ## Perform a full restart: stop containers, remove all data, and bring up again | ||
docker compose down | ||
docker system prune --all -f | ||
docker volume prune -f | ||
docker network prune -f | ||
if [ $$(docker network ls | grep app-network) ]; then sh ./bin/disconnect_and_remove_network.sh; fi | ||
docker network create app-network | ||
if [ -d "./node_modules" ]; then sudo rm -Rf ./node_modules; fi | ||
if [ -d "./vendor" ]; then sudo rm -Rf ./vendor; fi | ||
docker compose --verbose build --no-cache | ||
docker compose up -d | ||
docker network connect app-network mysql | ||
docker network connect app-network php | ||
docker network connect app-network node | ||
docker network connect app-network webserver | ||
|
||
start: ## Start the Laravel server in the container | ||
docker exec -it itaprofilesbackend-app php artisan serve --host=0.0.0.0 --port=8000 | ||
serve: ## Start the Laravel server in the container | ||
docker exec -it php php artisan serve --host=0.0.0.0 --port=8000 | ||
|
||
composer-install: ## Run 'composer install' inside the container | ||
docker exec -it itaprofilesbackend-app composer install | ||
docker exec -it php composer install | ||
|
||
composer-update: ## Run 'composer update' inside the container | ||
docker exec -it itaprofilesbackend-app composer update | ||
docker exec -it php composer update | ||
|
||
setup: ## Does the setup of basic project's features like composer install, migrations, seeds, swagger, resets caches, key, passport... | ||
docker exec -it php bash -c 'if [ -f /var/www/html/bootstrap/cache/config.php ]; then rm /var/www/html/bootstrap/cache/config.php; fi' | ||
docker exec -it php composer install | ||
docker exec -it php composer clear-cache | ||
docker exec -it php composer dump-autoload | ||
docker exec -it php cp .env.docker .env | ||
docker exec -it php php artisan cache:clear | ||
docker exec -it php php artisan config:clear | ||
docker exec -it php php artisan optimize | ||
docker exec -it php php artisan clear-compiled | ||
docker exec -it php php artisan key:generate | ||
docker exec -it php php artisan config:cache | ||
docker exec -it php chmod 777 -R storage | ||
docker exec -it php php artisan migrate:fresh --seed | ||
docker exec -it php php artisan l5-swagger:generate | ||
docker exec -it php php artisan config:clear | ||
docker exec -it php php artisan config:cache | ||
docker exec -it php php artisan cache:clear | ||
docker exec -it php php artisan key:generate | ||
docker exec -it php php artisan passport:install --force --no-interaction | ||
|
||
render-setup: | ||
bash -c 'if [ -f /var/www/html/bootstrap/cache/config.php ]; then rm /var/www/html/bootstrap/cache/config.php; fi' | ||
composer install | ||
composer clear-cache | ||
composer dump-autoload | ||
php artisan cache:clear | ||
php artisan config:clear | ||
php artisan optimize | ||
php artisan clear-compiled | ||
php artisan key:generate | ||
php artisan config:cache | ||
php artisan migrate:fresh --seed | ||
php artisan l5-swagger:generate | ||
cp .env.docker .env | ||
php artisan config:clear | ||
php artisan config:cache | ||
php artisan cache:clear | ||
php artisan key:generate | ||
php artisan passport:install --force --no-interaction | ||
|
||
ssh: ## Open a bash session inside the container | ||
docker exec -it itaprofilesbackend-app bash | ||
cache-clear: ## Clear the cache | ||
docker exec -it php php artisan config:clear | ||
docker exec -it php php artisan config:cache | ||
docker exec -it php php artisan cache:clear | ||
|
||
run-tests: ## Run PHPUnit tests inside the container | ||
docker exec -it itaprofilesbackend-app ./vendor/bin/phpunit -c phpunit.xml ./tests/ --testdox | ||
shell: ## Enters the specified container. Usage: make shell CONTAINER=<container_name> | ||
docker exec -it $(CONTAINER) bash | ||
|
||
test: ## Run PHPUnit tests inside the container | ||
docker exec -it php ./vendor/bin/phpunit -c phpunit.xml ./tests/ --testdox | ||
|
||
swagger-generate: ## Generate Swagger documentation | ||
docker exec -it itaprofilesbackend-app php artisan l5-swagger:generate | ||
docker exec -it php php artisan l5-swagger:generate | ||
|
||
logs: ## Show logs from all services in real time | ||
docker compose logs -f | ||
|
||
status: ## Shows the table of the containers withe its status | ||
docker ps | ||
|
||
kill-containers: ## Kill all running Docker containers | ||
@if [ "$$(docker ps -q)" ]; then \ | ||
docker kill $$(docker ps -q); \ | ||
else \ | ||
echo "No containers are running."; \ | ||
fi | ||
|
||
test-connectivity: | ||
docker exec -it php bash -c "timeout 1 bash -c '</dev/tcp/mysql/3306' && echo 'php to mysql: OK' || echo 'php to mysql: Failed'" | ||
docker exec -it php bash -c "timeout 1 bash -c '</dev/tcp/webserver/80' && echo 'php to webserver: OK' || echo 'php to webserver: Failed'" | ||
docker exec -it php bash -c "timeout 1 bash -c '</dev/tcp/node/80' && echo 'php to node: OK' || echo 'php to node: Failed'" | ||
docker exec -it webserver bash -c "timeout 1 bash -c '</dev/tcp/php/9000' && echo 'webserver to php: OK' || echo 'webserver to php: Failed'" | ||
docker exec -it webserver bash -c "timeout 1 bash -c '</dev/tcp/mysql/3306' && echo 'webserver to mysql: OK' || echo 'webserver to mysql: Failed'" | ||
docker exec -it webserver bash -c "timeout 1 bash -c '</dev/tcp/node/80' && echo 'webserver to node: OK' || echo 'webserver to node: Failed'" | ||
docker exec -it mysql bash -c "timeout 1 bash -c '</dev/tcp/php/9000' && echo 'mysql to php: OK' || echo 'mysql to php: Failed'" | ||
docker exec -it mysql bash -c "timeout 1 bash -c '</dev/tcp/webserver/80' && echo 'mysql to webserver: OK' || echo 'mysql to webserver: Failed'" | ||
docker exec -it mysql bash -c "timeout 1 bash -c '</dev/tcp/node/80' && echo 'mysql to node: OK' || echo 'mysql to node: Failed'" | ||
docker exec -it node bash -c "timeout 1 bash -c '</dev/tcp/php/9000' && echo 'node to php: OK' || echo 'node to php: Failed'" | ||
docker exec -it node bash -c "timeout 1 bash -c '</dev/tcp/webserver/80' && echo 'node to webserver: OK' || echo 'node to webserver: Failed'" | ||
docker exec -it node bash -c "timeout 1 bash -c '</dev/tcp/mysql/3306' && echo 'node to mysql: OK' || echo 'node to mysql: Failed'" | ||
|
||
help: ## Show this help | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ations/OpenApi/controllersAnnotations/registerUserAnnotations/AnnotationsRegisterUser.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
# Name of the network to remove | ||
NETWORK_NAME="app-network" | ||
|
||
# Get all containers connected to the network | ||
CONTAINERS=$(docker network inspect -f '{{range .Containers}}{{.Name}} {{end}}' $NETWORK_NAME) | ||
|
||
# Disconnect each container from the network | ||
for CONTAINER in $CONTAINERS | ||
do | ||
docker network disconnect -f $NETWORK_NAME $CONTAINER | ||
done | ||
|
||
# Remove the network | ||
docker network rm $NETWORK_NAME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.