Files
piratepoet/dev/initial-setup.sh
Jan Jakes e58dd589ac Fix typo in env variable name
[MAILPOET-4069]
2022-01-20 09:19:32 +01:00

38 lines
1.4 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# try to clone mailpoet-premium, skip on failure (i.e. no access rights)
git clone git@github.com:mailpoet/mailpoet-premium.git 2>/dev/null \
|| echo "Skipped cloning 'mailpoet-premium' (check your access rights)"
# Save current UID and GID to .env so we can run images with current user
# to avoid any potential problems with file permissions (mainly on Linux).
cat <<EOT > .env
UID=$(id -u)
GID=$(id -g)
EOT
# create plugin .env files if they don't exist
cp -n mailpoet/.env.sample mailpoet/.env
[[ -f mailpoet-premium/.env.sample ]] && cp -n mailpoet-premium/.env.sample mailpoet-premium/.env
# create Docker mount endpoints beforehand with current user (Docker would create them as root)
mkdir -p wordpress/wp-content/plugins/mailpoet
mkdir -p wordpress/wp-content/plugins/mailpoet-premium
mkdir -p dev/data/mailhog
for plugin in "mailpoet" "mailpoet-premium"; do
docker-compose run --rm wordpress /bin/sh -c "
[ -d /var/www/html/wp-content/plugins/$plugin ] &&
cd /var/www/html/wp-content/plugins/$plugin &&
./do install &&
./do compile:all
"
done
docker-compose run --rm wordpress /bin/sh -c "
cd /var/www/templates &&
mkdir assets classes exported
"
echo 'Dont forget to configure environment variables in .env files in ./mailpoet and ./mailpoet-premium'
echo 'You can run the environment by executing "./do start" and visiting http://localhost:8002'