allow to set docker user

This commit is contained in:
Ray Elliott 2020-03-12 20:01:15 +00:00
parent d3e61d9983
commit c389c52385
3 changed files with 19 additions and 15 deletions

View File

@ -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"

View File

@ -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

View File

@ -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