pica now has mariadb client in environment, and a composition with mariadb to run it
This commit is contained in:
parent
7a54d5025f
commit
d516963219
11 changed files with 110 additions and 16 deletions
9
pica-maria-apache/README.md
Normal file
9
pica-maria-apache/README.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
# Pica with apache composition
|
||||
|
||||
A ready to use pica + webserver composition
|
||||
|
||||
### Running
|
||||
```
|
||||
$ cd <this directory>
|
||||
$ docker compose up
|
||||
```
|
10
pica-maria-apache/apache/Dockerfile
Normal file
10
pica-maria-apache/apache/Dockerfile
Normal file
|
@ -0,0 +1,10 @@
|
|||
# syntax=docker/dockerfile:1
|
||||
|
||||
FROM alpine:latest
|
||||
RUN \
|
||||
apk add --no-cache \
|
||||
apache2 \
|
||||
apache2-proxy
|
||||
COPY vhost-pica.conf /etc/apache2/conf.d/
|
||||
EXPOSE 80
|
||||
CMD httpd -D FOREGROUND
|
9
pica-maria-apache/apache/vhost-pica.conf
Normal file
9
pica-maria-apache/apache/vhost-pica.conf
Normal file
|
@ -0,0 +1,9 @@
|
|||
<Location /pica>
|
||||
<IfModule mod_headers.c>
|
||||
Header set Access-Control-Allow-Origin "*"
|
||||
Header set Access-Control-Allow-Headers: "*"
|
||||
</IfModule>
|
||||
|
||||
ProxyPass "unix:/run/pica/pica.sock|fcgi://localhost"
|
||||
ProxyPassReverse "http://localhost"
|
||||
</Location>
|
25
pica-maria-apache/docker-compose.yml
Normal file
25
pica-maria-apache/docker-compose.yml
Normal file
|
@ -0,0 +1,25 @@
|
|||
version: "4"
|
||||
services:
|
||||
pica:
|
||||
image: thebluestbird/pica-standalone:latest
|
||||
volumes:
|
||||
- picarun:/run/pica
|
||||
- mysqld:/run/mysqld
|
||||
depends_on:
|
||||
- maria
|
||||
apache:
|
||||
build: ./apache
|
||||
image: thebluestbird/pica-apache:latest
|
||||
volumes:
|
||||
- picarun:/run/pica
|
||||
ports:
|
||||
- 8080:80
|
||||
maria:
|
||||
build: ./maria
|
||||
image: thebluestbird/pica-maria:latest
|
||||
volumes:
|
||||
- mysqld:/run/mysqld
|
||||
volumes:
|
||||
picarun:
|
||||
mysqld:
|
||||
|
19
pica-maria-apache/maria/Dockerfile
Normal file
19
pica-maria-apache/maria/Dockerfile
Normal file
|
@ -0,0 +1,19 @@
|
|||
# syntax=docker/dockerfile:1
|
||||
FROM alpine:latest
|
||||
RUN \
|
||||
apk add --no-cache \
|
||||
mariadb \
|
||||
mariadb-client \
|
||||
&& \
|
||||
mkdir -p /run/mysqld && \
|
||||
chown mysql:mysql /run/mysqld
|
||||
|
||||
COPY my.cnf /etc/mysql/my.cnf
|
||||
COPY createDB.sql /root/
|
||||
COPY createDB.sh /root/
|
||||
|
||||
RUN mysql_install_db && \
|
||||
chmod +x root/createDB.sh && \
|
||||
root/createDB.sh
|
||||
|
||||
CMD ["mysqld", "--console"]
|
25
pica-maria-apache/maria/createDB.sh
Normal file
25
pica-maria-apache/maria/createDB.sh
Normal file
|
@ -0,0 +1,25 @@
|
|||
/usr/bin/mysqld_safe &
|
||||
|
||||
# wait for it to start
|
||||
echo -n "wait for db to start"
|
||||
|
||||
c=1
|
||||
while [[ $c -le 10 ]]
|
||||
do
|
||||
echo 'SELECT 1' | /usr/bin/mysql &> /dev/null
|
||||
# echo "R=$?"
|
||||
if [ $? -eq 0 ]; then
|
||||
break
|
||||
fi
|
||||
echo "."
|
||||
sleep 1
|
||||
let c=c+1
|
||||
done
|
||||
echo "C=$c"
|
||||
|
||||
if [ $c -eq 11 ]; then
|
||||
echo "database failed to start"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mysql < /root/createDB.sql
|
4
pica-maria-apache/maria/createDB.sql
Normal file
4
pica-maria-apache/maria/createDB.sql
Normal file
|
@ -0,0 +1,4 @@
|
|||
CREATE DATABASE IF NOT EXISTS pica;
|
||||
|
||||
CREATE USER IF NOT EXISTS 'pica'@'localhost' IDENTIFIED BY 'pica';
|
||||
GRANT ALL PRIVILEGES ON pica.* TO 'pica'@'localhost';
|
30
pica-maria-apache/maria/my.cnf
Normal file
30
pica-maria-apache/maria/my.cnf
Normal file
|
@ -0,0 +1,30 @@
|
|||
[mysqld]
|
||||
datadir=/var/lib/mysql
|
||||
socket=/run/mysqld/mysqld.sock
|
||||
user=mysql
|
||||
# Disabling symbolic-links is recommended to prevent assorted security risks
|
||||
symbolic-links=0
|
||||
|
||||
# Custom settings for performance and security
|
||||
key_buffer_size=16M
|
||||
max_allowed_packet=16M
|
||||
thread_stack=192K
|
||||
thread_cache_size=8
|
||||
query_cache_limit=1M
|
||||
query_cache_size=16M
|
||||
|
||||
# InnoDB settings
|
||||
innodb_buffer_pool_size=128M
|
||||
innodb_log_file_size=64M
|
||||
innodb_flush_method=O_DIRECT
|
||||
innodb_flush_log_at_trx_commit=2
|
||||
|
||||
# Character set and collation
|
||||
character-set-server=utf8mb4
|
||||
collation-server=utf8mb4_unicode_ci
|
||||
|
||||
[client]
|
||||
default-character-set=utf8mb4
|
||||
|
||||
[mysql]
|
||||
default-character-set=utf8mb4
|
9
pica-maria-apache/maria/vhost-pica.conf
Normal file
9
pica-maria-apache/maria/vhost-pica.conf
Normal file
|
@ -0,0 +1,9 @@
|
|||
<Location /pica>
|
||||
<IfModule mod_headers.c>
|
||||
Header set Access-Control-Allow-Origin "*"
|
||||
Header set Access-Control-Allow-Headers: "*"
|
||||
</IfModule>
|
||||
|
||||
ProxyPass "unix:/run/pica/pica.sock|fcgi://localhost"
|
||||
ProxyPassReverse "http://localhost"
|
||||
</Location>
|
Loading…
Add table
Add a link
Reference in a new issue