Skip to content

Commit

Permalink
Merge branch 'main' into feature/165-make-the-terms-and-conditions-mo…
Browse files Browse the repository at this point in the history
…dal-for-signup
  • Loading branch information
llopFilms committed Jun 3, 2024
2 parents 2411517 + 52db217 commit d6b8e4d
Show file tree
Hide file tree
Showing 86 changed files with 3,492 additions and 4,340 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
docker/
.git
.dockerignore
13 changes: 7 additions & 6 deletions .github/workflows/backend_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,16 @@ jobs:
- name: Ejecutar migraciones y seeds
run: php artisan migrate --seed

<<<<<<< HEAD
- name: Inicializar passport
run: php artisan passport:install

- name: Ejecutar pruebas unitarias
=======
- name: Instalar PHPUnit
run: composer require --dev phpunit/phpunit

- name: Checkout del código y actualización de referencias de Git
run: |
git fetch --prune --unshallow
git checkout develop
git pull origin develop
- name: Ejecutar PHPUnit
>>>>>>> a300cabbf6e8032c697d650637c14b4fea4669d7
run: php artisan test

2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
run: |
sshpass -p ${{ secrets.SSH_PASSWORD }} ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "cd /var/www/html/ita-profiles-backend && git checkout ."
sshpass -p ${{ secrets.SSH_PASSWORD }} ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "cd /var/www/html/ita-profiles-backend && git pull origin develop"
sshpass -p ${{ secrets.SSH_PASSWORD }} ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "cd /var/www/html/ita-profiles-backend && sed -i 's|^L5_SWAGGER_CONST_HOST=.*|L5_SWAGGER_CONST_HOST=https://itaperfils.eurecatacademy.org|' .env"
sshpass -p ${{ secrets.SSH_PASSWORD }} ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "cd /var/www/html/ita-profiles-backend && sed -i 's|^L5_SWAGGER_CONST_HOST=.*|L5_SWAGGER_CONST_HOST=|' .env"
sshpass -p ${{ secrets.SSH_PASSWORD }} ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "cd /var/www/html/ita-profiles-backend && sed -i 's|^API_VERSION=.*|API_VERSION=/api/v1/|' .env"
sshpass -p ${{ secrets.SSH_PASSWORD }} ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "cd /var/www/html/ita-profiles-backend && sed -i 's|^DB_CONNECTION=.*|DB_CONNECTION=mysql|' .env"
sshpass -p ${{ secrets.SSH_PASSWORD }} ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "cd /var/www/html/ita-profiles-backend && sed -i 's|^DB_HOST=.*|DB_HOST=127.0.0.1|' .env"
Expand Down
21 changes: 14 additions & 7 deletions Dockerfile → BackendDockerFile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ WORKDIR /var/www/html
RUN a2enmod rewrite

RUN apt-get update && apt-get install -y \
wait-for-it \
libicu-dev \
libmariadb-dev \
unzip zip \
Expand All @@ -24,11 +25,17 @@ RUN docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg \

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

COPY . /var/www/html/
RUN COMPOSER_ALLOW_SUPERUSER=1 composer install --working-dir=/var/www/html
RUN cp .env.docker .env
RUN php artisan key:generate
ADD https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh /usr/local/bin/wait-for-it.sh
RUN chmod +x /usr/local/bin/wait-for-it.sh

# Exponer el puerto 8000
#EXPOSE 80
#
## Iniciar el servidor web de PHP
CMD ["php", "artisan", "cache:clear"]
CMD ["php", "artisan", "config:clear"]
CMD ["php", "artisan", "config:cache"]
# Copiar el script de inicialización
COPY init.sh /usr/local/bin/init.sh
RUN chmod +x /usr/local/bin/init.sh

EXPOSE 8000

ENTRYPOINT ["/usr/local/bin/init.sh"]
25 changes: 25 additions & 0 deletions FrontendDockerFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM php:8.1.27-apache
WORKDIR /var/www/html

RUN apt-get update && apt-get install -y \
curl \
gnupg \
build-essential

# Agregar las siguientes líneas para instalar Node.js y npm
RUN apt-get update && apt-get install -y curl gnupg
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
RUN apt-get install -y nodejs

COPY . /var/www/html/

# Copiar el script de inicialización
COPY init.sh /usr/local/bin/init.sh
RUN chmod +x /usr/local/bin/init.sh

# levanta npm
RUN node -v && npm -v
RUN npm install
RUN npm run build

EXPOSE 80
41 changes: 31 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,41 @@
.PHONY: up
.PHONY: up down full-restart start composer-install composer-update ssh run-tests swagger-generate logs kill-containers help

up:
up: ## Bring up the Docker containers and build images if necessary
docker compose up --build -d
down:

down: ## Stop and remove the Docker containers
docker compose down
full-restart:

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
start:

start: ## Start the Laravel server in the container
docker exec -it itaprofilesbackend-app php artisan serve --host=0.0.0.0 --port=8000
composer-install:

composer-install: ## Run 'composer install' inside the container
docker exec -it itaprofilesbackend-app composer install
composer-update:

composer-update: ## Run 'composer update' inside the container
docker exec -it itaprofilesbackend-app composer update
ssh:

ssh: ## Open a bash session inside the container
docker exec -it itaprofilesbackend-app bash
run-tests:

run-tests: ## Run PHPUnit tests inside the container
docker exec -it itaprofilesbackend-app ./vendor/bin/phpunit -c phpunit.xml ./tests/ --testdox
swagger-generate:

swagger-generate: ## Generate Swagger documentation
docker exec -it itaprofilesbackend-app php artisan l5-swagger:generate

logs: ## Show logs from all services in real time
docker compose logs -f

kill-containers: ## Kill all running Docker containers
@if [ "$$(docker ps -q)" ]; then \
docker kill $$(docker ps -q); \
else \
echo "No containers are running."; \
fi

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}'
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ ITA Profiles is a project from IT Academy post-specialization course that allows

The project now integrates both frontend and backend functionalities to provide a seamless experience for users.

We have a "production" url for this project placed here:

Backend: https://ita-profiles.onrender.com/api/documentation

Frontend: https://ita-profiles.netlify.app/

## How to install the project

We use docker containers to share the same versions of PHP and MySQL around all the team members. After cloning the project in your local environment, follow these steps:
Expand Down
Loading

0 comments on commit d6b8e4d

Please sign in to comment.