Browse Source

Attempt to fix Lua hostname issues (#3481)

* docker lua

* fixed
Nate 7 years ago
parent
commit
3a21563d53

+ 3 - 9
frameworks/Lua/octopus/octopus.dockerfile

@@ -15,10 +15,6 @@ ADD ./ /octo
 RUN cp -avr app octopus/extensions
 RUN cp -avr app octopus/extensions
 RUN cp -vf config.lua octopus/extensions
 RUN cp -vf config.lua octopus/extensions
 
 
-RUN DBIP=`getent hosts tfb-database | awk '{ print $1 }'` sed -i "s|DBHOSTNAME|$DBIP|g" octopus/extensions/config.lua
-
-RUN cat octopus/extensions/config.lua
-
 WORKDIR /octo/octopus/bin/unix
 WORKDIR /octo/octopus/bin/unix
 
 
 RUN chmod +x *.sh
 RUN chmod +x *.sh
@@ -29,8 +25,6 @@ RUN sed -i 's|-c nginx.conf|-c nginx.conf -g "daemon off;"|g' server.sh
 RUN ./server.sh install
 RUN ./server.sh install
 RUN ./server.sh build
 RUN ./server.sh build
 
 
-RUN ls /octo
-RUN ls /octo/octopus
-RUN ls /octo/octopus/extensions
-
-CMD ./server.sh start
+CMD export DBIP=`getent hosts tfb-database | awk '{ print $1 }'` && \
+    sed -i "s|DBHOSTNAME|$DBIP|g" /octo/octopus/extensions/build/src/types.lua && \
+    ./server.sh start

+ 1 - 1
frameworks/Lua/openresty/app.lua

@@ -13,7 +13,7 @@ template.caching(false)
 local view = template.compile([[<!DOCTYPE html><html><head><title>Fortunes</title></head><body><table><tr><th>id</th><th>message</th></tr>{% for _,f in ipairs(fortunes) do %}<tr><td>{{ f.id }}</td><td>{{ f.message }}</td></tr>{% end %}</table></body></html>]], nil, true)
 local view = template.compile([[<!DOCTYPE html><html><head><title>Fortunes</title></head><body><table><tr><th>id</th><th>message</th></tr>{% for _,f in ipairs(fortunes) do %}<tr><td>{{ f.id }}</td><td>{{ f.message }}</td></tr>{% end %}</table></body></html>]], nil, true)
 
 
 local mysqlconn = {
 local mysqlconn = {
-	host = os.getenv("DBHOST"),
+	host = os.getenv("DBIP"),
 	port = 3306,
 	port = 3306,
 	database = "hello_world",
 	database = "hello_world",
 	user = "benchmarkdbuser",
 	user = "benchmarkdbuser",

+ 2 - 3
frameworks/Lua/openresty/openresty.dockerfile

@@ -5,8 +5,7 @@ ADD ./app.lua /openresty/
 
 
 WORKDIR /openresty
 WORKDIR /openresty
 
 
-RUN sed -i 's|DBHOSTNAME|'"${DBHOST}"'|g' app.lua
-
 RUN luarocks install lua-resty-template
 RUN luarocks install lua-resty-template
 
 
-CMD nginx -c /openresty/nginx.conf -g "worker_processes '"$(nproc)"';"
+CMD export DBIP=`getent hosts tfb-database | awk '{ print $1 }'` && \
+    nginx -c /openresty/nginx.conf -g "worker_processes '"$(nproc)"';"