Skip to content

Commit

Permalink
fix: use proper database and debugging configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
FinalAngel committed Apr 26, 2024
1 parent 7630fde commit c4f3a26
Show file tree
Hide file tree
Showing 10 changed files with 473 additions and 391 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Deploy template

on:
push:
schedule:
- cron: "10 14 * * *"

jobs:
build:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_DATABASE: db
MYSQL_ALLOW_EMPTY_PASSWORD: yes
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install divio-cli
- name: Deploy to Divio
run: |
divio login ${{ secrets.DIVIO_TOKEN }}
divio app deploy test --remote-id ${{ secrets.DIVIO_WEBSITE_ID }} --build-mode FORCE
- name: Test if website is reachable
run: |
curl -v -s --retry 10 --retry-connrefused ${{ secrets.WEBSITE_URL }}
- name: Report error to Sentry
if: failure()
run: |
curl -sL https://sentry.io/get-cli/ | bash
export SENTRY_DSN=${{ secrets.SENTRY_DSN }}
MESSAGE_HEAD='Template: "${{ github.workflow }}" failed in ${{ github.repository }}.'
MESSAGE_BODY='Check <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}> for more details.'
sentry-cli send-event -m "$MESSAGE_HEAD" -m "$MESSAGE_BODY" --log-level=error
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Thank you for contributing! We appreciate your involvement in making this projec

Proposals can be submitted through:

- [Pull Requests](https://github.com/divio/getting-started-with-php-laravel/pulls)
- [Issues](https://github.com/divio/getting-started-with-php-laravel/issues)
- [Pull Requests](https://github.com/divio/getting-started-with-laravel/pulls)
- [Issues](https://github.com/divio/getting-started-with-laravel/issues)

## Pull Requests and Branches

Expand Down
15 changes: 11 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
FROM php:8.3-apache
FROM php:8.3-fpm

ENV COMPOSER_ALLOW_SUPERUSER=1

WORKDIR /var/www/html

RUN apt-get update -y && apt-get install -y openssl zip unzip git
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
RUN docker-php-ext-install mysqli pdo pdo_mysql

# install composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

COPY composer.* /var/www/html/
RUN composer install --no-interaction --no-dev --no-scripts

COPY . /var/www/html
RUN composer install --prefer-dist

EXPOSE 80

# generate a custom APP_KEY within your environment variables
ENV APP_KEY=${APP_KEY:-"base64:iwGHg6152clSDBYopOY0WR7NjX7sItBuRNArsnLPlTk="}

CMD ["php", "artisan", "serve", "--host", "0.0.0.0", "--port", "80"]
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Getting Started with Laravel

[![Deploy to Divio](https://img.shields.io/badge/DEPLOY-TO%20DIVIO-DFFF67?logo=docker&logoColor=white&labelColor=333333)](https://control.divio.com/app/new/?template_url=https://github.com/divio/getting-started-with-php-laravel/archive/refs/heads/main.zip)
[![Deploy to Divio](https://img.shields.io/badge/DEPLOY-TO%20DIVIO-DFFF67?logo=docker&logoColor=white&labelColor=333333)](https://control.divio.com/app/new/?template_url=https://github.com/divio/getting-started-with-laravel/archive/refs/heads/main.zip)

Welcome to our QuickStart template – your portal to swift application development and seamless local testing. Whether you're delving into Laravel for the first time or optimizing your workflow, our template, based on [Creating a Laravel Project](https://laravel.com/docs/10.x/installation#creating-a-laravel-project) guide, has got you covered.
Welcome to our QuickStart template – your portal to swift application development and seamless local testing. Whether you're delving into Laravel for the first time or optimizing your workflow, our template, based on [Creating a Laravel Project](https://laravel.com/docs/master/installation#creating-a-laravel-project) guide, has got you covered.

## Cloud Setup

Expand All @@ -21,5 +21,7 @@ Alternatively, build this app locally using Docker:

1. Ensure [Docker](https://docs.docker.com/get-docker/) is installed and running.
2. Run `docker compose build` to build fresh images.
3. Run `docker compose up` to start the project.
4. Open `http://localhost:8000`.
3. Install dependencies using `docker compose run --rm web composer install`.
4. Run migrations through `docker compose run --rm web php artisan migrate`.
5. Run `docker compose up` to start the project.
6. Open `http://localhost:8000`.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"laravel/sail": "^1.26",
"mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.0",
"phpunit/phpunit": "^10.5",
"phpunit/phpunit": "^11.0.1",
"spatie/laravel-ignition": "^2.4"
},
"autoload": {
Expand Down
Loading

0 comments on commit c4f3a26

Please sign in to comment.