Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
formidablae committed Oct 25, 2021
0 parents commit b658c4c
Show file tree
Hide file tree
Showing 10 changed files with 193 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
APP_ENV=local
APP_DEBUG=true
APP_KEY=
APP_TIMEZONE="Europe/Rome"

PHP_HOST_PORT=8252
MYSQL_HOST_PORT=3310

# For accepted values: https://xdebug.org/docs/all_settings#mode
XDEBUG_MODE=off

LOG_CHANNEL=stack
LOG_SLACK_WEBHOOK_URL=

DB_CONNECTION=mysql
DB_HOST=a-lumen-blog-db
DB_PORT=3306
DB_ENGINE=InnoDB
DB_CHARSET=utf8
DB_COLLATION=utf8_general_ci
DB_DATABASE=a_lumen_blog_sviluppo
DB_USERNAME=root
DB_PASSWORD=root

CACHE_DRIVER=file
QUEUE_DRIVER=sync
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/vendor
/.idea
Homestead.json
Homestead.yaml

.env*
!.env.example

.phpunit.result.cache

.vscode/*
!.vscode/settings.json
!.vscode/launch.json

private/tmp

/tmp
2 changes: 2 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
25 changes: 25 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9003,
"pathMappings": {
"/var/www/html": "${workspaceRoot}"
}
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9003
}
]
}
10 changes: 10 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"phpunit.phpunit": "/var/www/html/vendor/bin/phpunit",
"phpunit.command": "docker-compose run --rm a-lumen-blog-backend",
"phpunit.paths": {
"${workspaceFolder}": "/var/www/html"
},
"phpunit.args": [
"--coverage-html /tmp"
]
}
34 changes: 34 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM php:8.0-apache

# Install PHP and composer dependencies
RUN apt-get update
RUN apt-get install -y git curl libmcrypt-dev libjpeg-dev libpng-dev libonig-dev libfreetype6-dev libbz2-dev libzip-dev zip unzip

# mod_rewrite for URL rewrite and mod_headers for .htaccess extra headers like Access-Control-Allow-Origin-
RUN a2enmod rewrite headers

RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"

RUN docker-php-ext-install \
opcache \
pdo_mysql \
mysqli \
zip

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

# Fix permissions
RUN chmod 1777 /tmp
RUN chown -R www-data:www-data /var/www

# Change uid and gid of apache to docker user uid/gid
RUN usermod -u 1000 www-data && groupmod -g 1000 www-data

# Xdebug
RUN pecl install xdebug \
&& docker-php-ext-enable xdebug
RUN echo "xdebug.start_with_request=yes" >> $PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini
RUN echo "xdebug.discover_client_host=1" >> $PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini
RUN echo "xdebug.idekey=BEST_IDE" >> $PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini
RUN echo "xdebug.client_host=host.docker.internal" >> $PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Aronne Brivio

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# A Lumen Blog
Your first step towards mastering [Lumen](https://lumen.laravel.com).

## Requirements
- [Docker](https://www.docker.com/)

## Installation and usage
This is a template repository: don't work directly on this project and don't clone it unless you want to suggest changes on the template itself.
Instead, you can use the ["Use this template"](https://github.com/fattureincloud/a-lumen-blog/generate) feature that GitHub provides to create your own new repository to work on.

Please refer to the [Wiki section](https://github.com/fattureincloud/a-lumen-blog/wiki).
47 changes: 47 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
version: "3.5"
# All parameters used are in .env file
services:
a-lumen-blog-backend:
image: fattureincloud/php:8.0-playground
container_name: a-lumen-blog-backend
environment:
- XDEBUG_MODE=${XDEBUG_MODE}
user: "www-data:www-data"
volumes:
# Code
- .:/var/www/html:cached
# container /tmp folder, used for profiler and other stuff
- ./private/tmp:/tmp:delegated
ports:
- ${PHP_HOST_PORT}:80
networks:
backend:
aliases:
- a-lumen-blog-backend

a-lumen-blog-db:
image: mysql:8
# !IMPORTANT!: This must be the same as DB_HOST variable in .env file
container_name: a-lumen-blog-db
# needed as of mysql 8
command: --default-authentication-plugin=mysql_native_password
volumes:
# Persistent DB data
- a-lumen-blog-db-data:/var/lib/mysql:delegated
environment:
- MYSQL_ROOT_PASSWORD=${DB_PASSWORD}
- MYSQL_DATABASE=${DB_DATABASE}
ports:
- ${MYSQL_HOST_PORT}:3306
networks:
backend:
aliases:
- a-lumen-blog-db

volumes:
a-lumen-blog-db-data:
driver: local

networks:
backend:
name: a-lumen-blog-network
Empty file added private/.gitkeep
Empty file.

0 comments on commit b658c4c

Please sign in to comment.