You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/09/08 05:05:43 UTC

[GitHub] [apisix-docker] soulbird opened a new pull request, #350: feat: support enable stand-alone mode by env var

soulbird opened a new pull request, #350:
URL: https://github.com/apache/apisix-docker/pull/350

   1、Add `docker-entrypoint.sh` file to make Dockerfile more spec-compliant.
   
   2、Support for enabling stand-alone mode via environment variables:
   ```shell
   docker run --name apache/apisix -e APISIX_STAND_ALONE=true apache/apisix
   ````
   The above command will create a default apisix.yaml file with a default route:
   ```shell
   routes:
      -
        id: 1
        uri: /*
        upstream:
          nodes:
            "httpbin.org:80": 1
          type: roundrobin
   ````
   If you want to add a new route, you can use this command:
   ```shell
   docker exec -i apisix-test sh -c "cat > /usr/local/apisix/conf/apisix.yaml <<_EOC_
   routes:
      -
        id: status
        uri: /status
        plugins:
          fault-injection:
            abort:
              http_status: 200
              body: fine
      -
        id: anything
        uri: /anything
        upstream:
          nodes:
            \"httpbin.org:80\": 1
          type: roundrobin
   #END
   _EOC_"
   ````


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-docker] spacewander commented on a diff in pull request #350: feat: support enable stand-alone mode by env var

Posted by GitBox <gi...@apache.org>.
spacewander commented on code in PR #350:
URL: https://github.com/apache/apisix-docker/pull/350#discussion_r966560893


##########
README.md:
##########
@@ -15,40 +15,23 @@ Apache APISIX supports stand-alone mode and also supports the use of etcd databa
 
 In stand-alone mode, APISIX uses `apisix.yaml` as the configuration center to store routing, upstream, consumer and other information. After APISIX is started, it will load the `apisix.yaml` file regularly to update the corresponding configuration information.
 
-The following command creates a configuration file for APISIX, and enables stand-alone mode.
-
-1. Create a APISIX configuration file in the current directory and use this file in the next step.
-
-```
-$ cat << EOF > $(pwd)/config.yaml
-apisix:
-  enable_admin: false
-  config_center: yaml
-EOF
-```
-
-2. Start APISIX.
+You can start an APISIX container with stand-alone mode by the following command:
 
 ```
-$ docker run -d \
-   --name apache-apisix \
-   -p 9080:9080 \
-   -v $(pwd)/config.yaml:/usr/local/apisix/conf/config.yaml \
-   apache/apisix
+$ docker run -d --name apache-apisix -p 9080:9080 -e APISIX_STAND_ALONE=true apache/apisix
 ```
 
-#### Modify stand-alone mode configuration file
-
-After completing the above steps, you can refer to the following example to write the Route and Plugin configuration to the `apisix.yaml` file.
+Add Route and Plugin configuration to the running APISIX container:
 
 ```
-$ cat << EOF > apisix.yaml
+$ docker exec -i apache-apisix sh -c "cat > /usr/local/apisix/conf/apisix.yaml <<_EOC_

Review Comment:
   ```suggestion
   $ docker exec -i apache-apisix sh -c 'cat > /usr/local/apisix/conf/apisix.yaml <<_EOC_
   ```
   so we don't need to escape the '"' in the example



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-docker] spacewander commented on pull request #350: feat: support enable stand-alone mode by env var

Posted by GitBox <gi...@apache.org>.
spacewander commented on PR #350:
URL: https://github.com/apache/apisix-docker/pull/350#issuecomment-1240250163

   > COPY failed: file not found in build context or excluded by .dockerignore: stat docker-entrypoint.sh: file does not exist
   
   https://github.com/apache/apisix-docker/runs/8242268910?check_suite_focus=true
   
   Please make the CI pass, thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-docker] tao12345666333 commented on a diff in pull request #350: feat: support enable stand-alone mode by env var

Posted by GitBox <gi...@apache.org>.
tao12345666333 commented on code in PR #350:
URL: https://github.com/apache/apisix-docker/pull/350#discussion_r965620463


##########
debian/docker-entrypoint.sh:
##########
@@ -0,0 +1,51 @@
+#!/usr/bin/env bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+set -Eeo pipefail

Review Comment:
   I don't think we need `-E` 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-docker] hf400159 commented on a diff in pull request #350: feat: support enable stand-alone mode by env var

Posted by GitBox <gi...@apache.org>.
hf400159 commented on code in PR #350:
URL: https://github.com/apache/apisix-docker/pull/350#discussion_r965714633


##########
README.md:
##########
@@ -15,40 +15,23 @@ Apache APISIX supports stand-alone mode and also supports the use of etcd databa
 
 In stand-alone mode, APISIX uses `apisix.yaml` as the configuration center to store routing, upstream, consumer and other information. After APISIX is started, it will load the `apisix.yaml` file regularly to update the corresponding configuration information.
 
-The following command creates a configuration file for APISIX, and enables stand-alone mode.
-
-1. Create a APISIX configuration file in the current directory and use this file in the next step.
-
-```
-$ cat << EOF > $(pwd)/config.yaml
-apisix:
-  enable_admin: false
-  config_center: yaml
-EOF
-```
-
-2. Start APISIX.
+You can start an APISIX container with stand-alone mode by the following command:
 
 ```
-$ docker run -d \
-   --name apache-apisix \
-   -p 9080:9080 \
-   -v $(pwd)/config.yaml:/usr/local/apisix/conf/config.yaml \
-   apache/apisix
+docker run -d --name apache-apisix -p 9080:9080 -e APISIX_STAND_ALONE=true apache/apisix

Review Comment:
   ```suggestion
   $ docker run -d --name apache-apisix -p 9080:9080 -e APISIX_STAND_ALONE=true apache/apisix
   ```



##########
README.md:
##########
@@ -15,40 +15,23 @@ Apache APISIX supports stand-alone mode and also supports the use of etcd databa
 
 In stand-alone mode, APISIX uses `apisix.yaml` as the configuration center to store routing, upstream, consumer and other information. After APISIX is started, it will load the `apisix.yaml` file regularly to update the corresponding configuration information.
 
-The following command creates a configuration file for APISIX, and enables stand-alone mode.
-
-1. Create a APISIX configuration file in the current directory and use this file in the next step.
-
-```
-$ cat << EOF > $(pwd)/config.yaml
-apisix:
-  enable_admin: false
-  config_center: yaml
-EOF
-```
-
-2. Start APISIX.
+You can start an APISIX container with stand-alone mode by the following command:
 
 ```
-$ docker run -d \
-   --name apache-apisix \
-   -p 9080:9080 \
-   -v $(pwd)/config.yaml:/usr/local/apisix/conf/config.yaml \
-   apache/apisix
+docker run -d --name apache-apisix -p 9080:9080 -e APISIX_STAND_ALONE=true apache/apisix
 ```
 
-#### Modify stand-alone mode configuration file
-
-After completing the above steps, you can refer to the following example to write the Route and Plugin configuration to the `apisix.yaml` file.
+Add Route and Plugin configuration to the running APISIX container:
 
 ```
-$ cat << EOF > apisix.yaml
+docker exec -i apisix-test sh -c "cat > /usr/local/apisix/conf/apisix.yaml <<_EOC_

Review Comment:
   ```suggestion
   $ docker exec -i apisix-test sh -c "cat > /usr/local/apisix/conf/apisix.yaml <<_EOC_
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-docker] spacewander merged pull request #350: feat: support enable stand-alone mode by env var

Posted by GitBox <gi...@apache.org>.
spacewander merged PR #350:
URL: https://github.com/apache/apisix-docker/pull/350


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org