diff --git a/apisix/cli/file.lua b/apisix/cli/file.lua index 9c528005e1fd..196ba1c86f9a 100644 --- a/apisix/cli/file.lua +++ b/apisix/cli/file.lua @@ -251,11 +251,18 @@ function _M.read_yaml_conf(apisix_home) end end - if default_conf.deployment - and default_conf.deployment.role == "traditional" - and default_conf.deployment.etcd - then - default_conf.etcd = default_conf.deployment.etcd + if default_conf.deployment then + if default_conf.deployment.role == "traditional" then + default_conf.etcd = default_conf.deployment.etcd + + elseif default_conf.deployment.role == "control_plane" then + default_conf.etcd = default_conf.deployment.etcd + default_conf.apisix.enable_admin = true + + elseif default_conf.deployment.role == "data_plane" then + default_conf.etcd = default_conf.deployment.role_data_plane.control_plane + default_conf.apisix.enable_admin = false + end end return default_conf diff --git a/apisix/core/etcd.lua b/apisix/core/etcd.lua index a57a5d0c86bf..caa6485690c1 100644 --- a/apisix/core/etcd.lua +++ b/apisix/core/etcd.lua @@ -42,12 +42,10 @@ local function new() return nil, nil, err end - local etcd_conf + local etcd_conf = clone_tab(local_conf.etcd) local proxy_by_conf_server = false if local_conf.deployment then - etcd_conf = clone_tab(local_conf.deployment.etcd) - if local_conf.deployment.role == "traditional" -- we proxy the etcd requests in traditional mode so we can test the CP's behavior in -- daily development. However, a stream proxy can't be the CP. @@ -65,8 +63,6 @@ local function new() -- TODO: add the proxy conf in control_plane proxy_by_conf_server = true end - else - etcd_conf = clone_tab(local_conf.etcd) end local prefix = etcd_conf.prefix @@ -417,7 +413,7 @@ end -- -- etcdserver = "3.5.0" -- -- } function _M.server_version() - local etcd_cli, err = new() + local etcd_cli, _, err = new() if not etcd_cli then return nil, err end diff --git a/conf/config-default.yaml b/conf/config-default.yaml index f35ec65b03c7..f03d31baca3a 100644 --- a/conf/config-default.yaml +++ b/conf/config-default.yaml @@ -289,7 +289,7 @@ etcd: #password: 5tHkHhYkjr6cQY # root password for etcd tls: # To enable etcd client certificate you need to build APISIX-Base, see - # https://apisix.apache.org/docs/apisix/FAQ#how-do-i-build-the-apisix-base-environment? + # https://apisix.apache.org/docs/apisix/FAQ#how-do-i-build-the-apisix-base-environment #cert: /path/to/cert # path of certificate used by the etcd client #key: /path/to/key # path of key used by the etcd client diff --git a/docs/en/latest/admin-api.md b/docs/en/latest/admin-api.md index 0dc4ee318b5f..deaf1c4c7ce1 100644 --- a/docs/en/latest/admin-api.md +++ b/docs/en/latest/admin-api.md @@ -565,7 +565,7 @@ The following should be considered when setting the `hash_on` value: - When set to `vars_combinations`, the `key` is required. The value of the key can be a combination of any of the [Nginx variables](http://nginx.org/en/docs/varindex.html) like `$request_uri$remote_addr`. - When no value is set for either `hash_on` or `key`, the key defaults to `remote_addr`. -The features described below requires APISIX to be run on [APISIX-Base](./FAQ.md#how-do-i-build-the-apisix-base-environment?): +The features described below requires APISIX to be run on [APISIX-Base](./FAQ.md#how-do-i-build-the-apisix-base-environment): You can set the `scheme` to `tls`, which means "TLS over TCP". diff --git a/docs/en/latest/architecture-design/apisix.md b/docs/en/latest/architecture-design/apisix.md index 8bef62289192..8eff707ba732 100644 --- a/docs/en/latest/architecture-design/apisix.md +++ b/docs/en/latest/architecture-design/apisix.md @@ -32,35 +32,3 @@ title: APISIX ## Plugin Hierarchy Structure ![flow-plugin-internal](../../../assets/images/flow-plugin-internal.png) - -## Configuring APISIX - -Apache APISIX can be configured in two ways: - -1. By directly changing `conf/config.yaml`. -2. Using the `--config` or the `-c` flag to pass in the file path of your config file while starting APISIX (`apisix start -c `). - -Configurations can be added to this YAML file and Apache APISIX will fall back to the default configurations for anything that is not configured in this file. - -For example, to set the default listening port to 8000 while keeping other configurations as default, your configuration file (`config.yaml`) would look like: - -```yaml -apisix: - node_listen: 8000 # APISIX listening port -``` - -Similarly, to set the listening port to 8000 and set the etcd address to `http://foo:2379` while keeping other configurations as default, your configuration file would look like: - -```yaml -apisix: - node_listen: 8000 # APISIX listening port - -etcd: - host: "http://foo:2379" # etcd address -``` - -Default configurations of APISIX can be found in the `conf/config-default.yaml` file. - -**Note**: This file is bound to the APISIX source code and should **NOT** be modified. The configuration should only be changed by the methods mentioned above. - -**Note**: The `conf/nginx.conf` file is automatically generated by APISIX and should **NOT** be edited. diff --git a/docs/en/latest/config.json b/docs/en/latest/config.json index 7fe61986b283..46c6ab4e9ce6 100644 --- a/docs/en/latest/config.json +++ b/docs/en/latest/config.json @@ -171,7 +171,7 @@ }, { "type": "category", - "label": "Other Protocols", + "label": "Other protocols", "items": [ "plugins/dubbo-proxy", "plugins/mqtt-proxy", diff --git a/docs/en/latest/installation-guide.md b/docs/en/latest/installation-guide.md index 9f3bda5a3282..775ceb5b36b0 100644 --- a/docs/en/latest/installation-guide.md +++ b/docs/en/latest/installation-guide.md @@ -43,6 +43,7 @@ APISIX can be installed by the different methods listed below: {label: 'Docker', value: 'docker'}, {label: 'Helm', value: 'helm'}, {label: 'RPM', value: 'rpm'}, + {label: 'Source Code', value: 'source code'}, ]}> @@ -166,6 +167,12 @@ Run `apisix help` to get a list of all available operations. ::: + + + + +If you want to build APISIX from source, please refer to [Building APISIX from source](./building-apisix.md). + @@ -207,6 +214,48 @@ brew services start etcd ## Next steps +### Configuring APISIX + +You can configure your APISIX deployment in two ways: + +1. By directly changing your configuration file (`conf/config.yaml`). +2. By using the `--config` or the `-c` flag to pass the path to your configuration file while starting APISIX. + + ```shell + apisix start -c + ``` + +APISIX will use the configurations added in this configuration file and will fall back to the default configuration if anything is not configured. + +For example, to configure the default listening port to be `8000` without changing other configurations, your configuration file could look like this: + +```yaml title="conf/config.yaml" +apisix: + node_listen: 8000 +``` + +Now, if you decide you want to change the etcd address to `http://foo:2379`, you can add it to your configuration file. This will not change other configurations. + +```yaml title="conf/config.yaml" +apisix: + node_listen: 8000 + +etcd: + host: "http://foo:2379" +``` + +:::warning + +APISIX's default configuration can be found in `conf/config-default.yaml` file and it should not be modified. It is bound to the source code and the configuration should only be changed by the methods mentioned above. + +::: + +:::warning + +The `conf/nginx.conf` file is automatically generated and should not be modified. + +::: + ### Updating Admin API key It is recommended to modify the Admin API key to ensure security. diff --git a/docs/en/latest/mtls.md b/docs/en/latest/mtls.md index b46e7d7b81e2..294d4b162fbf 100644 --- a/docs/en/latest/mtls.md +++ b/docs/en/latest/mtls.md @@ -66,7 +66,7 @@ curl --cacert /data/certs/mtls_ca.crt --key /data/certs/mtls_client.key --cert / ### How to configure -You need to build [APISIX-Base](./FAQ.md#how-do-i-build-the-apisix-base-environment?) and configure `etcd.tls` section if you want APISIX to work on an etcd cluster with mTLS enabled. +You need to build [APISIX-Base](./FAQ.md#how-do-i-build-the-apisix-base-environment) and configure `etcd.tls` section if you want APISIX to work on an etcd cluster with mTLS enabled. ```yaml etcd: diff --git a/docs/en/latest/plugins/dubbo-proxy.md b/docs/en/latest/plugins/dubbo-proxy.md index fb8873595039..c69dd6117776 100644 --- a/docs/en/latest/plugins/dubbo-proxy.md +++ b/docs/en/latest/plugins/dubbo-proxy.md @@ -1,5 +1,12 @@ --- title: dubbo-proxy +keywords: + - APISIX + - API Gateway + - Plugin + - Apache Dubbo + - dubbo-proxy +description: This document contains information about the Apache APISIX dubbo-proxy Plugin. ---