From c389c52385c8ab8b4459ba21d193faa8ee5427ef Mon Sep 17 00:00:00 2001 From: ray Date: Thu, 12 Mar 2020 20:01:15 +0000 Subject: [PATCH] allow to set docker user --- config-example | 12 +++++------- production/export-to-production.sh | 8 +++++++- production/webserver-setup.sh | 14 +++++++------- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/config-example b/config-example index dc570a0..f45ba77 100644 --- a/config-example +++ b/config-example @@ -8,10 +8,10 @@ export _local_domain="home" export _user_www='www-data' export _passwd_www='www-data' -export _wp_title="WP Test" +export _wp_title="WP Title" export _wp_admin_user="admin" -export _wp_password="admin" -export _wp_email="$_local_hostname@isnet.uk" +export _wp_password="a_better_password_than_this_bro" +export _wp_email="wp@example.org" export _wp_db_passwd="wordpress" export _wp_theme_active="twentytwenty" @@ -25,10 +25,8 @@ export _wp_plugins_active="elementor wp-mail-smtp gdpr-cookie-compliance regener export _remote_host="www" export _domain="isnet.uk" -# set to true to ude bare domain -export _bare_domain='false' -_lets_encrypt_email="letsencrpt.wp@rayelliott.dev" +_lets_encrypt_email="letsencrypt@example.org" export _docker_user="ray" export _docker_base_dir="/var/docker" -export _mysql_root_passwd="db" +export _mysql_root_passwd="another_password_better_than_this_bruh" diff --git a/production/export-to-production.sh b/production/export-to-production.sh index 6a00b1c..6917d8c 100755 --- a/production/export-to-production.sh +++ b/production/export-to-production.sh @@ -81,9 +81,15 @@ _cmd_docker_exec="cd $_docker_dir && docker exec -t $_remote_host-wordpress /bin echo "$_ssh_cmd $_cmd_docker_exec" $_ssh_cmd "$_cmd_docker_exec" -_cmd_wp="wp search-replace '$_local_hostname.$_local_domain' '$_remote_host.$_domain' --skip-columns=guid" +_remote_url="$_remote_host.$_domain" +_cmd_wp="wp search-replace '$_local_hostname.$_local_domain' '$_remote_url' --skip-columns=guid" _cmd_docker_exec="cd $_docker_dir && docker exec -t $_remote_host-wordpress /bin/sh -c '$_cmd_wp'" echo "$_ssh_cmd $_cmd_docker_exec" $_ssh_cmd "$_cmd_docker_exec" +echo "" +echo "-------------------------------------------------------------------------" +echo "Deploy complete" +echo " URL: https://$_remote_url/wp-login.php" + rm .env diff --git a/production/webserver-setup.sh b/production/webserver-setup.sh index ee06e86..d3e816d 100755 --- a/production/webserver-setup.sh +++ b/production/webserver-setup.sh @@ -16,12 +16,12 @@ _docker_container_config_dir="/var/docker" _docker_compose_version="1.25.4" # add user -useradd -m -s /bin/bash ray +useradd -m -s /bin/bash "$_docker_user" groupadd docker -usermod -aG docker ray -mkdir /home/ray/.ssh -cp /root/.ssh/authorized_keys /home/ray/.ssh/ -chown ray: /home/ray/.ssh/authorized_keys +usermod -aG docker "$_docker_user" +mkdir /home/"$_docker_user"/.ssh +cp /root/.ssh/authorized_keys /home/"$_docker_user"/.ssh/ +chown "$_docker_user": /home/"$_docker_user"/.ssh/authorized_keys apt-get update apt-get upgrade --yes @@ -50,8 +50,8 @@ apt-get install docker-ce docker-ce-cli containerd.io curl -L "https://github.com/docker/compose/releases/download/$_docker_compose_version/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose -echo "Basic HTTP authorisation password for user: ray" -_HT_PASSWD=$(htpasswd -nB ray | sed -e 's/\$/\$\$/g') +echo "Basic HTTP authorisation password for user: $_docker_user" +_HT_PASSWD=$(htpasswd -nB "$_docker_user" | sed -e 's/\$/\$\$/g') docker network create web