Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: MP-4413/EnableMySqlLampPredeploy #55

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 27 additions & 6 deletions lamp-20-04/files/etc/update-motd.d/99-one-click
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,32 @@
# Configured as part of the DigitalOcean 1-Click Image build process

myip=$(hostname -I | awk '{print$1}')
if [ -f "/root/.digitalocean_dbaas_credentials" ];
then
DBAAS_PROTOCOL=$(sed -n "s/^db_protocol=\"\(.*\)\"$/\1/p" /root/.digitalocean_dbaas_credentials)
DBAAS_HOST=$(sed -n "s/^db_host=\"\(.*\)\"$/\1/p" /root/.digitalocean_dbaas_credentials)
DBAAS_PORT=$(sed -n "s/^db_port=\"\(.*\)\"$/\1/p" /root/.digitalocean_dbaas_credentials)
DBAAS_USERNAME=$(sed -n "s/^db_username=\"\(.*\)\"$/\1/p" /root/.digitalocean_dbaas_credentials)
DBAAS_DATABASE_NAME=$(sed -n "s/^db_database=\"\(.*\)\"$/\1/p" /root/.digitalocean_dbaas_credentials)
DBAAS_PASSWORD=$(sed -n "s/^db_password=\"\(.*\)\"$/\1/p" /root/.digitalocean_dbaas_credentials)

db_message=" * DBAAS instance of MySQL is configured. Credentials are:
Protocol: $DBAAS_PROTOCOL
Host: $DBAAS_HOST
Port: $DBAAS_PORT
Username: $DBAAS_USERNAME
Database name: $DBAAS_DATABASE_NAME
Password: $DBAAS_PASSWORD
"

else
LOCAL_DBAAS_PASSWORD=$(sed -n "s/^root_mysql_pass=\"\(.*\)\"$/\1/p" /root/.digitalocean_password)
db_message=" * Local instance of MySQL is configured.
Root password is: $LOCAL_DBAAS_PASSWORD
"

fi

cat <<EOF
********************************************************************************

Expand All @@ -16,12 +42,7 @@ In a web browser, you can view:

On the server:
* The default web root is located at /var/www/html
* If you're using the embedded database, the MySQL root password
is saved in /root/.digitalocean_password. If you've opted in to
using a DBaaS instance with DigitalOcean, you will find your
credentials written to /root/.digitalocean_dbaas_credentials
and you will have access to a DATABASE_URL environment variable
holding your database connection string.
$db_message
* Certbot is preinstalled. Run it to configure HTTPS. See
https://do.co/3gY97ha#enable-https for more detail.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ expect eof

echo "$SECURE_MYSQL"


cat > /etc/mysql/debian.cnf <<EOM
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
Expand Down
1 change: 0 additions & 1 deletion lamp-20-04/scripts/011-lamp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@ if [ -f "/root/.digitalocean_dbaas_credentials" ]; then

# cleanup
unset host port
rm -rf /etc/mysql
fi