started mysql/server

This commit is contained in:
andreas
2023-04-02 11:16:26 +00:00
parent e017c4e457
commit 878e544e87
13 changed files with 178 additions and 95 deletions

3
.env Normal file
View File

@@ -0,0 +1,3 @@
# database credentials
MYSQL_ROOT_PASSWORD=modT9&?.
MYSQL_KOPANO_PASSWORD=Asdf2345

View File

@@ -1,10 +0,0 @@
#!/usr/bin/bash
# docker run -d --name apache -p80:80 -v/root/kopano/dist:/usr/local/apache2/htdocs httpd
DOCKER_BUILDKIT=1 docker build -f kopano.dockerfile -t kopano .
docker container prune -f
docker create --name kopano kopano:latest
docker export kopano | docker import - kopano:squashed
# docker run -d --name kopano kopano:squashed
# docker exec -it kopano bash
# docker stop kopano
# docker rm kopano

View File

@@ -1,15 +0,0 @@
#!/usr/bin/bash
# docker login --username baloan --password 'yZBCUs5&@?:.'
# docker run -d --name apache -p80:80 -v/root/kopano/dist:/var/www httpd
export DOCKER_BUILDKIT=1
# cd ~/kopano/core; docker build -t core .
# cd ~/kopano/webapp; docker build -t webapp .
cd ~/kopano/postfix; docker build -t postfix .
cd ~/kopano
# docker container prune -f
# docker create --name kopano kopano:latest
# docker export kopano | docker import - kopano:squashed
# docker run -d --name kopano kopano:squashed
# docker exec -it kopano bash
# docker stop kopano
# docker rm kopano

View File

@@ -1,4 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
# export APACHE_RUN_DIR=/var/www sed -i \
-e's/#mysql_host = localhost/mysql_host = mysql/' \
-e's/#mysql_user = root/mysql_user = kopano/' \
-e's/#mysql_password =/mysql_password = Asdf2345/' \
/etc/kopano/server.cfg
# runas user kopano
chown kopano:kopano /var/lib/kopano/attachments
exec "$@" exec "$@"

View File

@@ -1,12 +0,0 @@
apt-get update
export DEBIAN_FRONTEND=noninteractive
export TZ=Europe/Berlin
apt-get install -y tzdata z-push apache2
tar xzf core-11.0.2.50.507cbae-Ubuntu_20.04-amd64.tar.gz
tar xzf webapp-6.0.0.57.1049268-Ubuntu_20.04-all.tar.gz
for F in ~/core-11.0.2.50.507cbae-Ubuntu_20.04-amd64/*.deb; do dpkg --unpack --no-triggers $F; done
for F in ~/webapp-6.0.0.57.1049268-Ubuntu_20.04-all/*.deb; do dpkg --unpack --no-triggers $F; done
apt-get install -f -y
# cleanup install
apt-get clean
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ~/.cache ~/.npm

View File

@@ -1,68 +1,76 @@
version: '3'
services: services:
server: server:
image: core image: core
depends_on: depends_on:
- db - mysql
volumes:
- attachments:/var/lib/kopano/attachments
- ./core/entrypoint.sh:/entrypoint.sh
command: /usr/sbin/kopano-server command: /usr/sbin/kopano-server
dagent: mysql:
image: core image: mysql:5.7
depends_on: environment:
- db - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- server
command: /usr/sbin/kopano-dagent
spooler:
image: core
depends_on:
- db
- server
command: /usr/sbin/kopano-spooler
search:
image: core
depends_on:
- db
- server
command: /usr/sbin/kopano-search
postfix:
image: postfix
volumes:
- spool:/var/spool/postfix
webapp:
image: webapp
labels:
- traefik.enable=true
- traefik.http.routers.webapp.rule=Host(`$MAIL_DOMAIN`) && Path(`/webapp`)
- traefik.http.routers.webapp.tls=true
- traefik.http.routers.webapp.tls.certResolver=default
depends_on:
- server
networks:
- default
- traefik
z-push:
image: z-push
labels:
- traefik.enable=true
- traefik.http.routers.webapp.rule=Host(`$MAIL_DOMAIN`) && Path(`/Active-Sync-...`)
- traefik.http.routers.webapp.tls=true
- traefik.http.routers.webapp.tls.certResolver=default
volumes:
- z-push:/var/lib/z-push
depends_on:
- server
networks:
- default
- traefik
db:
image: mysql
restart: unless-stopped
volumes: volumes:
- database:/var/lib/mysql - database:/var/lib/mysql
- ./mysql/etc/mysql:/etc/mysql
- ./mysql/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
ports:
- 3307:3306
networks: networks:
traefik: traefik:
external: true external: true
volumes: volumes:
- attachments: database:
- database: attachments:
- z-push: # z-push:
- spool: # spool:
# dagent:
# image: core
# depends_on:
# - db
# - server
# command: /usr/sbin/kopano-dagent
# spooler:
# image: core
# depends_on:
# - db
# - server
# command: /usr/sbin/kopano-spooler
# search:
# image: core
# depends_on:
# - db
# - server
# command: /usr/sbin/kopano-search
# webapp:
# image: webapp
# labels:
# - traefik.enable=true
# - traefik.http.routers.webapp.rule=Host(`$MAIL_DOMAIN`) && Path(`/webapp`)
# - traefik.http.routers.webapp.tls=true
# - traefik.http.routers.webapp.tls.certResolver=default
# depends_on:
# - server
# networks:
# - default
# - traefik
# z-push:
# image: z-push
# labels:
# - traefik.enable=true
# - traefik.http.routers.webapp.rule=Host(`$MAIL_DOMAIN`) && Path(`/Active-Sync-...`)
# - traefik.http.routers.webapp.tls=true
# - traefik.http.routers.webapp.tls.certResolver=default
# volumes:
# - z-push:/var/lib/z-push
# depends_on:
# - server
# networks:
# - default
# - traefik
# postfix:
# image: postfix
# volumes:
# - spool:/var/spool/postfix

8
migration.sh Normal file
View File

@@ -0,0 +1,8 @@
#!/usr/bin/env bash
docker exec -it kopano-mysql-1 sh <<DCKR
mysql -u root -p <<SQL
CREATE USER 'kopano' IDENTIFIED BY 'Asdf2345';
GRANT ALL ON kopano.* TO 'kopano'@'%';
DROP DATABASE kopano;
SQL
DCKR

View File

@@ -0,0 +1,2 @@
CREATE USER 'kopano' IDENTIFIED BY 'Asdf2345';
GRANT ALL ON kopano.* TO 'kopano'@'%';

View File

@@ -0,0 +1 @@
[mysql]

View File

@@ -0,0 +1,4 @@
[mysqldump]
quick
quote-names
max_allowed_packet = 16M

View File

@@ -0,0 +1,86 @@
[mysqld]
#
# * Basic Settings
#
# port = 3306
lc-messages-dir = /usr/share/mysql
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 0.0.0.0
#
# * Fine Tuning
#
key_buffer_size = 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-options = BACKUP
#max_connections = 100
#table_open_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
#slow_query_log = 1
#slow_query_log_file = /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/local/wal/mysql/mysql-bin.log
# expire_logs_days = 10
# max_binlog_size = 1M
# transaction_isolation = READ-COMMITTED
# binlog_format = ROW
#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!
#
character-set-server = utf8mb4
collation-server = utf8mb4_general_ci
innodb_large_prefix = on
innodb_file_format = barracuda
innodb_file_per_table = 1
innodb_buffer_pool_size = 500M
innodb_log_file_size = 50M
innodb_log_buffer_size = 25M
innodb_flush_log_at_trx_commit = 0
#
# * 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

View File

@@ -0,0 +1,2 @@
[mysqld_safe]
syslog

View File