perf(docker): add redis caching service for development
update Dockerfile to include php redis extension - update development docs
This commit is contained in:
parent
d372d6746c
commit
05ace8cff2
|
@ -17,6 +17,10 @@ RUN apt-get update && apt-get install -y \
|
||||||
RUN docker-php-ext-configure gd --with-jpeg-dir=/usr/include/ \
|
RUN docker-php-ext-configure gd --with-jpeg-dir=/usr/include/ \
|
||||||
&& docker-php-ext-install gd
|
&& docker-php-ext-install gd
|
||||||
|
|
||||||
|
RUN pecl install -o -f redis \
|
||||||
|
&& rm -rf /tmp/pear \
|
||||||
|
&& docker-php-ext-enable redis
|
||||||
|
|
||||||
RUN docker-php-ext-install mysqli && docker-php-ext-enable mysqli
|
RUN docker-php-ext-install mysqli && docker-php-ext-enable mysqli
|
||||||
|
|
||||||
RUN echo "file_uploads = On\n" \
|
RUN echo "file_uploads = On\n" \
|
||||||
|
|
|
@ -16,10 +16,21 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- .:/castopod
|
- .:/castopod
|
||||||
depends_on:
|
depends_on:
|
||||||
|
- redis
|
||||||
- mariadb
|
- mariadb
|
||||||
networks:
|
networks:
|
||||||
- castopod
|
- castopod
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image: "redis:alpine"
|
||||||
|
container_name: "castopod_redis"
|
||||||
|
ports:
|
||||||
|
- 6379:6379
|
||||||
|
volumes:
|
||||||
|
- redis:/data
|
||||||
|
networks:
|
||||||
|
- castopod
|
||||||
|
|
||||||
mariadb:
|
mariadb:
|
||||||
image: mariadb:latest
|
image: mariadb:latest
|
||||||
container_name: castopod_mariadb
|
container_name: castopod_mariadb
|
||||||
|
@ -69,5 +80,6 @@ services:
|
||||||
- castopod
|
- castopod
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
|
redis:
|
||||||
mariadb:
|
mariadb:
|
||||||
phpmyadmin:
|
phpmyadmin:
|
||||||
|
|
|
@ -36,15 +36,29 @@ git clone https://code.podlibre.org/podlibre/castopod.git
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Create a `.env` file with the minimum required config to connect the app to
|
2. Create a `.env` file with the minimum required config to connect the app to
|
||||||
the database:
|
the database and use redis as a cache handler:
|
||||||
|
|
||||||
```ini
|
```ini
|
||||||
CI_ENVIRONMENT="development"
|
CI_ENVIRONMENT="development"
|
||||||
|
|
||||||
|
app.baseURL="http://localhost:8080/"
|
||||||
|
app.mediaBaseURL="http://localhost:8080/"
|
||||||
|
|
||||||
|
app.adminGateway="cp-admin"
|
||||||
|
app.authGateway="cp-auth"
|
||||||
|
|
||||||
database.default.hostname="mariadb"
|
database.default.hostname="mariadb"
|
||||||
database.default.database="castopod"
|
database.default.database="castopod"
|
||||||
database.default.username="podlibre"
|
database.default.username="podlibre"
|
||||||
database.default.password="castopod"
|
database.default.password="castopod"
|
||||||
|
|
||||||
|
cache.handler="redis"
|
||||||
|
cache.redis.host = "redis"
|
||||||
|
|
||||||
|
# You may not want to use redis as your cache handler
|
||||||
|
# Comment/remove the two lines above and uncomment
|
||||||
|
# the next line for file caching.
|
||||||
|
#cache.handler="file"
|
||||||
```
|
```
|
||||||
|
|
||||||
> _NB._ You can tweak your environment by setting more environment variables in
|
> _NB._ You can tweak your environment by setting more environment variables in
|
||||||
|
@ -99,18 +113,19 @@ docker-compose ps
|
||||||
|
|
||||||
# Alternatively, you can check all docker processes (you should see composer and npm with an Exited status)
|
# Alternatively, you can check all docker processes (you should see composer and npm with an Exited status)
|
||||||
docker ps -a
|
docker ps -a
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
> The `docker-compose up -d` command will boot 3 containers in the background:
|
> The `docker-compose up -d` command will boot 4 containers in the background:
|
||||||
>
|
>
|
||||||
> - `castopod_app`: a php based container with codeigniter requirements
|
> - `castopod_app`: a php based container with CodeIgniter4 requirements
|
||||||
> installed
|
> installed
|
||||||
|
> - `castopod_redis`: a [redis](https://redis.io/) database to handle queries
|
||||||
|
> and pages caching
|
||||||
> - `castopod_mariadb`: a [mariadb](https://mariadb.org/) server for persistent
|
> - `castopod_mariadb`: a [mariadb](https://mariadb.org/) server for persistent
|
||||||
> data
|
> data
|
||||||
> - `castopod_phpmyadmin`: a phpmyadmin server to visualize the mariadb database
|
> - `castopod_phpmyadmin`: a phpmyadmin server to visualize the mariadb
|
||||||
>
|
> database.
|
||||||
> _NB._ `./mariadb`, `./phpmyadmin` folders will be mounted in the project's
|
|
||||||
> root directory to persist data and logs.
|
|
||||||
|
|
||||||
## Initialize and populate database
|
## Initialize and populate database
|
||||||
|
|
||||||
|
@ -221,6 +236,12 @@ To see your changes, go to:
|
||||||
# monitor the app container
|
# monitor the app container
|
||||||
docker-compose logs --tail 50 --follow --timestamps app
|
docker-compose logs --tail 50 --follow --timestamps app
|
||||||
|
|
||||||
|
# interact with redis server using included redis-cli command
|
||||||
|
docker exec -it castopod_redis redis-cli
|
||||||
|
|
||||||
|
# monitor the redis container
|
||||||
|
docker-compose logs --tail 50 --follow --timestamps redis
|
||||||
|
|
||||||
# monitor the mariadb container
|
# monitor the mariadb container
|
||||||
docker-compose logs --tail 50 --follow --timestamps mariadb
|
docker-compose logs --tail 50 --follow --timestamps mariadb
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue