diff options
Diffstat (limited to 'srcs')
| -rw-r--r-- | srcs/docker-compose.yml | 57 | ||||
| -rw-r--r-- | srcs/m/Dockerfile | 14 | ||||
| -rwxr-xr-x | srcs/m/entrypoint.sh | 15 | ||||
| -rw-r--r-- | srcs/m/my.cnf | 5 | ||||
| -rw-r--r-- | srcs/m/mysql.yaml | 60 | ||||
| -rw-r--r-- | srcs/metallb-config.yaml | 12 | ||||
| -rw-r--r-- | srcs/mysql/Dockerfile | 27 | ||||
| -rw-r--r-- | srcs/mysql/my.cnf | 129 | ||||
| -rw-r--r-- | srcs/mysql/mysql.yaml | 42 | ||||
| -rwxr-xr-x | srcs/mysql/src/entrypoint.sh | 22 | ||||
| -rw-r--r-- | srcs/mysql/src/my.cnf | 4 | ||||
| -rwxr-xr-x | srcs/mysql/start.sh | 10 | ||||
| -rw-r--r-- | srcs/phpmyadmin/Dockerfile | 4 | ||||
| -rw-r--r-- | srcs/phpmyadmin/config.inc.php | 157 | ||||
| -rw-r--r-- | srcs/wordpress/wp-config.php | 2 |
15 files changed, 443 insertions, 117 deletions
diff --git a/srcs/docker-compose.yml b/srcs/docker-compose.yml deleted file mode 100644 index a0bade4..0000000 --- a/srcs/docker-compose.yml +++ /dev/null @@ -1,57 +0,0 @@ -version: "3.3" -services: - nginx: - build: ./nginx - ports: - - 80:80 - - 443:443 - - wordpress: - depends_on: - - mysql - image: wordpress:latest - restart: always - ports: - - "8080:80" - environment: - WORDPRESS_DB_HOST: mysql:3306 - WORDPRESS_DB_USER: ft_services_user - WORDPRESS_DB_PASSWORD: ft_services_pass - WORDPRESS_DB_NAME: ft_services_db - # container_name: wordpress - networks: - - ft_services_network - - mysql: - image: mysql:5.7 - restart: always - environment: - MYSQL_ROOT_PASSWORD: ft_services_pass_root - MYSQL_USER: ft_services_user - MYSQL_PASSWORD: ft_services_pass - MYSQL_DATABASE: ft_services_db - volumes: - - mysql_data:/var/lib/mysql - # container_name: mysql - networks: - - ft_services_network - - phpmyadmin: - depends_on: - - mysql - image: phpmyadmin/phpmyadmin - restart: always - ports: - - 8081:80 - environment: - PMA_HOST: mysql - MYSQL_ROOT_PASSWORD: root - networks: - - ft_services_network - - -volumes: - mysql_data: -networks: - ft_services_network: - driver: bridge diff --git a/srcs/m/Dockerfile b/srcs/m/Dockerfile new file mode 100644 index 0000000..e66095e --- /dev/null +++ b/srcs/m/Dockerfile @@ -0,0 +1,14 @@ +FROM alpine + +RUN apk update && \ + apk upgrade && \ + apk add mysql mysql-client --no-cache + + +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh +COPY my.cnf /etc/mysql/my.cnf + +EXPOSE 3306 + +CMD ["/entrypoint.sh"] diff --git a/srcs/m/entrypoint.sh b/srcs/m/entrypoint.sh new file mode 100755 index 0000000..ab9a3d9 --- /dev/null +++ b/srcs/m/entrypoint.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +mkdir -p /run/mysqld +mkdir -p /var/lib/mysql + +mysql_install_db --user=root --datadir=/var/lib/mysql > /dev/null + +/usr/bin/mysqld --user=root --datadir=/var/lib/mysql --bootstrap <<EOF +CREATE DATABASE wordpressdb; +CREATE USER 'wordpressuser'@'%' IDENTIFIED BY 'wordpresspass'; +GRANT ALL PRIVILEGES ON wordpressdb.* TO 'wordpressuser'@'%' IDENTIFIED BY 'wordpresspass'; +FLUSH PRIVILEGES; +EOF + +exec /usr/bin/mysqld --user=root --datadir=/var/lib/mysql diff --git a/srcs/m/my.cnf b/srcs/m/my.cnf new file mode 100644 index 0000000..4f5e2c6 --- /dev/null +++ b/srcs/m/my.cnf @@ -0,0 +1,5 @@ +[mysqld] +user = root +port = 3306 +datadir = /var/lib/mysql +log-bin = /var/lib/mysql/mysql-bin diff --git a/srcs/m/mysql.yaml b/srcs/m/mysql.yaml new file mode 100644 index 0000000..ead25b4 --- /dev/null +++ b/srcs/m/mysql.yaml @@ -0,0 +1,60 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: mysql-deployment + labels: + app: mysql +spec: + selector: + matchLabels: + app: mysql + replicas: 1 + strategy: + rollingUpdate: + maxSurge: 1 + template: + metadata: + labels: + app: mysql + spec: + containers: + - image: cacharle-mysql + imagePullPolicy: Never + name: cacharle-mysql-container + # volumeMounts: + # - name: mysql-volume + # mountPath: /var/lib/data + # volumes: + # - name: mysql-volume + # persistentVolumeClaim: + # claimName: mysql-volume + +--- + +apiVersion: v1 +kind: Service +metadata: + name: mysql-service +spec: + type: LoadBalancer + ports: + - name: mysql + port: 3306 + targetPort: 3306 + selector: + app: mysql + +# --- +# +# apiVersion: v1 +# kind: PersistentVolumeClaim +# metadata: +# name: mysql-volume +# labels: +# app: mysql +# spec: +# accessModes: +# - ReadWriteOnce # read/write by one pod +# resources: +# requests: +# storage: 1Gi diff --git a/srcs/metallb-config.yaml b/srcs/metallb-config.yaml new file mode 100644 index 0000000..a9f5928 --- /dev/null +++ b/srcs/metallb-config.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + namespace: metallb-system + name: config +data: + config: | + address-pools: + - name: default + protocol: layer2 + addresses: + - 192.168.99.230-192.168.99.250 diff --git a/srcs/mysql/Dockerfile b/srcs/mysql/Dockerfile index 4afd86f..448080e 100644 --- a/srcs/mysql/Dockerfile +++ b/srcs/mysql/Dockerfile @@ -1,13 +1,16 @@ -FROM alpine - -RUN apk update && \ - apk upgrade && \ - apk add mysql mysql-client --no-cache - - -COPY src/entrypoint.sh /root/entrypoint.sh -COPY src/my.cnf /etc/my.cnf - +FROM alpine:latest +#init +RUN apk -U upgrade +#install nginx/php +RUN apk add vim mysql mysql-client +# RUN apk add telegraf --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ --allow-untrusted --no-cache +#Expose PORT EXPOSE 3306 - -CMD ["/root/entrypoint.sh"] +COPY my.cnf /etc/ +COPY start.sh . +#COPY wordpress . +# COPY init.sql . +#telegraf +# RUN mkdir -p /etc/telegraf +# COPY telegraf.conf /etc/telegraf/telegraf.conf +CMD /bin/sh /start.sh diff --git a/srcs/mysql/my.cnf b/srcs/mysql/my.cnf new file mode 100644 index 0000000..a366ea4 --- /dev/null +++ b/srcs/mysql/my.cnf @@ -0,0 +1,129 @@ +# The MySQL database server configuration file. +# +# You can copy this to one of: +# - "/etc/mysql/my.cnf" to set global options, +# - "~/.my.cnf" to set user-specific options. +# +# One can use all long options that the program supports. +# Run program with --help to get a list of available options and with +# --print-defaults to see which it would actually understand and use. +# +# For explanations see +# http://dev.mysql.com/doc/mysql/en/server-system-variables.html + +# This will be passed to all mysql clients +# It has been reported that passwords should be enclosed with ticks/quotes +# escpecially if they contain "#" chars... +# Remember to edit /etc/mysql/debian.cnf when changing the socket location. +[client] +port = 3306 +socket = /var/run/mysqld/mysqld.sock +default-character-set = utf8mb4 + +# Here is entries for some specific programs +# The following values assume you have at least 32M ram + +# This was formally known as [safe_mysqld]. Both versions are currently parsed. +[mysqld_safe] +socket = /var/run/mysqld/mysqld.sock +nice = 0 + +[mysqld] +# +# * Basic Settings +# +user = mysql +pid-file = /var/run/mysqld/mysqld.pid +socket = /var/run/mysqld/mysqld.sock +port = 3306 +basedir = /usr +datadir = /var/lib/mysql +tmpdir = /tmp +lc-messages-dir = /usr/share/mysql +skip-external-locking +collation_server = utf8mb4_unicode_ci +character_set_server = utf8mb4 +bind-address = 0.0.0.0 + +# +# Instead of skip-networking the default is now to listen only on +# localhost which is more compatible and is not less secure. +# +# * Fine Tuning +# +key_buffer = 16M +max_allowed_packet = 16M +thread_stack = 192K +thread_cache_size = 8 +# This replaces the startup script and checks MyISAM tables if needed +# the first time they are touched +myisam-recover = BACKUP +#max_connections = 100 +#table_cache = 64 +#thread_concurrency = 10 +# +# * Query Cache Configuration +# +query_cache_limit = 1M +query_cache_size = 16M +# +# * Logging and Replication +# +# Both location gets rotated by the cronjob. +# Be aware that this log type is a performance killer. +# As of 5.1 you can enable the log at runtime! +#general_log_file = /var/log/mysql/mysql.log +#general_log = 1 +# +# Error log - should be very few entries. +# +# log_error = /var/log/mysql/error.log +# +# Here you can see queries with especially long duration +#log_slow_queries = /var/log/mysql/mysql-slow.log +#long_query_time = 2 +#log-queries-not-using-indexes +# +# The following can be used as easy to replay backup logs or for replication. +# note: if you are setting up a replication slave, see README.Debian about +# other settings you may need to change. +#server-id = 1 +#log_bin = /var/log/mysql/mysql-bin.log +expire_logs_days = 10 +max_binlog_size = 100M +#binlog_do_db = include_database_name +#binlog_ignore_db = include_database_name +# +# * InnoDB +# +# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/. +# Read the manual for more InnoDB related options. There are many! +# +# * Security Features +# +# Read the manual, too, if you want chroot! +# chroot = /var/lib/mysql/ +# +# For generating SSL certificates I recommend the OpenSSL GUI "tinyca". +# +# ssl-ca=/etc/mysql/cacert.pem +# ssl-cert=/etc/mysql/server-cert.pem +# ssl-key=/etc/mysql/server-key.pem + + + +[mysqldump] +quick +quote-names +max_allowed_packet = 16M + +[mysql] +#no-auto-rehash # faster start of mysql but no tab completion +default-character-set = utf8mb4 +[isamchk] +key_buffer = 16M + +# +# * IMPORTANT: Additional settings that can override those from this file! +# The files must end with '.cnf', otherwise they'll be ignored. +# diff --git a/srcs/mysql/mysql.yaml b/srcs/mysql/mysql.yaml index e97ef71..ead25b4 100644 --- a/srcs/mysql/mysql.yaml +++ b/srcs/mysql/mysql.yaml @@ -21,13 +21,13 @@ spec: - image: cacharle-mysql imagePullPolicy: Never name: cacharle-mysql-container - volumeMounts: - - name: mysql-volume - mountPath: /var/lib/data - volumes: - - name: mysql-volume - persistentVolumeClaim: - claimName: mysql-volume + # volumeMounts: + # - name: mysql-volume + # mountPath: /var/lib/data + # volumes: + # - name: mysql-volume + # persistentVolumeClaim: + # claimName: mysql-volume --- @@ -44,17 +44,17 @@ spec: selector: app: mysql ---- - -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: mysql-volume - labels: - app: mysql -spec: - accessModes: - - ReadWriteOnce # read/write by one pod - resources: - requests: - storage: 1Gi +# --- +# +# apiVersion: v1 +# kind: PersistentVolumeClaim +# metadata: +# name: mysql-volume +# labels: +# app: mysql +# spec: +# accessModes: +# - ReadWriteOnce # read/write by one pod +# resources: +# requests: +# storage: 1Gi diff --git a/srcs/mysql/src/entrypoint.sh b/srcs/mysql/src/entrypoint.sh deleted file mode 100755 index 8d7c1d1..0000000 --- a/srcs/mysql/src/entrypoint.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -mkdir -vp /run/mysqld - -# echo -e 'asdfasdf123\nasdfasdf123\n' | adduser cacharle - -# export MYSQL_ROOT_PASSWORD='' - -mysql_install_db --datadir=/usr/lib/data --user=root - -/usr/bin/mysqld --user=root --bootstrap <<EOF -CREATE DATABASE wordpressdb; -CREATE USER 'root'@'localhost' IDENTIFIED BY 'pass'; -GRANT ALL PRIVILEGES ON wordpressdb.* TO 'root'@'localhost'; -IDENTIFIED BY 'pass'; -FLUSH PRIVILEGES; -EOF - -# until mysql; do -# sleep 5 - -exec /usr/bin/mysqld --user=root --console diff --git a/srcs/mysql/src/my.cnf b/srcs/mysql/src/my.cnf deleted file mode 100644 index 5517925..0000000 --- a/srcs/mysql/src/my.cnf +++ /dev/null @@ -1,4 +0,0 @@ -[mysqld] -user=root -port=3306 -datadir=/usr/lib/data diff --git a/srcs/mysql/start.sh b/srcs/mysql/start.sh new file mode 100755 index 0000000..bee0298 --- /dev/null +++ b/srcs/mysql/start.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +mysql_install_db --user=root --ldata=/var/lib/mysql +cat > /tmp/sql << eof +CREATE DATABASE wordpress; +FLUSH PRIVILEGES; +GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION; +FLUSH PRIVILEGES; +eof +/usr/bin/mysqld --console --init_file=/tmp/sql diff --git a/srcs/phpmyadmin/Dockerfile b/srcs/phpmyadmin/Dockerfile index 4e1c166..220a394 100644 --- a/srcs/phpmyadmin/Dockerfile +++ b/srcs/phpmyadmin/Dockerfile @@ -9,6 +9,10 @@ RUN curl 'https://files.phpmyadmin.net/phpMyAdmin/5.0.2/phpMyAdmin-5.0.2-all-lan unzip phpmyadmin.zip && \ mv 'phpMyAdmin-5.0.2-all-languages' /var/www +COPY config.inc.php /var/www/phpmyadmin +RUN mkdir /etc/phpmyadmin +COPY config.inc.php /etc/phpmyadmin + EXPOSE 5000 CMD ["php", "-S", "0.0.0.0:5000", "-t", "/var/www"] diff --git a/srcs/phpmyadmin/config.inc.php b/srcs/phpmyadmin/config.inc.php new file mode 100644 index 0000000..ea20d8e --- /dev/null +++ b/srcs/phpmyadmin/config.inc.php @@ -0,0 +1,157 @@ +<?php +/* vim: set expandtab sw=4 ts=4 sts=4: */ +/** + * phpMyAdmin sample configuration, you can use it as base for + * manual configuration. For easier setup you can use setup/ + * + * All directives are explained in documentation in the doc/ folder + * or at <https://docs.phpmyadmin.net/>. + * + * @package PhpMyAdmin + */ +declare(strict_types=1); + +/** + * This is needed for cookie based authentication to encrypt password in + * cookie. Needs to be 32 chars long. + */ +$cfg['blowfish_secret'] = 'bonjour'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */ + +/** + * Servers configuration + */ +$i = 0; + +/** + * First server + */ +$i++; +/* Authentication type */ +$cfg['Servers'][$i]['auth_type'] = 'cookie'; +/* Server parameters */ +$cfg['Servers'][$i]['host'] = 'mysql-service:3306'; +$cfg['Servers'][$i]['compress'] = false; +$cfg['Servers'][$i]['AllowNoPassword'] = false; + +/** + * phpMyAdmin configuration storage settings. + */ + +/* User used to manipulate with storage */ +// $cfg['Servers'][$i]['controlhost'] = 'mysql-service'; +// $cfg['Servers'][$i]['controlport'] = '3306'; +// $cfg['Servers'][$i]['controluser'] = 'root'; +// $cfg['Servers'][$i]['controlpass'] = 'pass'; + +/* Storage database and tables */ +// $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin'; +// $cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark'; +// $cfg['Servers'][$i]['relation'] = 'pma__relation'; +// $cfg['Servers'][$i]['table_info'] = 'pma__table_info'; +// $cfg['Servers'][$i]['table_coords'] = 'pma__table_coords'; +// $cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages'; +// $cfg['Servers'][$i]['column_info'] = 'pma__column_info'; +// $cfg['Servers'][$i]['history'] = 'pma__history'; +// $cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs'; +// $cfg['Servers'][$i]['tracking'] = 'pma__tracking'; +// $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig'; +// $cfg['Servers'][$i]['recent'] = 'pma__recent'; +// $cfg['Servers'][$i]['favorite'] = 'pma__favorite'; +// $cfg['Servers'][$i]['users'] = 'pma__users'; +// $cfg['Servers'][$i]['usergroups'] = 'pma__usergroups'; +// $cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding'; +// $cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches'; +// $cfg['Servers'][$i]['central_columns'] = 'pma__central_columns'; +// $cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings'; +// $cfg['Servers'][$i]['export_templates'] = 'pma__export_templates'; + +/** + * End of servers configuration + */ + +/** + * Directories for saving/loading files from server + */ +$cfg['UploadDir'] = ''; +$cfg['SaveDir'] = ''; + +/** + * Whether to display icons or text or both icons and text in table row + * action segment. Value can be either of 'icons', 'text' or 'both'. + * default = 'both' + */ +//$cfg['RowActionType'] = 'icons'; + +/** + * Defines whether a user should be displayed a "show all (records)" + * button in browse mode or not. + * default = false + */ +//$cfg['ShowAll'] = true; + +/** + * Number of rows displayed when browsing a result set. If the result + * set contains more rows, "Previous" and "Next". + * Possible values: 25, 50, 100, 250, 500 + * default = 25 + */ +//$cfg['MaxRows'] = 50; + +/** + * Disallow editing of binary fields + * valid values are: + * false allow editing + * 'blob' allow editing except for BLOB fields + * 'noblob' disallow editing except for BLOB fields + * 'all' disallow editing + * default = 'blob' + */ +//$cfg['ProtectBinary'] = false; + +/** + * Default language to use, if not browser-defined or user-defined + * (you find all languages in the locale folder) + * uncomment the desired line: + * default = 'en' + */ +//$cfg['DefaultLang'] = 'en'; +//$cfg['DefaultLang'] = 'de'; + +/** + * How many columns should be used for table display of a database? + * (a value larger than 1 results in some information being hidden) + * default = 1 + */ +//$cfg['PropertiesNumColumns'] = 2; + +/** + * Set to true if you want DB-based query history.If false, this utilizes + * JS-routines to display query history (lost by window close) + * + * This requires configuration storage enabled, see above. + * default = false + */ +//$cfg['QueryHistoryDB'] = true; + +/** + * When using DB-based query history, how many entries should be kept? + * default = 25 + */ +//$cfg['QueryHistoryMax'] = 100; + +/** + * Whether or not to query the user before sending the error report to + * the phpMyAdmin team when a JavaScript error occurs + * + * Available options + * ('ask' | 'always' | 'never') + * default = 'ask' + */ +//$cfg['SendErrorReports'] = 'always'; + +/** + * You can find more configuration options in the documentation + * in the doc/ folder or at <https://docs.phpmyadmin.net/>. + */ + +// $cfg['TempDir'] = '/etc/tmp'; diff --git a/srcs/wordpress/wp-config.php b/srcs/wordpress/wp-config.php index 4906ee1..ff958c7 100644 --- a/srcs/wordpress/wp-config.php +++ b/srcs/wordpress/wp-config.php @@ -26,7 +26,7 @@ define( 'DB_NAME', 'wordpress' ); define( 'DB_USER', 'root' );
/** MySQL database password */
-define( 'DB_PASSWORD', 'pass' );
+define( 'DB_PASSWORD', 'root' );
/** MySQL hostname */
define( 'DB_HOST', 'mysql-service' );
|
