Skip to content

Commit 91bcd16

Browse files
Update
1 parent f9345c3 commit 91bcd16

File tree

8 files changed

+60
-124
lines changed

8 files changed

+60
-124
lines changed

Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
include .env
2+
3+
help:
4+
@echo ""
5+
@echo "usage: make COMMAND"
6+
@echo ""
7+
@echo "Commands:"
8+
@echo " apidoc Generate documentation of API"
9+
@echo " code-sniff Check the API with PHP Code Sniffer (PSR2)"
10+
@echo " clean Clean directories for reset"
11+
@echo " composer-up Update PHP dependencies with composer"
12+
@echo " docker-start Create and start containers"
13+
@echo " docker-stop Stop and clear all services"
14+
@echo " gen-certs Generate SSL certificates"
15+
@echo " logs Follow log output"
16+
@echo " mysql-dump Create backup of all databases"
17+
@echo " mysql-restore Restore backup of all databases"
18+
@echo " phpmd Analyse the API with PHP Mess Detector"
19+
@echo " test Test application"
20+
121
# make init
222
init:
323
cp .env_example .env;

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,20 @@ To install, you need to install docker locally.
1313
- Quick, easy setup for everything you need
1414
- Lots of useful examples
1515

16+
### What's inside
17+
18+
* [Nginx](http://nginx.org/)
19+
* [MySQL](http://www.mysql.com/)
20+
* [PHP-FPM](http://php-fpm.org/)
21+
* [Redis](http://redis.io/)
22+
23+
### Requirements
24+
25+
* [Docker Engine](https://docs.docker.com/installation/)
26+
* [Docker Compose](https://docs.docker.com/compose/)
27+
* [Docker Machine](https://docs.docker.com/machine/) (Mac and Windows only)
28+
1629
### How start work
17-
First make sure you have [Docker](https://docs.docker.com/get-docker/) installed locally.
1830

1931
Clone current project:
2032
```bash
@@ -29,7 +41,7 @@ Fill configuration in .env file
2941
docker-compose build && docker-compose up
3042
```
3143

32-
After open in browser [http://localhost](http://localhost)
44+
After open in browser [http://127.0.0.1/](http://127.0.0.1/)
3345

3446
### Support
3547

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ services:
6060
volumes:
6161
- ./src:/var/www/backend
6262
- ./logs/supervisor/:/var/log/supervisor/
63+
- ./logs/cron/:/var/log/cron/
6364
ports:
6465
- "9001:9001" # Access GUI with http://localhost:9001/
6566
networks:

docker/backend/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
FROM php:8.1-fpm
22

3+
# Set timezone
4+
RUN echo "UTC" > /etc/timezone
5+
36
# Install dependencies
47
RUN apt-get update && apt-get install -y \
58
nano \
@@ -20,6 +23,12 @@ COPY php/conf.d/xdebug.ini $PHP_INI_DIR/conf.d/
2023
COPY supervisor/supervisord.conf /etc/supervisor
2124
COPY supervisor/conf.d/* /etc/supervisor/conf.d
2225

26+
COPY cron/crontab /etc/cron.d/crontab
27+
RUN chmod 0644 /etc/cron.d/crontab
28+
RUN crontab /etc/cron.d/crontab
29+
30+
RUN mkdir -p /var/log/cron
31+
2332
# Install and enable pecl php extentions
2433
RUN pecl install xdebug redis
2534
RUN docker-php-ext-enable xdebug redis

docker/backend/cron/crontab

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
SHELL=/bin/sh
2+
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
3+
4+
# ,------ MINUTE
5+
# / ,----- HOUR
6+
# / / ,---- DAY OF MONTH
7+
# / / / ,--- MONTH
8+
# / / / / ,-- DAY OF WEEK
9+
#/ / / / /
10+
* * * * * /usr/local/bin/php /var/www/backend/src/bin/cron.php >> /var/log/cron/cron.log 2>&1
11+
# Don't remove the empty line at the end of this file. It is required to run the cron job

src/src/bin/cron.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
3+
echo "Cron work! See in logs/cron/cron.log" . PHP_EOL;

src/src/bin/message.log

Lines changed: 0 additions & 120 deletions
This file was deleted.

src/src/bin/supervisor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
$i = 1;
44

55
while (true) {
6-
file_put_contents('message.log', 'Hello '.++$i.PHP_EOL, FILE_APPEND);
6+
file_put_contents('supervisor-debug.log', 'Hello '.++$i.PHP_EOL, FILE_APPEND);
77

8-
sleep(3);
8+
sleep(5);
99
}

0 commit comments

Comments
 (0)