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/cd6d3dc0add723c60143753edec8c760 to your computer and use it in GitHub Desktop.
Save omervk/cd6d3dc0add723c60143753edec8c760 to your computer and use it in GitHub Desktop.
Debugging Lua inside Openresty inside Docker with IntelliJ IDEA - Blogpost Summary
-- 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
export DEBUG_SOURCES_DIR="..."
# snip
services:
nginx:
# --- snip ---
ports:
- "9966:9966"
environment:
DEBUG_SOURCES_DIR:
# --- 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 ---
env DEBUG_SOURCES_DIR;
@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