Last active
May 31, 2021 11:03
-
-
Save omervk/cd6d3dc0add723c60143753edec8c760 to your computer and use it in GitHub Desktop.
Debugging Lua inside Openresty inside Docker with IntelliJ IDEA - Blogpost Summary
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- snip | |
-- Fix debugger paths | |
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 | |
-- Load debugger | |
package.cpath = package.cpath .. ';/usr/local/emmy/?.so' | |
local dbg = require('emmy_core') | |
dbg.tcpListen('localhost', 9966) | |
-- Wait for IDE connection | |
dbg.waitIDE() | |
-- snip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export DEBUG_SOURCES_DIR="..." | |
# snip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
nginx: | |
# --- snip --- | |
ports: | |
- "9966:9966" | |
environment: | |
DEBUG_SOURCES_DIR: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# --- snip --- | |
# Note: You might need to install CMake here as well, see the guide for how | |
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 | |
# --- snip --- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
env DEBUG_SOURCES_DIR; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
These snippets are used in the Debugging Lua inside Openresty inside Docker with IntelliJ IDEA blogpost.