Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
rtwent committed Jun 13, 2022
0 parents commit c53669e
Show file tree
Hide file tree
Showing 130 changed files with 12,534 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM php:8.1-fpm

RUN apt-get update && \
apt-get install -y --no-install-recommends libssl-dev zlib1g-dev curl git unzip libxml2-dev libpq-dev libzip-dev && \
pecl install apcu && \
docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql && \
docker-php-ext-install -j$(nproc) zip opcache intl pdo_pgsql pgsql && \
docker-php-ext-enable apcu pdo_pgsql sodium && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

COPY --from=composer /usr/bin/composer /usr/bin/composer

WORKDIR /var/www/html

#CMD composer i -o ; wait-for-it db:5432 -- artisan migrate ; php-fpm

EXPOSE 9000
33 changes: 33 additions & 0 deletions .docker/conf/nginx/templates/default.conf.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
server {
charset utf-8;
client_max_body_size 128M;
listen 80 default_server;
listen [::]:80 default_server;
server_name laravel-test.com;
root /var/www/html/public;
index index.php;

error_log /var/log/nginx/api_error.log;
access_log /var/log/nginx/api_access.log;

location / {
try_files $uri /index.php$is_args$args;
}

location ~ ^/index\.php(/|$) {
fastcgi_pass laravel_php:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;

fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
internal;
}

location ~ \.php$ {
return 404;
}
}
4 changes: 4 additions & 0 deletions .docker/conf/php/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
date.timezone = Europe/Kiev

display_errors = 1
error_reporting = E_ALL
6 changes: 6 additions & 0 deletions .docker/conf/postgres/pg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
psql --command "CREATE USER docker WITH SUPERUSER PASSWORD 'docker';" &&\
createdb -O docker docker

# echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/10.14/main/pg_hba.conf

# echo "listen_addresses='*'" >> /etc/postgresql/10.14/main/postgresql.conf
9 changes: 9 additions & 0 deletions .docker/image-files/root/_bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
echo "PHP version: ${PHP_VERSION}"

if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion.d/yii ]; then
. /etc/bash_completion.d/yii
fi
fi
10 changes: 10 additions & 0 deletions .docker/image-files/usr/local/bin/composer
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

set -e

if [ -n "${GITHUB_API_TOKEN}" ]
then
composer.phar config -g github-oauth.github.com ${GITHUB_API_TOKEN}
fi

composer.phar "$@"
28 changes: 28 additions & 0 deletions .docker/image-files/usr/local/bin/docker-php-entrypoint
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh
set -e

# Set permissions based on ENV variable (debian only)
if [ -x "$(command -v usermod)" ] ; then
usermod -u ${PHP_USER_ID} www-data
fi

# Enable xdebug by ENV variable
if [ 0 -ne "${PHP_ENABLE_XDEBUG:-0}" ] ; then
docker-php-ext-enable xdebug
echo "Enabled xdebug"
fi

export PS1="\e[0;35mphd \e[0;37m\u container \h \e[0;32m\w \e[0;0m\n$ "

# first arg is `-f` or `--some-option`
if [ "${1#-}" != "$1" ]; then
if [ -x "$(command -v apache2-foreground)" ]; then
set -- apache2-foreground "$@"
elif [ -x "$(command -v php-fpm)" ]; then
set -- php-fpm "$@"
else
set -- php "$@"
fi
fi

exec "$@"
29 changes: 29 additions & 0 deletions .docker/image-files/usr/local/etc/php/conf.d/base.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
; Required timezone
date.timezone = UTC

; General settings
memory_limit=128M
max_execution_time=30
sys_temp_dir=/tmp
upload_max_filesize=512M
upload_tmp_dir=/tmp
post_max_size=512M

; Security, Debug & Logs
expose_php=off
cgi.fix_pathinfo=0
log_errors=on
error_reporting=E_ALL
html_errors=on
xdebug.default_enable=off

; Opcache
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
;opcache.validate_timestamps=off
opcache.fast_shutdown=0
opcache.enable_cli=1

; PHP language options
short_open_tag=0
10 changes: 10 additions & 0 deletions .docker/image-files/usr/local/etc/php/conf.d/xdebug.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
;zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_connect_back=0
;;; if you are on macOS, use host.docker.internal to identify the host machine, due to a network limitation on mac (https://docs.docker.com/docker-for-mac/networking/#port-mapping)
;;; otherwise find host ip
xdebug.remote_host=host.docker.internal
;;; avoid standard port (9000) conflicts using 9005 port
xdebug.remote_port=9005
xdebug.idekey=PHPStorm
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2

[docker-compose.yml]
indent_size = 4
58 changes: 58 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
### DOCKER ENVs ###
LOCAL_PROJECT_PATH=/home/r22/projects/www/laravel_test/
LOCAL_NGINX_PORT=8093
LOCAL_POSTGRES_PORT=54324
### ###

APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:oc8lu4B0vqBWNmyM0HyEyzicg/4LKPN7WCWRq8y5YS0=
APP_DEBUG=true
APP_URL=http://localhost:80

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=pgsql
DB_HOST=laravel_db
DB_PORT=5432
DB_DATABASE=laravel_test
DB_USERNAME=postgres
DB_PASSWORD=postgres

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database
SESSION_DRIVER=file
SESSION_LIFETIME=120

MEMCACHED_HOST=127.0.0.1

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
52 changes: 52 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

MEMCACHED_HOST=127.0.0.1

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
10 changes: 10 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
* text=auto

*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php

/.github export-ignore
CHANGELOG.md export-ignore
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/node_modules
/public/hot
/public/storage
/storage/*.key
/vendor
.env.backup
.phpunit.result.cache
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
/.idea
/.vscode
/.docker/data
12 changes: 12 additions & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
php:
preset: laravel
disabled:
- no_unused_imports
finder:
not-name:
- index.php
js:
finder:
not-name:
- webpack.mix.js
css: true
18 changes: 18 additions & 0 deletions ApiRequestForIde/auth.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
### Try to register a user
POST {{host}}/user/auth
Content-Type: application/json

{
"email": "[email protected]",
"password": "content23"
}

### Try to register a user with token already provided
POST {{host}}/user/auth
Content-Type: application/json
Authorization: Bearer {{auth_token}}

{
"email": "[email protected]",
"password": "content23"
}
6 changes: 6 additions & 0 deletions ApiRequestForIde/http-client.env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"dev": {
"host": "http://localhost:8093/api",
"auth_token": "9|PY8c7rn3hJtg1g7ex9hYFZjT6mWADMWVKrxZoh7a"
}
}
10 changes: 10 additions & 0 deletions ApiRequestForIde/profile.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
### Try to register a user
PATCH {{host}}/user/profile
Content-Type: application/json
Authorization: Bearer {{auth_token}}
Accept: application/json

{
"timezone": "Europe/Kiev",
"language": "RU"
}
20 changes: 20 additions & 0 deletions ApiRequestForIde/register.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
### Try to register a user
POST {{host}}/user/register
Content-Type: application/json

{
"email": "testtest@com",
"password": "content23",
"password_confirmation": "content23"
}


### Try to register a user with not valid data
POST {{host}}/user/register
Content-Type: application/json

{
"email": "testtest.com",
"password": "cont",
"password_confirmation": "content23"
}
Loading

0 comments on commit c53669e

Please sign in to comment.