Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Change permissions for webroot directory
chown "${user}":www-data "${webroot}"
# Create auth.json required for magento installation
sudo -u "${user}" bash -c "mkdir ${home}/.composer"
sudo -u "${user}" bash -c "tee ${home}/.composer/auth.json" > /dev/null <<ILOVEBASH
{
"github-oauth": {
"github.com": "${github_pa_token}"
},
"http-basic": {
"repo.magento.com": {
"username": "${magento_public_key}",
"password": "${magento_private_key}"
}
}
}
ILOVEBASH
cd "${webroot}"
# Setup magento
sudo -H -u "${user}" bash -c "composer create-project --repository=https://repo.magento.com/ magento/project-community-edition ."
# Magento permissions
find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +
find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +
chown -R :www-data .
chmod u+x bin/magento
# Install Magento
sudo -u "${user}" bash -s <<ILOVEBASH
bin/magento setup:install \
--base-url=http://"${domain}" \
--db-host="${db_host}" \
--db-name="${db_name}" \
--db-user="${db_username}" \
--db-password="${db_password}" \
--admin-firstname=admin \
--admin-lastname=admin \
--admin-email="${webmaster_email}" \
--admin-user="${webmaster_username}" \
--admin-password="${webmaster_email}" \
--language="${magento_language}" \
--currency="${magento_currency}" \
--timezone="${magento_timezone}" \
--use-rewrites=1 \
--cleanup-database
ILOVEBASH
# Set mode
sudo -u ${user} bash -c "bin/magento deploy:mode:set ${mode}"
# Install sample data
sudo -H -u ${user} bash -c "bin/magento sampledata:deploy"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.