-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from skoro/1-docker-compose
Docker integration
- Loading branch information
Showing
10 changed files
with
151 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,14 +19,23 @@ APP_ENV=dev | |
APP_SECRET=b31393636737e68e5f85ac979f37e3da | ||
###< symfony/framework-bundle ### | ||
|
||
### docker env | ||
MYSQL_ROOT_PASSWORD=secret | ||
MYSQL_DATABASE=mirspay | ||
MYSQL_USER=mirspay | ||
MYSQL_PASSWORD=password | ||
MYSQL_HOST=database | ||
### | ||
|
||
###> doctrine/doctrine-bundle ### | ||
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url | ||
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml | ||
# | ||
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db" | ||
# DATABASE_URL="mysql://app:[email protected]:3306/app?serverVersion=8.0.32&charset=utf8mb4" | ||
# DATABASE_URL="mysql://app:[email protected]:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4" | ||
DATABASE_URL="postgresql://app:[email protected]:5432/app?serverVersion=16&charset=utf8" | ||
# DATABASE_URL="postgresql://app:[email protected]:5432/app?serverVersion=16&charset=utf8" | ||
DATABASE_URL="mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@${MYSQL_HOST}:3306/${MYSQL_DATABASE}?serverVersion=8.0.33&charset=utf8mb4" | ||
###< doctrine/doctrine-bundle ### | ||
|
||
# LiqPay gateway parameters. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ APP_SECRET='$ecretf0rt3st' | |
SYMFONY_DEPRECATIONS_HELPER=999999 | ||
PANTHER_APP_ENV=panther | ||
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots | ||
DATABASE_URL="mysql://admin:[email protected]:3306/mirspay?serverVersion=5.7.41&charset=utf8mb4" | ||
|
||
DATABASE_URL="mysql://mirspay:password@database:3306/mirspay?serverVersion=8.0.33&charset=utf8mb4" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,8 +16,24 @@ via various gateways. Please, take a look at the picture below to get an idea ho | |
* MySQL | ||
|
||
## Install | ||
_TBD: make docker installation_ | ||
|
||
### Docker | ||
Close the repository: | ||
```shell | ||
git clone https://github.com/skoro/mirspay.git | ||
``` | ||
|
||
Build and up the image: | ||
```shell | ||
docker compose build | ||
docker compose run --rm app composer install | ||
docker compose up -d | ||
docker compose exec app php bin/console doctrine:migrations:migrate | ||
``` | ||
|
||
### From source code | ||
|
||
Assume PHP, [Symfony CLI](https://symfony.com/download) and MySQL are locally installed. | ||
1. Clone the repository: | ||
```shell | ||
git clone https://github.com/skoro/mirspay.git | ||
|
@@ -26,16 +42,27 @@ _TBD: make docker installation_ | |
```shell | ||
composer install | ||
``` | ||
3. Edit the `.env` file and fill in the necessary variables and payment gateway credentials: | ||
3. Create `.env.local` file and fill in the database dsn: | ||
```dotenv | ||
LIQPAY_PUBLIC_KEY= | ||
LIQPAY_PRIVATE_KEY= | ||
DATABASE_URL="mysql://app:[email protected]:3306/app?serverVersion=8.0.32&charset=utf8mb4" | ||
``` | ||
4. Apply migrations: | ||
```shell | ||
symfony console doctrine:migrations:migrate | ||
``` | ||
4. Start the server. | ||
5. Start the server. | ||
```shell | ||
symfony serve -d | ||
``` | ||
|
||
### Payment Gateways configuration | ||
|
||
1. LiqPay public and private keys: | ||
```dotenv | ||
LIQPAY_PUBLIC_KEY= | ||
LIQPAY_PRIVATE_KEY= | ||
``` | ||
|
||
## API documentation | ||
Two end-points are available for getting the API documentation: | ||
- `/api/doc` swagger ui. | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#version: '3' | ||
|
||
services: | ||
app: | ||
build: | ||
context: ./docker/php | ||
volumes: | ||
- ./docker/php/xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini | ||
- .:/var/www | ||
depends_on: | ||
- database | ||
networks: | ||
- mirspay | ||
nginx: | ||
image: nginx:latest | ||
depends_on: | ||
- app | ||
volumes: | ||
- .:/var/www | ||
- ./docker/nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf | ||
ports: | ||
- '80:80' | ||
networks: | ||
- mirspay | ||
###> doctrine/doctrine-bundle ### | ||
database: | ||
image: 'mysql:8.0' | ||
environment: | ||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} | ||
MYSQL_DATABASE: ${MYSQL_DATABASE} | ||
MYSQL_USER: ${MYSQL_USER} | ||
MYSQL_PASSWORD: ${MYSQL_PASSWORD} | ||
ports: | ||
- '3306:3306' | ||
volumes: | ||
- ./docker/database/init.sql:/docker-entrypoint-initdb.d/init.sql | ||
# You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data! | ||
# - ./docker/db/data:/var/lib/postgresql/data:rw | ||
networks: | ||
- mirspay | ||
###< doctrine/doctrine-bundle ### | ||
|
||
volumes: | ||
###> doctrine/doctrine-bundle ### | ||
database_data: | ||
###< doctrine/doctrine-bundle ### | ||
|
||
networks: | ||
mirspay: | ||
driver: bridge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-- test database | ||
-- .env.test | ||
|
||
CREATE DATABASE `mirspay_test`; | ||
GRANT ALL ON mirspay_test.* TO 'mirspay'@'%'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
upstream app-upstream { | ||
server app:9000; | ||
} | ||
|
||
server { | ||
listen 80 default_server; | ||
listen [::]:80 default_server ipv6only=on; | ||
|
||
server_name localhost; | ||
root /var/www/public; | ||
index index.php index.html index.htm; | ||
|
||
location / { | ||
try_files $uri $uri/ /index.php$is_args$args; | ||
} | ||
|
||
location ~ \.php$ { | ||
try_files $uri /index.php =404; | ||
fastcgi_pass app-upstream; | ||
fastcgi_index index.php; | ||
fastcgi_buffers 16 16k; | ||
fastcgi_buffer_size 32k; | ||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
fastcgi_read_timeout 600; | ||
include fastcgi_params; | ||
} | ||
|
||
location ~ /\.ht { | ||
deny all; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM php:8.3-fpm | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
unzip \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN pecl install xdebug-3.3.2 \ | ||
&& docker-php-ext-enable xdebug \ | ||
&& docker-php-ext-install pdo_mysql opcache bcmath | ||
|
||
# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser | ||
ENV COMPOSER_ALLOW_SUPERUSER=1 | ||
|
||
COPY --from=composer /usr/bin/composer /usr/local/bin/composer | ||
|
||
COPY . /var/www | ||
WORKDIR /var/www |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
zend_extension=xdebug | ||
xdebug.mode=debug | ||
xdebug.start_with_request=yes | ||
xdebug.client_host=host.docker.internal |