Skip to content

Instantly share code, notes, and snippets.

@kn666
Forked from rybakit/jobserver.lua
Created April 20, 2018 19:21
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 kn666/9d99248e410ec593131b7f809ec3f14f to your computer and use it in GitHub Desktop.
Save kn666/9d99248e410ec593131b7f809ec3f14f to your computer and use it in GitHub Desktop.
tarantool/queue config example
queue = require('queue')
local function start(config)
box.once('jobserver:v0.1.0', function()
local tube = queue.create_tube('default', 'fifottl', {if_not_exists = true})
end)
end
local function stop()
end
return {
start = start,
stop = stop
}
local os = require('os')
return {
user = os.getenv('TARANTOOL_USER_NAME'),
password = os.getenv('TARANTOOL_USER_PASSWORD')
}
#!/usr/bin/env tarantool
box.cfg {
listen = 3301,
log_level = 5
}
if jobserver ~= nil then
-- hot code reload using tarantoolctl or dofile()
-- unload old application
jobserver.stop()
-- clear cache for loaded modules and dependencies
package.loaded['jobserver'] = nil
end
local config = require('jobserver_config')
-- ensure a user exists
if not box.schema.user.exists(config.user) then
box.schema.user.create(config.user, {password = config.password})
box.schema.user.grant(config.user, 'read,write,execute', 'universe', nil)
end
-- load a new version of app and all dependencies
jobserver = require('jobserver')
jobserver.start(config)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment