GithubHelp home page GithubHelp logo

syhily / docker-orange Goto Github PK

View Code? Open in Web Editor NEW
42.0 4.0 29.0 37 KB

Docker distribution for Orange.

Home Page: http://orange.sumory.com

License: MIT License

Shell 90.73% Makefile 9.27%
orange docker-compose openresty

docker-orange's Introduction

Orange in Docker

This is an unofficial Docker image for Orange distribution.

What is Orange?

API Gateway based on OpenResty.

How to use this image

First, orange requires a running mysql cluster before it starts. You can either use the official MySQL containers, or use your own.

Using docker-compose (Recommend)

  • start a Orange container + its dependencies (mysql)
$ docker-compose run --service-ports --rm orange
# or
$ make run

Run in debug mode (bash) :

$ make debug-run

Common used commands

  1. docker-compose up Bootstrap a brand new alert service container. if a old container exists, docker compose would reuse it in case of losing data.
  2. docker-compose down Destroy all the containers defined in this compose file.
  3. docker-compose start Start the existed containers.
  4. docker-compose stop Stop the existed containers.
  5. docker-compose restart Restart the existed containers, the new configuration would be applied immediately.
  6. docker-compose run -d --service-ports --rm orange Almost the same with docker-compose up.

Start orange step by step

  • Run a MySQL container
docker run --name orange-database -e MYSQL_ROOT_PASSWORD=your_root_pwd -e MYSQL_DATABASE=orange -p 3306:3306 mysql:5.7

This is not only way to get a runing mysql for orange, but for some dns issue, running a docker-mysql could simplify the process of running a orange instance.

  • Runing a orange instance and initialize database scheme.

Modify the {block} content, and execute it.

ORANGE_INIT_DB variable would be deployment friendly on production.

docker run -d --name orange \
    --link orange-database:orange-database \
    -p 7777:7777 \
    -p 8888:80 \
    -p 9999:9999 \
    --security-opt seccomp:unconfined \
    -e ORANGE_DATABASE={your_database_name} \
    -e ORANGE_HOST=orange-database \
    -e ORANGE_PORT={your_database_port} \
    -e ORANGE_USER={your_database_user} \
    -e ORANGE_PWD={your_database_password} \
    syhily/orange

Access orange dashboard (Default Username: admin, Default Password: orange_admin)

Relative Link's

  1. Orange Dashboard
  2. Orange API Endpoint
  3. Orange Gateway Access Endpoint

Operation Your Orange

docker exec -it orange orange COMMAND [OPTIONS]

The commands are:

start   Start the Orange Gateway
stop    Stop current Orange
reload  Reload the config of Orange
restart Restart Orange
version Show the version of Orange
help    Show help tips

User Feedback

Issues

If you have any problems with or questions about this image, please contact us through a GitHub issue.

Contributing

You are invited to contribute new features, fixes, or updates, large or small; we are always thrilled to receive pull requests, and do our best to process them as fast as we can.

Before you start to code, we recommend discussing your plans through a GitHub issue, especially for more ambitious contributions. This gives other contributors a chance to point you in the right direction, give you feedback on your design, and help you find out if someone else is working on the same thing.

docker-orange's People

Contributors

sumory avatar syhily avatar zorrofox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

docker-orange's Issues

无法开启 Dashboard 的访问认证

在 docker-entrypoint.sh 里增加了:

if [[ "X${ORANGE_AUTH}" != "X" ]]; then
sed -i "s/"auth": false/"auth": "${ORANGE_AUTH}"/g" ${ORANGE_CONF}
fi

并且 run 的时候增加参数

-e ORANGE_AUTH=true

但是认证并没有生效,还是可以直接访问到 Dashboard。

在容器内查看配置文件是启用了auth的。

使用docker-compose 无法解析 db host

logs

2019/08/06 10:27:25 [error] 48#48: *11 [lua] mysql_db.lua:30: query(): failed to connect: failed to connect: orange-database could not be resolved (3: Host not found): nil nil, client: 192.168.48.1, server: , request: "POST /monitor/enable HTTP/1.1", host: "127.0.0.1:8889", referrer: "http://127.0.0.1:8889/monitor"
2019/08/06 10:27:25 [error] 48#48: *11 [lua] mysql_store.lua:91: update_enable(): MySQLStore:update error:nil, client: 192.168.48.1, server: , request: "POST /monitor/enable HTTP/1.1", host: "127.0.0.1:8889", referrer: "http://127.0.0.1:8889/monitor"
2019/08/06 10:27:27 [info] 49#49: *12 client closed connection while waiting for request, client: 192.168.48.1, server: 0.0.0.0:9999

进入容器能都ping telnet 也是ok的 容器的mysql 也是可以访问的

Dockerfile Build failed

Step 17 : RUN nginx -V && lord version
---> Running in e5a78b7bbcba
nginx version: openresty/1.11.2.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-4) (GCC)
built with OpenSSL 1.0.2j 26 Sep 2016
TLS SNI support enabled
configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt=-O2 --add-module=../ngx_devel_kit-0.3.0 --add-module=../echo-nginx-module-0.60 --add-module=../xss-nginx-module-0.05 --add-module=../ngx_coolkit-0.2rc3 --add-module=../set-misc-nginx-module-0.31 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.06 --add-module=../srcache-nginx-module-0.31 --add-module=../ngx_lua-0.10.6 --add-module=../ngx_lua_upstream-0.06 --add-module=../headers-more-nginx-module-0.31 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.17 --add-module=../redis2-nginx-module-0.13 --add-module=../redis-nginx-module-0.3.7 --add-module=../rds-json-nginx-module-0.14 --add-module=../rds-csv-nginx-module-0.07 --with-ld-opt=-Wl,-rpath,/usr/local/openresty/luajit/lib --with-openssl=/tmp/openssl-1.0.2j --with-pcre=/tmp/pcre-8.39 --with-file-aio --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_xslt_module=dynamic --with-ipv6 --with-mail --with-mail_ssl_module --with-md5-asm --with-pcre-jit --with-sha1-asm --with-stream --with-stream_ssl_module --with-threads
/usr/bin/env: resty: No such file or directory
The command '/bin/sh -c nginx -V && lord version' returned a non-zero code: 127

尝试使用镜像在kubernetes里部署在控制面板上插件报错failed to enable plugin

查看日志
2018/05/03 11:21:28 [error] 40#40: *5 [lua] mysql_db.lua:30: query(): failed to connect: failed to connect: mysql could not be resolved (3: Host not found): nil nil, context: ngx.timer
2018/05/03 11:21:28 [error] 40#40: *5 [lua] dao.lua:386: init_selectors_of_plugin(): the size of selectors from storage is 0 when initializing plugin[divide] local selectors, context: ngx.timer
2018/05/03 11:21:28 [error] 40#40: *5 [lua] dao.lua:521: load data of plugin[divide] success, context: ngx.timer
2018/05/03 11:21:28 [error] 40#40: *5 [lua] mysql_db.lua:30: query(): failed to connect: failed to connect: mysql could not be resolved (3: Host not found): nil nil, context: ngx.timer
2018/05/03 11:21:28 [error] 40#40: *5 [lua] dao.lua:511: load data of plugin[kvstore] success, context: ngx.timer
请问这个是什么原因呢?
容器运行日志是没问题的

Check database connection
Connection closed by foreign host.
Connected
Database connected
[INFO] Orange: 0.6.4
[INFO] ngx_lua: 10008
[INFO] nginx: 1011002
[INFO] Lua: LuaJIT 2.1.0-beta2
[INFO] Orange store operation start:
[INFO] args:
[INFO] store_type:mysql
[INFO] port:3306
[INFO] host:10.97.167.48
[INFO] operation:init
[INFO] pwd:123456
[INFO] user:root
[INFO] db:orange
[INFO] file:/usr/local/orange/install/orange-v0.6.4.sql
[INFO] args end.
[INFO] Store init finished.

使用docker-compose时,lua无法解析mysql-host

compose.yml内容如下:

version: '2'
services:
db:
    image: mysql
    expose:
      - "3306"
    environment:
      - MYSQL_ROOT_PASSWORD=docker
    privileged: true

gateway:
    image: syhily/docker-orange
    ports:
      - "27777:7777"
      - "28888:8888"
      - "29999:9999"
    security_opt:
      - seccomp:unconfined
    environment:
      - ORANGE_DATABASE=orange
      - ORANGE_HOST=orange-database
      - ORANGE_PORT=3306
      - ORANGE_USER=root
      - ORANGE_PWD=docker
    depends_on:
      - db
    links:
      - db:orange-database
    privileged: true

启动后,ping orange-database可以访问,但使用控制台操作数据库相关,报错[error] 26#26: *7 [lua] mysql_db.lua:30: query(): failed to connect: failed to connect: orange-database could not be resolved (3: Host not found): nil nil, client: 172.22.0.1, server: , request: "POST /redirect/enable HTTP/1.1", host: "127.0.0.1:29999", referrer: "http://127.0.0.1:29999/redirect"

这要怎么处理呢?使用docker run的命令是OK的。

Support docker-compose

Changes:

  • No need to manually import orange sql dump
  • Add a docker-compose.yml to simplify the usage.

Is there too many layers of creating docker?

Why not combained these commands into 1 or 2 ?
Even "nginx -V" RUN indepently...
If we combained and reduce neccessary cmds, it will reduce layers, and left more layers to users

1) Add User

2) Add configuration file & bootstrap file

3) Fix file permission

RUN
useradd www
&& echo "www:www" | chpasswd
&& echo "www ALL=(ALL) ALL" >> /etc/sudoers

RUN
mkdir -p ${ORANGE_PATH}/logs
&& chown -R www:www ${ORANGE_PATH}/*

Show installization info for debug

RUN
nginx -V

Set the default command to execute

when creating a new container

ADD docker-entrypoint.sh docker-entrypoint.sh
RUN
chmod 755 docker-entrypoint.sh
COPY docker-entrypoint.sh /usr/local/bin

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.