一、安装环境

1、官方最低要求

  • Docker 版本:20.10.0 及以上
  • 节点配置:4 核 CPU,8 GB 内存

2、自己实际环境

1、硬件环境
在这里插入图片描述
2、软件环境
在这里插入图片描述


二、安装文档

因为是自己机器安装,机器配置一般,所以只能选择 Docker Compose安装


三、安装步骤

1、执行脚本

打开自己的iTerm2运行如下脚本

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/erda-project/erda/master/quick-start/quick-start.sh)"

遇到问题一:执行过程中有可能(如果网络正常就不会碰到)碰到443错误,如下图所示
在这里插入图片描述
原因:网络偶尔有异常(raw.githubusercontent.com 域用于提供存储在GitHub存储库中的文件的未处理版本)
解决:两种方式

  • 方式一:搭建翻墙工具或者切换网络(我的情况是网络有异常,什么都没操作过了一会自己就正常)
  • 方式二:将下面shell保存到本地,然后运行。但是远程erda的脚本有可能变更;
#!/bin/bash
set -u
abort() {
  printf "%s\n" "$@"
  exit 1
}
if [ -z "${BASH_VERSION:-}" ]; then
  abort "Bash is required to interpret this script."
fi
# First check OS.
OS="$(uname)"
if [[ "$OS" == "Linux" ]]; then
  ON_LINUX=1
elif [[ "$OS" == "Darwin" ]]; then
  ON_MACOS=1
else
  abort "The script is only supported on macOS and Linux."
fi
if [[ -z "${ON_LINUX-}" ]]; then
  PERMISSION_FORMAT="%A"
  CHOWN="/usr/sbin/chown"
  CHGRP="/usr/bin/chgrp"
  GROUP="admin"
else
  PERMISSION_FORMAT="%a"
  CHOWN="/bin/chown"
  CHGRP="/bin/chgrp"
  GROUP="$(id -gn)"
fi
# string formatters
if [[ -t 1 ]]; then
  tty_escape() { printf "\033[%sm" "$1"; }
else
  tty_escape() { :; }
fi
tty_mkbold() { tty_escape "1;$1"; }
tty_underline="$(tty_escape "4;39")"
tty_blue="$(tty_mkbold 34)"
tty_red="$(tty_mkbold 31)"
tty_bold="$(tty_mkbold 39)"
tty_reset="$(tty_escape 0)"
have_sudo_access() {
  local -a args
  if [[ -n "${SUDO_ASKPASS-}" ]]; then
    args=("-A")
  elif [[ -n "${NONINTERACTIVE-}" ]]; then
    args=("-n")
  fi
  if [[ -z "${HAVE_SUDO_ACCESS-}" ]]; then
    if [[ -n "${args[*]-}" ]]; then
      SUDO="/usr/bin/sudo ${args[*]}"
    else
      SUDO="/usr/bin/sudo"
    fi
    if [[ -n "${NONINTERACTIVE-}" ]]; then
      ${SUDO} -l mkdir &>/dev/null
    else
      ${SUDO} -v && ${SUDO} -l mkdir &>/dev/null
    fi
    HAVE_SUDO_ACCESS="$?"
  fi
  if [[ -n "${ON_MACOS-}" ]] && [[ "$HAVE_SUDO_ACCESS" -ne 0 ]]; then
    abort "Need sudo access on macOS (e.g. the user $USER needs to be an Administrator)!"
  fi
  return "$HAVE_SUDO_ACCESS"
}
shell_join() {
  local arg
  printf "%s" "$1"
  shift
  for arg in "$@"; do
    printf " "
    printf "%s" "${arg// /\ }"
  done
}
ohai() {
  printf "${tty_blue}==>${tty_bold} %s${tty_reset}\n" "$(shell_join "$@")"
}
execute() {
  if ! "$@"; then
    abort "$(printf "Failed during: %s" "$(shell_join "$@")")"
  fi
}
execute_sudo() {
  local -a args=("$@")
  if have_sudo_access; then
    if [[ -n "${SUDO_ASKPASS-}" ]]; then
      args=("-A" "${args[@]}")
    fi
    ohai "/usr/bin/sudo" "${args[@]}"
    execute "/usr/bin/sudo" "${args[@]}"
  else
    ohai "${args[@]}"
    execute "${args[@]}"
  fi
}
# USER isn't always set so provide a fall back for the installer and subprocesses.
if [[ -z "${USER-}" ]]; then
  USER="$(chomp "$(id -un)")"
  export USER
fi
# Invalidate sudo timestamp before exiting (if it wasn't active before).
if ! /usr/bin/sudo -n -v 2>/dev/null; then
  trap '/usr/bin/sudo -k' EXIT
fi
# Things can fail later if `pwd` doesn't exist.
# Also sudo prints a warning message for no good reason
cd "/usr" || exit 1
######################################################script
if ! command -v git >/dev/null; then
    abort "$(cat <<EOABORT
You must install Git before installing Erda.
EOABORT
)"
fi
if ! command -v docker >/dev/null; then
    abort "$(cat <<EOABORT
You must install Docker before installing Erda.
EOABORT
)"
fi
if ! command -v docker-compose >/dev/null; then
    abort "$(cat <<EOABORT
You must install Docker-Compose before installing Erda.
EOABORT
)"
fi
if ! command -v nc >/dev/null; then
    abort "$(cat <<EOABORT
You must install netcat before installing Erda.
EOABORT
)"
fi
INSTALL_LOCATION="/opt/erda-quickstart"
ERDA_REPOSITORY="https://github.com/erda-project/erda.git"
ERDA_VERSION="23936e9"
# shellcheck disable=SC2016
ohai 'Checking for `sudo` access (which may request your password).'
have_sudo_access
# chown
if ! [[ -d "${INSTALL_LOCATION}" ]]; then
  execute_sudo "/bin/mkdir" "-p" "${INSTALL_LOCATION}"
fi
execute_sudo "$CHOWN" "-R" "$USER:$GROUP" "${INSTALL_LOCATION}"
ohai "Start clone Erda[${ERDA_REPOSITORY}] to ${INSTALL_LOCATION}"
(
  cd "${INSTALL_LOCATION}" >/dev/null || return
  # we do it in four steps to avoid merge errors when reinstalling
  execute "git" "init" "-q"
  # "git remote add" will fail if the remote is defined in the global config
  execute "git" "config" "remote.origin.url" "${ERDA_REPOSITORY}"
  execute "git" "config" "remote.origin.fetch" "+refs/heads/*:refs/remotes/origin/*"
  # ensure we don't munge line endings on checkout
  execute "git" "config" "core.autocrlf" "false"
  execute "git" "fetch" "--force" "origin"
  execute "git" "fetch" "--force" "--tags" "origin"
  execute "git" "reset" "--hard" "${ERDA_VERSION}"
) || exit 1
ohai "Start setup Erda using ${INSTALL_LOCATION}/quick-start/docker-compose.yml"
cd "${INSTALL_LOCATION}/quick-start" || exit 1
execute "docker-compose" "up" "-d" "mysql" || exit 1
echo "waiting for mysql ready"
sleep 10
i=1
until nc -z localhost 3306
do
  sleep 10
  if ((i++ >= 100)); then
    echo "timeout waiting for mysql ready"
    exit 1
  fi
done
execute "docker-compose" "up" "erda-migration" || exit 1
execute "docker-compose" "up" "sysctl-init" || exit 1
execute "docker-compose" "up" "-d" "elasticsearch" || exit 1
execute "docker-compose" "up" "-d" "cassandra" || exit 1
execute "docker-compose" "up" "-d" "kafka" || exit 1
execute "docker-compose" "up" "-d" || exit 1
ohai "Setup local hosts"
(
  exists_in_host="$(grep -n erda.local /etc/hosts)"
  if [ -z "$exists_in_host" ]; then
    echo "127.0.0.1 erda.local one.erda.local" | execute_sudo "tee" "-a" "/etc/hosts"
  fi
) || exit 1
ohai "Erda has been started successfully using ${INSTALL_LOCATION}/quick-start/docker-compose.yml"
ohai "Next steps:"
echo "visit ${tty_underline}http://erda.local${tty_reset} to start your journey on Erda"
echo "visit ${tty_underline}https://github.com/erda-project/erda/blob/master/docs/guides/quickstart/quickstart-full.md#try-erda${tty_reset} for basic use of Erda"
echo "visit ${tty_underline}https://docs.erda.cloud${tty_reset} for full introduction of Erda"
echo "goto ${INSTALL_LOCATION}/quick-start/ dir to check and manage the docker-compose resources"

效果:刷刷刷,程序运行起来了,如下图
在这里插入图片描述


遇到问题二:文件夹缺少权限
现象:文件 is not shared ,具体如下

Creating erda-migration ... error
ERROR: for erda-migration  Cannot start service erda-migration: Mounts denied:
The path /opt/erda-quickstart/.erda/migrations is not shared from the host and is not known to Docker.
You can configure shared paths from Docker -> Preferences... -> Resources -> File Sharing.
See https://docs.docker.com/docker-for-mac for more info.
ERROR: for erda-migration  Cannot start service erda-migration: Mounts denied:
The path /opt/erda-quickstart/.erda/migrations is not shared from the host and is not known to Docker.
You can configure shared paths from Docker -> Preferences... -> Resources -> File Sharing.
See https://docs.docker.com/docker-for-mac for more info.
ERROR: Encountered errors while bringing up the project.
Failed during: docker-compose up erda-migration

在这里插入图片描述
原因:erda安装过程中会创建一个/opt/erda-quickstart文件夹,但是该文件夹没有被shared,导致docker执行文件夹下命令时候Mounts denied
解决:将该文件夹shared,操作Docker -> Preferences… -> Resources -> File Sharing.如下图
在这里插入图片描述

文件夹共享后,可以重新执行下/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/erda-project/erda/master/quick-start/quick-start.sh)” 最终看到successfully
在这里插入图片描述


2、访问平台

浏览器上直接访问 http://erda.local
注:erda安装过程中给本机hosts里添加了一行数据,所以可以通过上面域名访问

127.0.0.1 erda.local one.erda.local

系统进入一个登录页面,没有账密(erda为何不给数据库中主动插入一条账户数据呢?),选择注册用户,注册成功后进入主页
在这里插入图片描述
在这里插入图片描述

遇到问题一:当前页面不存在
http://one.erda.local/-/sysAdmin/orgs
在这里插入图片描述

问题原因:注意到该页面地址为 sysAdmin/orgs,即超级管理员管理页,该模块暂时还未包含在开源包内(我们将在近期开放该模块)。Erda 首次注册到账号会默认成为超级管理员,因此会自动尝试跳转到该页面。
解决方法:您可以退出首次注册的账号,然后再次注册一个新账号,使用新的账号登录后将会跳转到个人仪表盘页面,如下图所示,您可以从点击页面左上方的 创建机构 按钮开始体验 Erda。

重新注册第二个用户后终于可以正常使用。PS第一个账户注册时候密码没有要求,注册第二个账户密码有一定长度+强弱要求;

在这里插入图片描述

后续其他操作见erda官网文档

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐