Hello, please i’m having issue deploying to a digitalocean droplet (Ubuntu 16.04.3).
Please find below the error details:
Output of the command is shown above and the command executed
on that host is printed below for debugging purposes:
FAILED with exit status 255:
current_shell="$0" || :
[ -z "$current_shell" ] && current_shell="$SHELL"
case "$current_shell" in
(*bash*) echo 'bash is installed and the default shell' ;;
(*zsh*) echo 'zsh is installed and the default shell' ;;
(*)
echo
echo "You are using an unsupported shell: '$current_shell'"
echo "edeliver requires either bash or zsh to be installed"
echo "and the default shell for the build user 'kehinde'"
echo "on your build host: '46.101.30.23'."
exit 1
;;
esac
set -e
if [ ! -d /home/kehinde/app_name/builds ]
then
mkdir -p /home/kehinde/app_name/builds
cd /home/kehinde/app_name/builds
git init
git config receive.denyCurrentBranch ignore
else
cd /home/kehinde/app_name/builds
git config receive.denyCurrentBranch ignore
fi
1 Like
# /etc/shells: valid login shells
/bin/sh
/bin/dash
/bin/bash
/bin/rbash
/usr/bin/tmux
/usr/bin/screen
/bin/csh
The shell used is the one defined for the user kehinde.
You could get this information on your server with…
$ cat /etc/passwd | grep kehinde
My bet is your deployement user is defined to use /bin/sh 
You can change this with
$ sudo usermod -s /bin/bash kehinde
If You have access to sudo.
Thanks immensely @kokolegorille.
The output of cat /etc/passwd | grep kehinde
kehinde:x:1001:1001:,,,:/home/kehinde:/bin/bash
I believe this output already shows that the default shell is /bin/bash.
Yes it does… the shell used is the last field
Please i’m a little bit curious about the localhost under the authorizing 46.101.30.23 on localhost Does this have anything to do with the error?
-----> Authorizing hosts
Authorizing 46.101.30.23 on localhost:
-----> Ensuring hosts are ready to accept git pushes
A remote command failed on:
kehinde@46.101.30.23
Output of the command is shown above and the command executed
on that host is printed below for debugging purposes:
FAILED with exit status 255:
current_shell="$0" || :
[ -z "$current_shell" ] && current_shell="$SHELL"
case "$current_shell" in
(*bash*) echo 'bash is installed and the default shell' ;;
(*zsh*) echo 'zsh is installed and the default shell' ;;
(*)
echo
echo "You are using an unsupported shell: '$current_shell'"
echo "edeliver requires either bash or zsh to be installed"
echo "and the default shell for the build user 'kehinde'"
echo "on your build host: '46.101.30.23'."
exit 1
;;
esac
set -e
if [ ! -d /home/kehinde/enterprise/builds ]
then
mkdir -p /home/kehinde/enterprise/builds
cd /home/kehinde/enterprise/builds
git init
git config receive.denyCurrentBranch ignore
else
cd /home/kehinde/enterprise/builds
git config receive.denyCurrentBranch ignore
fi
I am sorry, I have little experience with edeliver as I deploy manually.
But what I can tell is the user shell is ok, that would mean the rest is in error.
I cannot really help You, but I would try to run each commands separately, to check which one is failing.
1 Like
Do you have git
installed ? Edeliver adds your build machine as remote and uses the ssh protocol to push the source code of your app there. you can check that by running git remote -v show in you project directory after building on the build host. It shows something like that:
$ git remote -v show
$BUILD_USER@$BUILD_HOST $BUILD_USER@$BUILD_HOST:$BUILD_AT (fetch)
$BUILD_USER@$BUILD_HOST $BUILD_USER@$BUILD_HOST:$BUILD_AT (push)
origin git@your_remote(fetch)
origin git@your_remote(push)
1 Like
Thanks so much @alexandrubagu. Yes i have git installed on the build host. Please see below the output of the command.
$ git remote -v show
kehinde@46.101.30.23 kehinde@46.101.30.23:/home/kehinde/enterprise/builds (fetch)
kehinde@46.101.30.23 kehinde@46.101.30.23:/home/kehinde/enterprise/builds (push)
origin https://kehindealabi@bitbucket.org/afribary_dev/enterprise.git (fetch)
origin https://kehindealabi@bitbucket.org/afribary_dev/enterprise.git (push)
Do you build your project on localhost ? Do you copy ssh key under the vps ? You use Docker for the build ?
This is a .deliver/config
and works without problems:
AUTO_VERSION=commit-count+git-revision+branch-unless-master
APP="mockapp"
BUILD_CMD=mix
RELEASE_CMD=mix
USING_DISTILLERY=true
BUILD_HOST="localhost"
BUILD_USER="builder"
BUILD_AT="/tmp/edeliver/mockapp/builds"
RELEASE_DIR="/tmp/edeliver/mockapp/builds/rel/mockapp"
PRODUCTION_HOSTS="requestmock.com" # deploy / production hosts separated by space
PRODUCTION_USER="alexandrubagu" # local user at deploy hosts
DELIVER_TO="/home/alexandrubagu/apps" # deploy directory on production hosts
pre_erlang_clean_compile() {
status "Running npm install & phoenix.digest" # log output prepended with "----->"
__sync_remote " # runs the commands on the build host
set -e # fail if any command fails (recommended)
cd '$BUILD_AT/apps/frontend/' # enter the build directory on the build host
# prepare something
mkdir -p priv/static # required by the phoenix.digest tas
cd assets ; npm install ; npm run deploy; cd ..
# run your custom task
APP='$APP' MIX_ENV='$TARGET_MIX_ENV' $MIX_CMD phoenix.digest
"
}
I’m not building on localhost. Please see what my config file looks like
APP="enterprise"
BUILD_HOST="46.101.30.23"
BUILD_USER="kehinde"
BUILD_AT="/home/kehinde/$APP/builds"
RELEASE_DIR="/home/kehinde/$APP/builds/_build/prod/rel/$APP"
# prevent re-installing node modules; this defaults to "."
GIT_CLEAN_PATHS="_build rel priv/static"
STAGING_HOSTS="46.101.30.23"
STAGING_USER="kehinde"
TEST_AT="/home/kehinde/staging"
PRODUCTION_HOSTS="46.101.30.23"
PRODUCTION_USER="kehinde"
DELIVER_TO="/home/kehinde"
# For *Phoenix* projects, symlink prod.secret.exs to our tmp source
pre_erlang_get_and_update_deps() {
local _prod_secret_path="/home/kehinde/prod.secret.exs"
if [ "$TARGET_MIX_ENV" = "prod" ]; then
__sync_remote "
ln -sfn '$_prod_secret_path' '$BUILD_AT/config/prod.secret.exs'
"
fi
}
pre_erlang_clean_compile() {
status "Running phoenix.digest"
__sync_remote "
[ -f ~/.profile ] && source ~/.profile
set -e
cd '$BUILD_AT'
APP='$APP' MIX_ENV='$TARGET_MIX_ENV' $MIX_CMD phoenix.digest $SILENCE
"
}
I’m not using docker. I have the ssh keys on the vps.
I can successfully ssh to the server without any issue.
Please can you kindly help me understand how you set the BUILD_USER to builder. I’m on a mac os and I don’t know what to set as the BUILD_USER.
I use Docker for building because I don’t have same verion of OS on production. Here’s my Docker file:
FROM elixir:1.4
RUN \
apt-get update && \
apt-get install -y wget curl
RUN \
apt-get update && \
curl -sL https://deb.nodesource.com/setup_6.x | bash - && \
apt-get install -y nodejs
RUN \
apt-get update && \
apt-get install -y build-essential openssh-server htop git
RUN mkdir /var/run/sshd
# SSH login fix. Otherwise user is kicked off after login
RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
RUN useradd --system --shell=/bin/bash --create-home builder
COPY ssh_key.pub /home/builder/.ssh/authorized_keys
COPY ssh_key.pub /home/root/.ssh/authorized_keys
RUN mix local.hex
RUN mix local.rebar
CMD ["/usr/sbin/sshd", "-D"]
EXPOSE 22
As you can see I create user like this:
useradd --system --shell=/bin/bash --create-home builder
Thanks for this information. I really appreciate!
Huh, that’s buggy…
Why not just use your own script with distillary instead of using edeliver? 
That would have been great but I don’t have a sound knowledge of how to achieve that. Please do you have any script you could share?
Thanks immensely @OvermindDL1