fix: add quick start with sqlite in README doc

1. add quick launch steps for skyline docker image with sqlite

Change-Id: I6c29bdacae09ac5fec40d60b92c57c8786c0aa52
This commit is contained in:
Wu Wenxiang 2021-08-05 15:57:03 +08:00
parent c78ef2f522
commit 3a1fab6085
2 changed files with 262 additions and 206 deletions

View File

@ -22,9 +22,46 @@ Skyline 是一个经过 UI 和 UE 优化过的 OpenStack 仪表盘, 拥有现代
- 一个至少运行核心组件的 OpenStack 环境, 并能通过 Keystone endpoint 访问 OpenStack 组件 - 一个至少运行核心组件的 OpenStack 环境, 并能通过 Keystone endpoint 访问 OpenStack 组件
- 一个安装有容器引擎的 ([docker](https://docs.docker.com/engine/install/) 或 [podman](https://podman.io/getting-started/installation)) 的 Linux 服务器 - 一个安装有容器引擎的 ([docker](https://docs.docker.com/engine/install/) 或 [podman](https://podman.io/getting-started/installation)) 的 Linux 服务器
### 配置和部署 ### 配置
#### 1. 连接 OpenStack 环境的数据库, 并创建 `skyline` 数据库 1. 在 Linux 服务器中编辑 `/etc/skyline/skyline.yaml` 文件
可以参考 [sample file](etc/skyline.yaml.sample), 并根据实际的环境修改以下参数
- database_url
- keystone_url
- default_region
- interface_type
- system_project_domain
- system_project
- system_user_domain
- system_user_name
- system_user_password
### 部署 - 数据库使用 Sqlite
1. 运行 skyline_bootstrap 容器进行初始化引导
```bash
rm -rf /tmp/skyline && mkdir /tmp/skyline
docker run -d --name skyline_bootstrap -e KOLLA_BOOTSTRAP="" -v /etc/skyline/skyline.yaml:/etc/skyline/skyline.yaml -v /tmp/skyline:/tmp --net=host 99cloud/skyline:latest
# Check bootstrap is normal `exit 0`
docker logs skyline_bootstrap
```
2. 初始化引导完成后运行 skyline 服务
```bash
docker rm -f skyline_bootstrap
docker run -d --name skyline --restart=always -v /etc/skyline/skyline.yaml:/etc/skyline/skyline.yaml -v /tmp/skyline:/tmp --net=host 99cloud/skyline:latest
```
### 部署 - 数据库使用 MariaDB
1. 连接 OpenStack 环境的数据库, 并创建 `skyline` 数据库
```bash ```bash
$ mysql -u root -p $ mysql -u root -p
@ -32,7 +69,7 @@ MariaDB [(none)]> CREATE DATABASE IF NOT EXISTS skyline DEFAULT CHARACTER SET ut
Query OK, 1 row affected (0.001 sec) Query OK, 1 row affected (0.001 sec)
``` ```
#### 2. 授予对数据库的适当访问权限 2. 授予对数据库的适当访问权限
用合适的密码替换 `SKYLINE_DBPASS` 用合适的密码替换 `SKYLINE_DBPASS`
@ -44,7 +81,7 @@ MariaDB [(none)]> GRANT ALL PRIVILEGES ON skyline.* TO 'skyline'@'%' IDENTIFIED
Query OK, 0 rows affected (0.001 sec) Query OK, 0 rows affected (0.001 sec)
``` ```
#### 3. 创建 skyline 服务凭证 3. 创建 skyline 服务凭证
```bash ```bash
# Source the admin credentials # Source the admin credentials
@ -69,38 +106,24 @@ Repeat User Password:
$ openstack role add --project service --user skyline admin $ openstack role add --project service --user skyline admin
``` ```
#### 4. 在 Linux 服务器中编辑 `/etc/skyline/skyline.yaml` 文件 4. 运行 skyline_bootstrap 容器进行初始化引导
可以参考 [sample file](etc/skyline.yaml.sample), 并根据实际的环境修改以下参数
- database_url
- keystone_url
- default_region
- interface_type
- system_project_domain
- system_project
- system_user_domain
- system_user_name
- system_user_password
#### 5. 运行 skyline_bootstrap 容器进行初始化引导
```bash ```bash
docker run -d --name skyline_bootstrap -e KOLLA_BOOTSTRAP="" -v /etc/skyline/skyline.yaml:/etc/skyline/skyline.yaml --net=host skyline:latest docker run -d --name skyline_bootstrap -e KOLLA_BOOTSTRAP="" -v /etc/skyline/skyline.yaml:/etc/skyline/skyline.yaml --net=host 99cloud/skyline:latest
# Check bootstrap is normal `exit 0` # Check bootstrap is normal `exit 0`
docker logs skyline_bootstrap docker logs skyline_bootstrap
``` ```
#### 5. 初始化引导完成后运行 skyline 服务 5. 初始化引导完成后运行 skyline 服务
```bash ```bash
docker rm -f skyline_bootstrap docker rm -f skyline_bootstrap
docker run -d --name skyline --restart=always -v /etc/skyline/skyline.yaml:/etc/skyline/skyline.yaml --net=host skyline:latest docker run -d --name skyline --restart=always -v /etc/skyline/skyline.yaml:/etc/skyline/skyline.yaml --net=host 99cloud/skyline:latest
``` ```
#### 6. 完成安装 ### 访问测试
现在你可以访问仪表盘: `https://<ip_address>:8080` 现在你可以访问仪表盘: `https://<ip_address>:8080`
@ -110,22 +133,21 @@ docker run -d --name skyline --restart=always -v /etc/skyline/skyline.yaml:/etc/
### 依赖工具 ### 依赖工具
- python >= 3.8
- yarn >= 1.22.4
- node >= 10.22.0
- make >= 3.82 - make >= 3.82
- poetry >= 1.1.0 - python >= 3.8
([安装指南](https://python-poetry.org/docs/#installation)) - poetry >= 1.1.0 ([安装指南](https://python-poetry.org/docs/#installation))
- node >= 10.22.0
- yarn >= 1.22.4
### 安装和运行 ### 安装和运行
#### 1. 安装依赖包 1. 安装依赖包
```bash ```bash
make install make install
``` ```
#### 2. 配置 `skyline.yaml` 文件 2. 配置 `skyline.yaml` 文件
```bash ```bash
cp etc/skyline.yaml.sample etc/skyline.yaml cp etc/skyline.yaml.sample etc/skyline.yaml
@ -147,9 +169,9 @@ export OS_CONFIG_DIR=$(pwd)/etc
``` ```
> 如果你为 `database_url` 设置了类似 `sqlite:////tmp/skyline.db` ,只需要执行以下操作。 > 如果你为 `database_url` 设置了类似 `sqlite:////tmp/skyline.db` ,只需要执行以下操作。
> 如果你为 `database_url` 设置了类似 `mysql://root:root@localhost:3306/skyline` ,你应该先参考 `配置和部署` 一章中的 `1``2` 步骤。 > 如果你为 `database_url` 设置了类似 `mysql://root:root@localhost:3306/skyline` ,你应该先参考 `部署 - 数据库使用 MariaDB` 一章中的 `1``2` 步骤。
#### 3. 初始化 skyline 数据库 3. 初始化 skyline 数据库
```bash ```bash
pushd libs/skyline-apiserver/ pushd libs/skyline-apiserver/
@ -157,7 +179,7 @@ make db_sync
popd popd
``` ```
#### 4. 运行 skyline-apiserver 4. 运行 skyline-apiserver
```bash ```bash
$ poetry run uvicorn --reload --reload-dir libs/skyline-apiserver/skyline_apiserver --port 28000 --log-level debug skyline_apiserver.main:app $ poetry run uvicorn --reload --reload-dir libs/skyline-apiserver/skyline_apiserver --port 28000 --log-level debug skyline_apiserver.main:app
@ -170,3 +192,9 @@ INFO: Application startup complete.
``` ```
此时你可访问在线 API 文档:`http://127.0.0.1:28000/docs` 此时你可访问在线 API 文档:`http://127.0.0.1:28000/docs`
5. 构建镜像
```bash
make build
```

View File

@ -22,9 +22,46 @@ Skyline is an OpenStack dashboard optimized by UI and UE. It has a modern techno
- An OpenStack environment that runs at least core components and can access OpenStack components through Keystone endpoints - An OpenStack environment that runs at least core components and can access OpenStack components through Keystone endpoints
- A Linux server with container engine ([docker](https://docs.docker.com/engine/install/) or [podman](https://podman.io/getting-started/installation)) installed - A Linux server with container engine ([docker](https://docs.docker.com/engine/install/) or [podman](https://podman.io/getting-started/installation)) installed
### Configure and deployment ### Configure
#### 1. Connect to database of the OpenStack environment and create the `skyline` database 1. Edit the `/etc/skyline/skyline.yaml` file in linux server
You can refer to the [sample file](etc/skyline.yaml.sample), and modify the following parameters according to the actual environment
- database_url
- keystone_url
- default_region
- interface_type
- system_project_domain
- system_project
- system_user_domain
- system_user_name
- system_user_password
### Deployment with Sqlite
1. Run the skyline_bootstrap container to bootstrap
```bash
rm -rf /tmp/skyline && mkdir /tmp/skyline
docker run -d --name skyline_bootstrap -e KOLLA_BOOTSTRAP="" -v /etc/skyline/skyline.yaml:/etc/skyline/skyline.yaml -v /tmp/skyline:/tmp --net=host 99cloud/skyline:latest
# Check bootstrap is normal `exit 0`
docker logs skyline_bootstrap
```
2. Run the skyline service after bootstrap is complete
```bash
docker rm -f skyline_bootstrap
docker run -d --name skyline --restart=always -v /etc/skyline/skyline.yaml:/etc/skyline/skyline.yaml -v /tmp/skyline:/tmp --net=host 99cloud/skyline:latest
```
### Deployment with MariaDB
1. Connect to database of the OpenStack environment and create the `skyline` database
```bash ```bash
$ mysql -u root -p $ mysql -u root -p
@ -32,7 +69,7 @@ MariaDB [(none)]> CREATE DATABASE IF NOT EXISTS skyline DEFAULT CHARACTER SET ut
Query OK, 1 row affected (0.001 sec) Query OK, 1 row affected (0.001 sec)
``` ```
#### 2. Grant proper access to the databases 2. Grant proper access to the databases
Replace `SKYLINE_DBPASS` with a suitable password. Replace `SKYLINE_DBPASS` with a suitable password.
@ -44,7 +81,7 @@ MariaDB [(none)]> GRANT ALL PRIVILEGES ON skyline.* TO 'skyline'@'%' IDENTIFIED
Query OK, 0 rows affected (0.001 sec) Query OK, 0 rows affected (0.001 sec)
``` ```
#### 3. Create skyline service credentials 3. Create skyline service credentials
```bash ```bash
# Source the admin credentials # Source the admin credentials
@ -69,38 +106,24 @@ Repeat User Password:
$ openstack role add --project service --user skyline admin $ openstack role add --project service --user skyline admin
``` ```
#### 4. Edit the `/etc/skyline/skyline.yaml` file in linux server 4. Run the skyline_bootstrap container to bootstrap
You can refer to the [sample file](etc/skyline.yaml.sample), and modify the following parameters according to the actual environment
- database_url
- keystone_url
- default_region
- interface_type
- system_project_domain
- system_project
- system_user_domain
- system_user_name
- system_user_password
#### 5. Run the skyline_bootstrap container to bootstrap
```bash ```bash
docker run -d --name skyline_bootstrap -e KOLLA_BOOTSTRAP="" -v /etc/skyline/skyline.yaml:/etc/skyline/skyline.yaml --net=host skyline:latest docker run -d --name skyline_bootstrap -e KOLLA_BOOTSTRAP="" -v /etc/skyline/skyline.yaml:/etc/skyline/skyline.yaml --net=host 99cloud/skyline:latest
# Check bootstrap is normal `exit 0` # Check bootstrap is normal `exit 0`
docker logs skyline_bootstrap docker logs skyline_bootstrap
``` ```
#### 5. Run the skyline service after bootstrap is complete 5. Run the skyline service after bootstrap is complete
```bash ```bash
docker rm -f skyline_bootstrap docker rm -f skyline_bootstrap
docker run -d --name skyline --restart=always -v /etc/skyline/skyline.yaml:/etc/skyline/skyline.yaml --net=host skyline:latest docker run -d --name skyline --restart=always -v /etc/skyline/skyline.yaml:/etc/skyline/skyline.yaml --net=host 99cloud/skyline:latest
``` ```
#### 6. finish installation ### Test Access
You can now access the dashboard: `https://<ip_address>:8080` You can now access the dashboard: `https://<ip_address>:8080`
@ -110,22 +133,21 @@ You can now access the dashboard: `https://<ip_address>:8080`
### Dependent tools ### Dependent tools
- python >= 3.8
- yarn >= 1.22.4
- node >= 10.22.0
- make >= 3.82 - make >= 3.82
- poetry >= 1.1.0 - python >= 3.8
([Installation Guide](https://python-poetry.org/docs/#installation)) - poetry >= 1.1.0 ([Installation Guide](https://python-poetry.org/docs/#installation))
- node >= 10.22.0
- yarn >= 1.22.4
### Install & Run ### Install & Run
#### 1. Installing dependency packages 1. Installing dependency packages
```bash ```bash
make install make install
``` ```
#### 2. Set skyline.yaml config file 2. Set skyline.yaml config file
```bash ```bash
cp etc/skyline.yaml.sample etc/skyline.yaml cp etc/skyline.yaml.sample etc/skyline.yaml
@ -147,9 +169,9 @@ Maybe you should change the params with your real environment as followed:
``` ```
> If you set such as `sqlite:////tmp/skyline.db` for `database_url` , just do as followed. > If you set such as `sqlite:////tmp/skyline.db` for `database_url` , just do as followed.
> If you set such as `mysql://root:root@localhost:3306/skyline` for `database_url` , you should refer to steps `1` and `2` of the chapter `Configure and deployment` at first. > If you set such as `mysql://root:root@localhost:3306/skyline` for `database_url` , you should refer to steps `1` and `2` of the chapter `Deployment with MariaDB` at first.
#### 3. Init skyline database 3. Init skyline database
```bash ```bash
pushd libs/skyline-apiserver/ pushd libs/skyline-apiserver/
@ -157,7 +179,7 @@ make db_sync
popd popd
``` ```
#### 4. Run skyline-apiserver 4. Run skyline-apiserver
```bash ```bash
$ poetry run uvicorn --reload --reload-dir libs/skyline-apiserver/skyline_apiserver --port 28000 --log-level debug skyline_apiserver.main:app $ poetry run uvicorn --reload --reload-dir libs/skyline-apiserver/skyline_apiserver --port 28000 --log-level debug skyline_apiserver.main:app
@ -170,3 +192,9 @@ INFO: Application startup complete.
``` ```
You can now access the online API documentation: `http://127.0.0.1:28000/docs` You can now access the online API documentation: `http://127.0.0.1:28000/docs`
5. Build Image
```bash
make build
```