Skip to content

Instantly share code, notes, and snippets.

@omervk
Last active May 31, 2021 11:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omervk/1bebf33379e0b2511490894a13c46f40 to your computer and use it in GitHub Desktop.
Save omervk/1bebf33379e0b2511490894a13c46f40 to your computer and use it in GitHub Desktop.
Debugging Lua inside Openresty inside Docker with IntelliJ IDEA - Blogpost Steps
env DEBUG_SOURCES_DIR;
RUN curl https://github.com/EmmyLua/EmmyLuaDebugger/archive/refs/tags/1.0.16.tar.gz \
-L -o EmmyLuaDebugger-1.0.16.tar.gz && \
tar -xzvf EmmyLuaDebugger-1.0.16.tar.gz && \
cd EmmyLuaDebugger-1.0.16 && \
mkdir -p build && \
cd build && \
cmake -DCMAKE_BUILD_TYPE=Release ../ && \
make install && \
mkdir -p /usr/local/emmy && \
cp install/bin/emmy_core.so /usr/local/emmy/ && \
cd .. && \
cd .. && \
rm -rf EmmyLuaDebugger-1.0.16 EmmyLuaDebugger-1.0.16.tar.gz
package.cpath = package.cpath .. ';/Users/omer_van_kloeten/Library/Application Support/JetBrains/IntelliJIdea2021.1/plugins/EmmyLua/classes/debugger/emmy/mac/?.dylib'
local dbg = require('emmy_core')
dbg.tcpListen('localhost', 9966)
dbg.waitIDE()
export DEBUG_SOURCES_DIR="/Users/omer_van_kloeten/my_project/src"
services:
nginx:
ports:
- "9966:9966"
lua_code_cache off;
RUN curl https://cmake.org/files/v3.7/cmake-3.7.2.tar.gz \
-o cmake-3.7.2.tar.gz && \
tar -xvzf cmake-3.7.2.tar.gz && \
cd cmake-3.7.2 && \
./configure && \
make && \
make install && \
cd .. && \
rm -rf cmake-3.7.2 cmake-3.7.2.tar.gz && \
update-alternatives --install /usr/bin/cmake cmake /usr/local/bin/cmake 1 --force
package.cpath = package.cpath .. ';/usr/local/emmy/?.so'
local dbg = require('emmy_core')
dbg.tcpListen('localhost', 9966)
dbg.waitIDE()
services:
nginx:
environment:
DEBUG_SOURCES_DIR:
_G.emmy = {}
_G.emmy.fixPath = function(path)
return string.gsub(path, '/etc/nginx/', ‘/Users/omer_van_kloeten/my_project/src/')
end
nginx:
volumes:
- "./src/lua:/etc/nginx/lua:ro"
local debug_sources_dir = os.getenv('DEBUG_SOURCES_DIR')
_G.emmy = {}
_G.emmy.fixPath = function(path)
return string.gsub(path, '/etc/nginx/', debug_sources_dir..'/')
end
@omervk
Copy link
Author

omervk commented May 31, 2021

These snippets are used in the Debugging Lua inside Openresty inside Docker with IntelliJ IDEA blogpost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment