From efa14f496f284e82e3df14e688a067b1c1aa0552 Mon Sep 17 00:00:00 2001 From: ray Date: Wed, 6 May 2020 16:12:41 +0100 Subject: [PATCH] bugfixes --- README.md | 1 + container-setup.sh | 6 ++++-- dev/container-create.sh | 2 +- dev/dev-env-setup.sh | 22 ++++++++++++++++------ import-testdata.sh | 2 +- load-config.sh | 10 +++++----- publish.sh | 2 +- webserver-provision.sh | 2 +- 8 files changed, 30 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 7609aea..59b3957 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ TODO * have wp-dev command that takes a command as an argument (e.g., create, publish, etc) + -- make sure we cd into the correct directory first * Script to export database from production database * Script to export wordpress directory from production diff --git a/container-setup.sh b/container-setup.sh index 25996d1..432774b 100755 --- a/container-setup.sh +++ b/container-setup.sh @@ -1,8 +1,10 @@ #!/bin/sh -. ./load-config.sh +. /home/ray/Projects/wordpress-dev/load-config.sh -./dev/container-create.sh +cd /home/ray/Projects/wordpress-dev + +# ./dev/container-create.sh _url="$_local_hostname.$_local_domain" cat config dev/dev-env-setup.sh | ssh root@"$_url" 'cat >/tmp/deploy-script.sh' diff --git a/dev/container-create.sh b/dev/container-create.sh index 0ace5aa..212361f 100755 --- a/dev/container-create.sh +++ b/dev/container-create.sh @@ -13,7 +13,7 @@ _ssh_cmd_www_cd="$_ssh_cmd_www cd /var/www/html/wordpress &&" _wp_url="http://$_host" printf "\nInstalling requirements ..." -$_ssh_cmd_root 'apt-get update && apt-get -y upgrade && apt-get -y install apache2 mariadb-server php php-common libapache2-mod-php python-mysqldb php-gd php-ssh2 php-mysql php-dom php-simplexml php-xml php-xmlreader php-curl php-ftp php-iconv php-imagick php-mbstring php-posix php-sockets php-tokenizer php-zip' +$_ssh_cmd_root 'apt-get update && apt-get -y upgrade && apt-get -y install apache2 mariadb-server php php-common libapache2-mod-php python-mysqldb php-gd php-ssh2 php-mysql php-dom php-simplexml php-xml php-xmlreader php-curl php-ftp php-iconv php-imagick php-mbstring php-posix php-sockets php-tokenizer php-zip curl gnupg2' printf "\nConfiguring Apache ..." scp ./dev/config/000-default.conf "$_scp_to":/etc/apache2/sites-enabled/000-default.conf diff --git a/dev/dev-env-setup.sh b/dev/dev-env-setup.sh index 6e422bb..fe9db17 100755 --- a/dev/dev-env-setup.sh +++ b/dev/dev-env-setup.sh @@ -6,6 +6,8 @@ _config_dir="$_home_dir/.config" mkdir -p "$_config_dir" chown "$_user_www": "$_config_dir" +apt-get update && apt-get -y install curl gnupg2 zsh tmux ninja-build gettext libtool libtool-bin autoconf automake cmake g++ pkg-config unzip python-pip python3-pip tig fzf + echo "installing lf ..." _download_url="https://github.com/gokcehan/lf/releases/download/$_lf_version/lf-linux-amd64.tar.gz" wget "$_download_url" -O /tmp/lf.tar.gz @@ -14,13 +16,20 @@ git clone 'https://git.rayelliott.dev/dots/lf.git' "$_config_dir/lf" cd /tmp +rm -Rf /tmp/* wget https://nodejs.org/dist/"$_node_version"/node-"$_node_version"-"$_node_distro".tar.xz mkdir -p /usr/local/lib/nodejs tar -xJvf node-"$_node_version"-"$_node_distro".tar.xz -C /usr/local/lib/nodejs -echo "PATH=/usr/local/lib/nodejs/node-$_node_version-$_node_distro/bin:$PATH" >> "$_home_dir"/.profile -curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - -echo 'deb https://dl.yarnpkg.com/debian/ stable main' | tee /etc/apt/sources.list.d/yarn.list -apt-get update && apt-get -y install yarn curl zsh tmux ninja-build gettext libtool libtool-bin autoconf automake cmake g++ pkg-config unzip python-pip python3-pip tig fzf +echo "PATH=/usr/local/lib/nodejs/node-$_node_version-$_node_distro/bin:$PATH" > "$_home_dir"/.profile +. "$_home_dir"/.profile + +# yarn not installing due to public key unavailable error - install npm +# temporqarily +# curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - +# echo 'deb https://dl.yarnpkg.com/debian/ stable main' | tee /etc/apt/sources.list.d/yarn.list +# apt-get update && apt-get -y install yarn + +curl -L https://www.npmjs.com/install.sh | sh git clone https://github.com/neovim/neovim @@ -28,12 +37,13 @@ cd neovim make CMAKE_BUILD_TYPE=Release mkdir -p /usr/local/share/nvim mv /tmp/neovim/runtime /usr/local/share/nvim/runtime - mv /tmp/neovim/build/bin/nvim /usr/local/bin/nvim +mv /tmp/neovim/build/bin/nvim /usr/local/bin/nvim cd "$_home_dir" su "$_user_www" -c "git clone https://git.rayelliott.dev/dots/nvim.git $_config_dir/nvim" -su "$_user_www" --login -c 'yarn global add neovim' +# su "$_user_www" --login -c 'yarn global add neovim' +su "$_user_www" --login -c 'npm install -g neovim' su "$_user_www" --login -c 'python2 -m pip install --user --upgrade pynvim' su "$_user_www" --login -c 'python3 -m pip install --user --upgrade pynvim' su "$_user_www" --login -c "curl -fLo $_home_dir/nvim/autoload/plug.vim --create-dirs \ diff --git a/import-testdata.sh b/import-testdata.sh index 33eea78..975d28b 100755 --- a/import-testdata.sh +++ b/import-testdata.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./load-config.sh +. /home/ray/Projects/wordpress-dev/load-config.sh _username="$_user_www" _url="$_local_hostname.$_local_domain" diff --git a/load-config.sh b/load-config.sh index a6fdbb1..5e40f1c 100755 --- a/load-config.sh +++ b/load-config.sh @@ -1,14 +1,14 @@ #!/bin/sh -_file="$1" +_file="$(pwd)/$1" -if [ -z "$_file" ] ; then +if [ ! -f "$_file" ] ; then if [ -f "$(pwd)/wp-dev-config" ] ; then - _file="wp-dev-config" + _file="$(pwd)/wp-dev-config" else - echo "Must supply configuration file as an argument." + echo "No configuration file supplied and no default ('wp-dev-config') found." exit 1 fi fi -. "$(pwd)/$_file" +. "$_file" diff --git a/publish.sh b/publish.sh index 12e8523..0ce9ccb 100755 --- a/publish.sh +++ b/publish.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./load-config.sh +. /home/ray/Projects/wordpress-dev/load-config.sh ./dev/export-data.sh diff --git a/webserver-provision.sh b/webserver-provision.sh index b731d2e..64cdc74 100755 --- a/webserver-provision.sh +++ b/webserver-provision.sh @@ -1,6 +1,6 @@ #!/bin/sh -. ./load-config.sh +. /home/ray/Projects/wordpress-dev/load-config.sh _ssh_url="root@$_remote_host.$_domain"