Merhaba iyi günler,
Aşağıda geliştirme ortamıma ait gerekli dosyalar var. Ben Docker-compose ile uygulamamı kullanıyorum fakat birdenbire veritabanı kendini sıfırlıyor. Bu neden kaynaklanıyor olabilir?
Dockercompose
version: '3.7'
services:
laravel-app:
container_name: api
build:
context: ./b2b-api-back
dockerfile: Dockerfile
volumes:
- ./b2b-api-back:/var/www
- laravel_storage:/var/www/storage
ports:
- 9000:9000
networks:
- sail
depends_on:
- mysql
client:
container_name: client
build:
context: ./metronic-test
dockerfile: Dockerfile
volumes:
- ./client:/usr/src/app
ports:
- 5173:5173
networks:
- sail
depends_on:
- laravel-app
command: ["npm", "run", "dev", "--", "--host", "0.0.0.0"]
environment:
- NODE_ENV=production
nginx:
image: nginx:latest
container_name: nginx
ports:
- 80:80
- 443:443
volumes:
- ./nginx:/etc/nginx/conf.d
networks:
- sail
depends_on:
- client
mysql:
container_name: mysql
image: mysql:8.0.33
restart: unless-stopped
tty: true
volumes:
- db_data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: 12345678
MYSQL_DATABASE: laravel
MYSQL_USER: lion
MYSQL_PASSWORD: 1234567
networks:
- sail
ports:
- 3306:3306
redis:
container_name: redis
image: redis:latest
volumes:
- sailredis:/data
networks:
- sail
ports:
- '6379:6379'
portainer:
container_name: portainer
image: portainer/portainer-ce
restart: unless-stopped
ports:
- 9443:9000
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- portainer_data:/data
networks:
- sail
networks:
sail:
volumes:
db_data: {}
laravel_storage: {}
sailredis: {}
portainer_data:
nginx: {}
Dockerfile
FROM php:8.2-fpm
RUN apt-get update && apt-get install -y \
zlib1g-dev \
libpng-dev \
libxml2-dev \
libzip-dev \
libonig-dev \
zip \
curl \
unzip \
git \
nano \
&& docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd zip opcache xml \
&& pecl install redis \
&& docker-php-ext-enable redis \
&& docker-php-source delete
COPY --from=composer /usr/bin/composer /usr/bin/composer
WORKDIR /var/www
COPY . /var/www
RUN composer install --no-dev
RUN composer require laravel/horizon
RUN chown -R www-data:www-data /var/www/storage /var/www/bootstrap/cache && \
chmod -R 775 /var/www/storage /var/www/bootstrap/cache
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
RUN sed -i 's/post_max_size = 8M/post_max_size = 100M/' "$PHP_INI_DIR/php.ini"
RUN sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 100M/' "$PHP_INI_DIR/php.ini"
CMD php artisan horizon:install
CMD php artisan serve --host=0.0.0.0 --port=9000
# CMD php artisan serve --host=0.0.0.0
EXPOSE 9000
mysql servisime ait loglar :
2023-09-14 06:35:30+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.33-1.el8 started.
2023-09-14 06:35:30+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2023-09-14 06:35:30+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.33-1.el8 started.
'/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
2023-09-14T06:35:31.521727Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
2023-09-14T06:35:31.525426Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.33) starting as process 1
2023-09-14T06:35:31.535062Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-09-14T06:35:31.871420Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-09-14T06:35:32.061494Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2023-09-14T06:35:32.061537Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2023-09-14T06:35:32.063190Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2023-09-14T06:35:32.106483Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
2023-09-14T06:35:32.106527Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.33' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL.