Last active
April 4, 2023 01:20
-
-
Save IgorDePaula/6869b855cd09c4f818ceb189169f1dca to your computer and use it in GitHub Desktop.
Laravel com redis e laravel-echo-server
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
version: "3" | |
services: | |
laravel_app: | |
container_name: "laravel_app" | |
build: | |
context: .docker/app/ | |
dockerfile: Dockerfile | |
restart: "always" | |
environment: | |
- APACHE_DOCUMENT_ROOT=/var/www/public | |
volumes: | |
- ./:/var/www | |
ports: | |
- "8900:80" | |
depends_on: | |
- laravel_db | |
links: | |
- laravel_db | |
- laravel_redis | |
laravel_echo_server: | |
container_name: "laravel_echo_server" | |
build: | |
context: .docker/echo/ | |
dockerfile: Dockerfile | |
restart: "always" | |
volumes: | |
- ./.docker/echo:/var/www/ | |
ports: | |
- "6001:6001" | |
depends_on: | |
- laravel_app | |
- laravel_redis | |
links: | |
- laravel_app | |
- laravel_redis | |
laravel_db: | |
container_name: "laravel_db" | |
image: mysql | |
command: --default-authentication-plugin=mysql_native_password | |
restart: always | |
ports: | |
- "3306:3306" | |
environment: | |
- MYSQL_RANDOM_ROOT_PASSWORD=true | |
- MYSQL_DATABASE=${DB_DATABASE} | |
- MYSQL_USER=${DB_USERNAME} | |
- MYSQL_PASSWORD=${DB_PASSWORD} | |
laravel_redis: | |
container_name: "laravel_redis" | |
image: redis | |
restart: always | |
ports: | |
- "6379:6379" | |
volumes: | |
- ./.docker/.laravel_redis:/usr/local/etc/redis |
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
# .docker/app/Dockerfile | |
FROM composer:latest AS composer | |
FROM php:7.3-apache | |
RUN apt-get update && apt-get install -y \ | |
unzip \ | |
git \ | |
zip \ | |
nano \ | |
curl \ | |
zlib1g-dev \ | |
libzip-dev \ | |
libxml2-dev \ | |
libpng-dev \ | |
gnupg2 \ | |
&& docker-php-ext-install -j$(nproc) zip sockets pdo pdo_mysql mysqli dom gd | |
RUN pecl install redis \ | |
&& curl -sL https://deb.nodesource.com/setup_10.x | bash - \ | |
&& docker-php-ext-enable redis | |
COPY --from=composer /usr/bin/composer /usr/bin/composer | |
WORKDIR /var/www | |
RUN a2enmod rewrite | |
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf | |
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf |
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
# .docker/echo/Dockerfile | |
FROM node:erbium-alpine3.10 | |
RUN npm install -g laravel-echo-server | |
RUN mkdir -p /var/www | |
WORKDIR /var/www | |
EXPOSE 6001 | |
RUN ls /var/www | |
ENTRYPOINT laravel-echo-server start |
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
// .docker/echo/laravel-echo-server.json | |
{ | |
"authHost": "http://localhost:8900", | |
"authEndpoint": "/broadcasting/auth", | |
"clients": [], | |
"database": "redis", | |
"databaseConfig": { | |
"redis": { | |
"host":"laravel_redis" | |
}, | |
"sqlite": { | |
"databasePath": "/database/laravel-echo-server.sqlite" | |
} | |
}, | |
"devMode": true, | |
"host": null, | |
"port": "6001", | |
"protocol": "http", | |
"socketio": {}, | |
"sslCertPath": "", | |
"sslKeyPath": "", | |
"sslCertChainPath": "", | |
"sslPassphrase": "", | |
"subscribers": { | |
"http": true, | |
"redis": true | |
}, | |
"apiOriginAllow": { | |
"allowCors": true, | |
"allowOrigin": "*", | |
"allowMethods": "*", | |
"allowHeaders": "*" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment