Open troke12 opened 3 months ago
I tried to another solution where it's worked as well
so, in the command section i added :
command: ["sh", "-c", "cp /mnt/apisix.yaml /usr/local/apisix/conf/ && apisix start --config /usr/local/apisix/conf/apisix.yaml"]
but the auto-reload not working when i added a changes, seems like need to fix that command
In Apache APISIX, different configuration files serve different purposes. By default, there are three configuration files: conf/config.yaml, conf/apisix.yaml, and conf/debug.yaml.
conf/config.yaml:
This file is the global configuration file for Apache APISIX. It contains basic system configurations and key parameters such as port settings, log levels, ETCD configurations, plugin configurations, and more. conf/apisix.yaml:
This file is mainly used to define runtime configurations for routes, services, upstreams, plugins, etc. Users can define various routing rules, services and their corresponding upstream servers, and enable or configure plugins for specific routes in this file. conf/debug.yaml:
This file is used for configurations in debugging and development modes, usually to enable additional logging and debugging information. Relevant links:
Introduction to APISIX configuration files Configuration rules for stand-alone mode When starting in stand-alone mode, the APISIX node service will immediately load the routing rules from the conf/apisix.yaml file into memory (as described in the official documentation). In your command, the --config option is used to specify the conf/config.yaml file, but the node will still load the default conf/apisix.yaml file. This is the cause of the error. If you want to replace the default conf/apisix.yaml with your own apisix.yaml, you can mount it to the corresponding path. The complete docker-compose file is as follows:
version: '3.9'
services:
apisix:
image: apache/apisix:3.9.1-debian
environment:
APISIX_STAND_ALONE: "true"
ports:
- '9080:9080'
container_name: apache-apisix
volumes:
- ./apisix.yaml:/usr/local/apisix/conf/apisix.yaml:ro
# - ./apisix.yaml:/mnt/config.yaml:ro
restart: always
# command: apisix start --config /mnt/config.yaml
In Apache APISIX, different configuration files serve different purposes. By default, there are three configuration files: conf/config.yaml, conf/apisix.yaml, and conf/debug.yaml.
conf/config.yaml:
This file is the global configuration file for Apache APISIX. It contains basic system configurations and key parameters such as port settings, log levels, ETCD configurations, plugin configurations, and more. conf/apisix.yaml:
This file is mainly used to define runtime configurations for routes, services, upstreams, plugins, etc. Users can define various routing rules, services and their corresponding upstream servers, and enable or configure plugins for specific routes in this file. conf/debug.yaml:
This file is used for configurations in debugging and development modes, usually to enable additional logging and debugging information. Relevant links:
Introduction to APISIX configuration files Configuration rules for stand-alone mode When starting in stand-alone mode, the APISIX node service will immediately load the routing rules from the conf/apisix.yaml file into memory (as described in the official documentation). In your command, the --config option is used to specify the conf/config.yaml file, but the node will still load the default conf/apisix.yaml file. This is the cause of the error. If you want to replace the default conf/apisix.yaml with your own apisix.yaml, you can mount it to the corresponding path. The complete docker-compose file is as follows:
version: '3.9' services: apisix: image: apache/apisix:3.9.1-debian environment: APISIX_STAND_ALONE: "true" ports: - '9080:9080' container_name: apache-apisix volumes: - ./apisix.yaml:/usr/local/apisix/conf/apisix.yaml:ro # - ./apisix.yaml:/mnt/config.yaml:ro restart: always # command: apisix start --config /mnt/config.yaml
Yeah i know that, but in the another option is i want to try out the custom path on standalone mode, by mean the configuration that has been set default to the conf/config.yaml should be working on custom path
In Apache APISIX, different configuration files serve different purposes. By default, there are three configuration files: conf/config.yaml, conf/apisix.yaml, and conf/debug.yaml. conf/config.yaml: This file is the global configuration file for Apache APISIX. It contains basic system configurations and key parameters such as port settings, log levels, ETCD configurations, plugin configurations, and more. conf/apisix.yaml: This file is mainly used to define runtime configurations for routes, services, upstreams, plugins, etc. Users can define various routing rules, services and their corresponding upstream servers, and enable or configure plugins for specific routes in this file. conf/debug.yaml: This file is used for configurations in debugging and development modes, usually to enable additional logging and debugging information. Relevant links: Introduction to APISIX configuration files Configuration rules for stand-alone mode When starting in stand-alone mode, the APISIX node service will immediately load the routing rules from the conf/apisix.yaml file into memory (as described in the official documentation). In your command, the --config option is used to specify the conf/config.yaml file, but the node will still load the default conf/apisix.yaml file. This is the cause of the error. If you want to replace the default conf/apisix.yaml with your own apisix.yaml, you can mount it to the corresponding path. The complete docker-compose file is as follows:
version: '3.9' services: apisix: image: apache/apisix:3.9.1-debian environment: APISIX_STAND_ALONE: "true" ports: - '9080:9080' container_name: apache-apisix volumes: - ./apisix.yaml:/usr/local/apisix/conf/apisix.yaml:ro # - ./apisix.yaml:/mnt/config.yaml:ro restart: always # command: apisix start --config /mnt/config.yaml
Yeah i know that, but in the another option is i want to try out the custom path on standalone mode, by mean the configuration that has been set default to the conf/config.yaml should be working on custom path
The --config option allows you to modify the default conf/config.yaml path, but you also need to provide conf/apisix.yaml for it to start correctly. Here is my complete example, which I hope will be helpful to you:
docker-compose.yaml
:
version: '3.9'
services:
apisix:
image: apache/apisix:3.9.1-debian
environment:
APISIX_STAND_ALONE: "true"
ports:
- '9080:9080'
container_name: apache-apisix
volumes:
- ./apisix.yaml:/usr/local/apisix/conf/apisix.yaml:ro
- ./config.yaml:/mnt/config.yaml:ro
restart: always
command: apisix start --config /mnt/config.yaml
apisix.yaml
:
routes:
-
uri: "/anything/*"
service_id: 1
methods: ["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"]
plugins:
proxy-rewrite:
regex_uri: ["^/anything/(.*)", "/$1"]
cors: {}
services:
-
id: 1
upstream_id: anything_upstream
upstreams:
-
id: "anything_upstream"
nodes:
"httpbin.org:80": 1
type: roundrobin
#END
config.yaml
:
deployment:
role: data_plane
role_data_plane:
config_provider: yaml
#END
Current Behavior
Currently i tried to custom apisix.yaml path into /mnt/apisix.yaml
my docker compose :
my apisix.yaml :
Expected Behavior
No response
Error Logs
Steps to Reproduce
Environment
apisix version
): 3.9.1-debian docker