GithubHelp home page GithubHelp logo

Comments (14)

agentzh avatar agentzh commented on August 17, 2024 1

Hello!

On Mon, Nov 12, 2012 at 11:37 AM, Jose Diaz-Gonzalez
[email protected] wrote:

Ah that makes sense. So how do I "install" it and reference from within my nginx configuration?

If you're using the ngx_openresty bundle (http://openresty.org ), then
you don't need to do anything because it includes and enables
lua-resty-redis by default. And you can just use it in your Lua code,
as in

local redis = require "resty.redis"
...

If you're using your own nginx + ngx_lua build, then just configure
the lua_package_path directive to add the path of your lua-resty-redis
install visible to ngx_lua's LUA_PATH search path, as in

# nginx.conf
http {
    lua_package_path "/path/to/lua-resty-redis/lib/?.lua;;";
    ...
}

Best regards,
-agentzh

from lua-resty-redis.

josegonzalez avatar josegonzalez commented on August 17, 2024

For reference, the error is as follows:

jose@mactaku-3:~/Sites/seatgeek  $ brew install ./nginx-custom.rb --add-github-module=simpl/ngx_devel_kit --add-github-module=chaoslawful/lua-nginx-module --add-github-module=agentzh/lua-resty-redis
==> Downloading http://nginx.org/download/nginx-1.2.4.tar.gz
Already downloaded: /Library/Caches/Homebrew/nginx-custom-1.2.4.tar.gz
==> Patching
patching file conf/nginx.conf
adding extra modules
- adding simpl from github...
- adding chaoslawful from github...
- adding agentzh from github...
==> ./configure --prefix=/usr/local/Cellar/nginx-custom/1.2.4 --with-http_ssl_module --with-pcre --with-ipv6 --with-cc-opt=-I/usr/local/include --with-ld-opt=-L/usr/local/lib --conf-path=/usr/local/etc/nginx/nginx.conf --pid-path=/usr/local/var/run/nginx.pid --lock-path=/
checking for Lua library ... found
checking for export symbols by default ... not found
 + ngx_http_lua_module was configured
adding module in /private/tmp/nginx-custom-Ai9a/nginx-1.2.4/modules/agentzh/lua-resty-redis
./configure: error: no /private/tmp/nginx-custom-Ai9a/nginx-1.2.4/modules/agentzh/lua-resty-redis/config was found

from lua-resty-redis.

agentzh avatar agentzh commented on August 17, 2024

Hello!

On Mon, Nov 12, 2012 at 11:17 AM, Jose Diaz-Gonzalez
[email protected] wrote:

This file is necessary to install lua-resty-redis into a custom nginx compilation. Is it available somewhere, or is this meant to be part of another module somehow?

lua-resty-redis is not an Nginx C module. It is a pure Lua library
that can be directly required from within your Lua code running via
the ngx_lua module.

Best regards,
-agentzh

from lua-resty-redis.

josegonzalez avatar josegonzalez commented on August 17, 2024

Ah that makes sense. So how do I "install" it and reference from within my nginx configuration?

from lua-resty-redis.

josegonzalez avatar josegonzalez commented on August 17, 2024

After I include the lua_package in it's path, I can use it as in your openresty example?

from lua-resty-redis.

agentzh avatar agentzh commented on August 17, 2024

Hello!

On Mon, Nov 12, 2012 at 12:05 PM, Jose Diaz-Gonzalez
[email protected] wrote:

After I include the lua_package in it's path, I can use it as in your openresty example?

Which example?

-agentzh

from lua-resty-redis.

josegonzalez avatar josegonzalez commented on August 17, 2024

Something like:

    http {
        lua_package_path "/path/to/lua-resty-redis/lib/?.lua;;";
        local redis = require "resty.redis"
        ...
    }

from lua-resty-redis.

agentzh avatar agentzh commented on August 17, 2024

Hello!

On Mon, Nov 12, 2012 at 12:16 PM, Jose Diaz-Gonzalez
[email protected] wrote:

Something like:

http {
    lua_package_path "/path/to/lua-resty-redis/lib/?.lua;;";
    local redis = require "resty.redis"
    ...
}

Your nginx.conf syntax is not exactly right.

Look at the code sample in lua-resty-redis's README file:

https://github.com/agentzh/lua-resty-redis#synopsis

Best regards,
-agentzh

from lua-resty-redis.

josegonzalez avatar josegonzalez commented on August 17, 2024

So something like:

server {
    lua_package_path "/path/to/lua-resty-redis/lib/?.lua;;";

    location /test {
        content_by_lua '
            local redis = require "resty.redis"
            ...
        '
    }
}

?

from lua-resty-redis.

agentzh avatar agentzh commented on August 17, 2024

Hello!

On Mon, Nov 12, 2012 at 12:23 PM, Jose Diaz-Gonzalez
[email protected] wrote:

So something like:

server {
lua_package_path "/path/to/lua-resty-redis/lib/?.lua;;";

location /test {
    content_by_lua '
        local redis = require "resty.redis"
        ...
    '
}

}

?

Try it and see what it says :) When in doubt, just try out the
openresty bundle instead to save your time.

Regards,
-agentzh

from lua-resty-redis.

josegonzalez avatar josegonzalez commented on August 17, 2024

Heh, will do. I mostly need a custom package - without some openresty stuff, and with other things - so just trying openresty won't solve all my problems.

Thanks for the advice, I'll let you know how it went and open a PR for this soon!

from lua-resty-redis.

agentzh avatar agentzh commented on August 17, 2024

Hello!

On Mon, Nov 12, 2012 at 8:11 PM, Jose Diaz-Gonzalez
[email protected] wrote:

Heh, will do. I mostly need a custom package - without some openresty stuff, and with other things - so just trying openresty won't solve all my problems.

I don't get it here. The openresty package is fully customizable. You
can disable things and add things, just with the standard nginx
distribution.

You can find all the options available with its ./configure script by
passing the --help option.

Regards,
-agentzh

from lua-resty-redis.

Mahanteshambi avatar Mahanteshambi commented on August 17, 2024

Hey @agentzh : I am using openresty to configure nginx to communicate to redis sentinels. But I am unable to connect to them as it says "no field package ['resty.redis.connector']" . Can you suggest a solution for connecting nginx with redis sentinels ?

from lua-resty-redis.

agentzh avatar agentzh commented on August 17, 2024

@Mahanteshambi Please do not hijack unrelated issues like this. It's annoying. Your questions should post to the openresty-en mailing list instead. See http://openresty.org/en/community.html

from lua-resty-redis.

Related Issues (20)

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.