Skip to content

Commit

Permalink
doc: Update Backend.AI production installation guide doc (#1796)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoyajigi authored Dec 26, 2023
1 parent 8ef6fdd commit b51f28a
Show file tree
Hide file tree
Showing 10 changed files with 133 additions and 30 deletions.
1 change: 1 addition & 0 deletions changes/1796.doc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update Backend.AI production installation guide doc
2 changes: 1 addition & 1 deletion docs/dev/development-setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ Open yet another terminal for client and run:
.. code-block:: console
$ source ./env-local-admin-api.sh # Use the generated local endpoint and credential config.
$ # source ./env-local-user-api.sh # Yo may choose an alternative credential config.
$ # source ./env-local-user-api.sh # You may choose an alternative credential config.
$ ./backend.ai config
$ ./backend.ai run python --rm -c 'print("hello world")'
∙ Session token prefix: fb05c73953
Expand Down
5 changes: 4 additions & 1 deletion docs/install/install-from-package/install-agent.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ would be:
scratch-size = "1G"
[watcher]
service-addr = { host = "bai-m1", port = 6009 }
service-addr = { host = "bai-a01"", port = 6009 }
ssl-enabled = false
target-service = "backendai-agent.service"
soft-reset-available = false
Expand Down Expand Up @@ -189,6 +189,9 @@ First, create a runner script at ``${HOME}/bin/run-agent.sh``:
export HOME="/home/bai"
fi
# -- If you have installed using static python --
source .venv/bin/activate
# -- If you have installed using pyenv --
if [ -z "$PYENV_ROOT" ]; then
export PYENV_ROOT="$HOME/.pyenv"
Expand Down
3 changes: 3 additions & 0 deletions docs/install/install-from-package/install-manager.rst
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,9 @@ First, create a runner script at ``${HOME}/bin/run-manager.sh``:
export HOME="/home/bai"
fi
# -- If you have installed using static python --
source .venv/bin/activate
# -- If you have installed using pyenv --
if [ -z "$PYENV_ROOT" ]; then
export PYENV_ROOT="$HOME/.pyenv"
Expand Down
3 changes: 3 additions & 0 deletions docs/install/install-from-package/install-storage-proxy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ First, create a runner script at ``${HOME}/bin/run-storage-proxy.sh``:
export HOME="/home/bai"
fi
# -- If you have installed using static python --
source .venv/bin/activate
# -- If you have installed using pyenv --
if [ -z "$PYENV_ROOT" ]; then
export PYENV_ROOT="$HOME/.pyenv"
Expand Down
65 changes: 63 additions & 2 deletions docs/install/install-from-package/install-webserver.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ would be:
[ui]
brand = "Backend.AI"
default_environment = "cr.backend.ai/stable/python"
default_import_environment = "cr.backend.ai/filebrowser:21.02-ubuntu20.04"
menu_blocklist = "pipeline"
[api]
domain = "default"
Expand All @@ -89,6 +88,65 @@ would be:
[license]
[webserver]
[logging]
# One of: "NOTSET", "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"
# Set the global logging level.
level = "INFO"
# Multi-choice of: "console", "logstash", "file"
# For each choice, there must be a "logging.<driver>" section
# in this config file as exemplified below.
drivers = ["console", "file"]
[logging.console]
# If set true, use ANSI colors if the console is a terminal.
# If set false, always disable the colored output in console logs.
colored = true
# One of: "simple", "verbose"
format = "verbose"
[logging.file]
# The log file path and filename pattern.
# All messages are wrapped in single-line JSON objects.
# Rotated logs may have additional suffixes.
# For production, "/var/log/backend.ai" is recommended.
path = "./logs"
filename = "webserver.log"
# Set the maximum number of recent container coredumps in the coredump directory.
# Oldest coredumps are deleted if there is more than this number of coredumps.
backup-count = 10
# The log file size to begin rotation.
rotation-size = "10M"
[logging.logstash]
# The endpoint to publish logstash records.
endpoint = { host = "localhost", port = 9300 }
# One of: "zmq.push", "zmq.pub", "tcp", "udp"
protocol = "tcp"
# SSL configs when protocol = "tcp"
ssl-enabled = true
ssl-verify = true
# Specify additional package namespaces to include in the logs
# and their individual log levels.
# Note that the actual logging level applied is the conjunction of the global logging level and the
# logging levels specified here for each namespace.
[logging.pkg-ns]
"" = "WARNING"
"aiotools" = "INFO"
"aiohttp" = "INFO"
"ai.backend" = "INFO"
[debug]
enabled = false
[plugin]
[pipeline]
Expand Down Expand Up @@ -127,6 +185,9 @@ First, create a runner script at ``${HOME}/bin/run-webserver.sh``:
export HOME="/home/bai"
fi
# -- If you have installed using static python --
source .venv/bin/activate
# -- If you have installed using pyenv --
if [ -z "$PYENV_ROOT" ]; then
export PYENV_ROOT="$HOME/.pyenv"
Expand Down
52 changes: 42 additions & 10 deletions docs/install/install-from-package/os-preparation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,51 @@ information on the Python version compatibility can be found at
`here <https://github.com/lablup/backend.ai#package-installation-guide#python-version-compatibility>`_.

There can be several ways to prepare a specific Python version. Here, we will be
using pyenv and pyenv-virtualenv.
using a standalone static built Python.

Use a standalone static built Python (Recommended)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Obtain distribution of `a standalone static built Python <https://github.com/indygreg/python-build-standalone/releases>`_ according to required
python version, target machine architecture and etc. Then extract the distribution
to a directory of your choice.

.. code-block:: console
$ curl -L "https://github.com/indygreg/python-build-standalone/releases/download/${PYTHON_RELEASE_DATE}/cpython-${PYTHON_VERSION}+${PYTHON_RELEASE_DATE}-${TARGET_MACHINE_ARCHITECTURE}-${ARCHIVE_FLAVOR}.tar.gz" > cpython-${PYTHON_VERSION}+${PYTHON_RELEASE_DATE}-${TARGET_MACHINE_ARCHITECTURE}-${ARCHIVE_FLAVOR}.tar.gz
$ tar -xf "cpython-${PYTHON_VERSION}+${PYTHON_RELEASE_DATE}-${TARGET_MACHINE_ARCHITECTURE}-${ARCHIVE_FLAVOR}.tar.gz"
$ mkdir -p "/home/${USERNAME}/.static-python/versions"
$ mv python "/home/${USERNAME}/.static-python/versions/${PYTHON_VERSION}"
For example,

.. code-block:: console
$ curl -L "https://github.com/indygreg/python-build-standalone/releases/download/20231002/cpython-3.11.6+20231002-x86_64-unknown-linux-gnu-install_only.tar.gz" > cpython-3.11.6+20231002-x86_64-unknown-linux-gnu-install_only.tar.gz
$ tar -xf "cpython-3.11.6+20231002-x86_64-unknown-linux-gnu-install_only.tar.gz"
$ mkdir -p "/home/bai/.static-python/versions"
$ mv python "/home/bai/.static-python/versions/3.11.6"
Then, you can create multiple virtual environments per service. To create a
virtual environment for Backend.AI Manager and activate it, for example, you may run:

.. code-block:: console
$ mkdir "${HOME}/manager"
$ cd "${HOME}/manager"
$ ~/.static-python/versions/3.11.6/bin/python3 -m venv .venv
$ source .venv/bin/activate
$ pip install -U pip setuptools wheel
You also need to make ``pip`` available to the Python installation with the
latest ``wheel`` and ``setuptools`` packages, so that any non-binary extension
packages can be compiled and installed on your system.

Use pyenv to manually build and select a specific Python version


(Alternative) Use pyenv to manually build and select a specific Python version
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If you prefer, there is no problem using pyenv and pyenv-virtualenv.

Install `pyenv <https://github.com/pyenv/pyenv>`_ and
`pyenv-virtualenv <https://github.com/pyenv/pyenv-virtualenv>`_. Then, install
Expand Down Expand Up @@ -150,14 +190,6 @@ latest ``wheel`` and ``setuptools`` packages, so that any non-binary extension
packages can be compiled and installed on your system.


Use a standalone static built Python
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

We can `use a standalone static built Python <https://github.com/indygreg/python-build-standalone/releases>`_.

.. warning:: Details will be added later.


Configure network aliases
-------------------------

Expand Down
10 changes: 5 additions & 5 deletions docs/install/install-from-package/prepare-cache-service.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Prepare Cache Service

Backend.AI makes use of Redis as its main cache service. Launch the service
using docker compose by generating the file
``$HOME/halfstack/docker-compose.hs.redis.yaml`` and populating it with the
``$HOME/halfstack/redis-cluster-default/docker-compose.yaml`` and populating it with the
following YAML. Feel free to adjust the volume paths and port settings. Please
refer
`the latest configuration <https://github.com/lablup/backend.ai/blob/main/docker-compose.halfstack-main.yml>`_
Expand Down Expand Up @@ -50,9 +50,9 @@ Execute the following command to start the service container. The project

.. code-block:: console
$ cd ${HOME}/halfstack
$ docker compose -f docker-compose.hs.redis.yaml -p ${USER} up -d
$ cd ${HOME}/halfstack/redis-cluster-default
$ docker compose up -d
$ # -- To terminate the container:
$ # docker compose -f docker-compose.hs.redis.yaml -p ${USER} down
$ # docker compose down
$ # -- To see the container logs:
$ # docker compose -f docker-compose.hs.redis.yaml -p ${USER} logs -f
$ # docker compose logs -f
10 changes: 5 additions & 5 deletions docs/install/install-from-package/prepare-config-service.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Prepare Config Service

Backend.AI makes use of Etcd as its main config service. Launch the service
using docker compose by generating the file
``$HOME/halfstack/docker-compose.hs.etcd.yaml`` and populating it with the
``$HOME/halfstack/etcd-cluster-default/docker-compose.yaml`` and populating it with the
following YAML. Feel free to adjust the volume paths and port settings. Please
refer
`the latest configuration <https://github.com/lablup/backend.ai/blob/main/docker-compose.halfstack-main.yml>`_
Expand Down Expand Up @@ -59,9 +59,9 @@ Execute the following command to start the service container. The project

.. code-block:: console
$ cd ${HOME}/halfstack
$ docker compose -f docker-compose.hs.etcd.yaml -p ${USER} up -d
$ cd ${HOME}/halfstack/etcd-cluster-default
$ docker compose up -d
$ # -- To terminate the container:
$ # docker compose -f docker-compose.hs.etcd.yaml -p ${USER} down
$ # docker compose down
$ # -- To see the container logs:
$ # docker compose -f docker-compose.hs.etcd.yaml -p ${USER} logs -f
$ # docker compose logs -f
12 changes: 6 additions & 6 deletions docs/install/install-from-package/prepare-database.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Prepare Database

Backend.AI makes use of PostgreSQL as its main database. Launch the service
using docker compose by generating the file
``$HOME/halfstack/docker-compose.hs.postgres.yaml`` and populating it with the
``$HOME/halfstack/postgres-cluster-default/docker-compose.yaml`` and populating it with the
following YAML. Feel free to adjust the volume paths and port settings. Please
refer
`the latest configuration <https://github.com/lablup/backend.ai/blob/main/docker-compose.halfstack-main.yml>`_
Expand All @@ -22,7 +22,7 @@ refer
services:
backendai-pg-active:
<<: *base
image: postgres:13.2-alpine
image: postgres:15.1-alpine
restart: unless-stopped
command: >
postgres
Expand Down Expand Up @@ -58,9 +58,9 @@ Execute the following command to start the service container. The project

.. code-block:: console
$ cd ${HOME}/halfstack
$ docker compose -f docker-compose.hs.postgres.yaml -p ${USER} up -d
$ cd ${HOME}/halfstack/postgres-cluster-default
$ docker compose up -d
$ # -- To terminate the container:
$ # docker compose -f docker-compose.hs.postgres.yaml -p ${USER} down
$ # docker compose down
$ # -- To see the container logs:
$ # docker compose -f docker-compose.hs.postgres.yaml -p ${USER} logs -f
$ # docker compose logs -f

0 comments on commit b51f28a

Please sign in to comment.