forked from progressivetech/docker-civicrm-buildkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
civicrm-buildkit-setup
executable file
·45 lines (35 loc) · 1.55 KB
/
civicrm-buildkit-setup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
# Script to be run as root after container is started to properly set permissions.
## For the www-data user to access the tests database.
# Grant rights in database.
mysql -e 'CREATE DATABASE IF NOT EXISTS civicrm_tests_dev'
mysql -e "GRANT ALL ON civicrm_tests_dev.* TO 'www-data'@'localhost' IDENTIFIED BY 'WWWDATAREPLACEPASSWORD'"
# Create conf files.
# NOTE: if www-data has a .my.cnf it will interfere with drush. So name it my.cnf so we can still
# use it via mysql --defaults-file=/var/www/my.cnf but it won't interfere with drush.
printf "[client]\npassword=%s\n[mysql]\ndatabase=civicrm_tests_dev\n" "WWWDATAREPLACEPASSWORD" > /var/www/my.cnf
chown www-data /var/www/my.cnf
chmod 600 /var/www/my.cnf
## For the root user.
mysql -e "SET PASSWORD FOR root@localhost = PASSWORD('ROOTREPLACEPASSWORD')"
printf "[client]\npassword=%s\n[mysql]\n" "ROOTREPLACEPASSWORD" > /root/.my.cnf
chmod 600 /root/.my.cnf
## Turn off the socket plugin so other users can login as root.
# This fails with newere version of mariadb and appears to no longer
# be necessary.
#mysql -e "UPDATE user SET plugin = '' WHERE User = 'root'" mysql
## Flush privileges
mysql -e "FLUSH PRIVILEGES"
## Configure amp
printf "parameters:
version: 2
httpd_type: apache24
db_type: mysql_dsn
mysql_type: dsn
mysql_dsn: mysql://root:[email protected]:3306
perm_type: none
hosts_type: none
httpd_restart_command: sudo /usr/sbin/apache2ctl graceful
httpd_visibility: all
services: { }\n" > /var/www/.amp/services.yml
chown www-data:www-data /var/www/.amp/services.yml