mirror of
https://github.com/dokku/dokku.git
synced 2025-12-16 20:17:44 +01:00
feat: switch to null buildpack for performance
This commit is contained in:
1
tests/apps/python/.buildpacks
Normal file
1
tests/apps/python/.buildpacks
Normal file
@@ -0,0 +1 @@
|
|||||||
|
https://github.com/dokku/buildpack-null.git
|
||||||
5
tests/apps/python/CHECKS
Normal file
5
tests/apps/python/CHECKS
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
WAIT=2 # wait 2 seconds
|
||||||
|
TIMEOUT=5 # set timeout to 5 seconds
|
||||||
|
ATTEMPTS=2 # try 2 times
|
||||||
|
|
||||||
|
/ python/http.server
|
||||||
54
tests/apps/python/Procfile
Normal file
54
tests/apps/python/Procfile
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
###############################
|
||||||
|
# DEVELOPMENT #
|
||||||
|
###############################
|
||||||
|
|
||||||
|
# Procfile for development using the new threaded worker (scheduler, twitter stream and delayed job)
|
||||||
|
cron: python3 worker.py
|
||||||
|
web: python3 web.py # testing inline comment
|
||||||
|
worker: python3 worker.py
|
||||||
|
custom: echo -n
|
||||||
|
release: touch /app/release.test
|
||||||
|
|
||||||
|
|
||||||
|
# Old version with separate processes (use this if you have issues with the threaded version)
|
||||||
|
# web: bundle exec rails server
|
||||||
|
# schedule: bundle exec rails runner bin/schedule.rb
|
||||||
|
# twitter: bundle exec rails runner bin/twitter_stream.rb
|
||||||
|
# dj: bundle exec script/delayed_job run
|
||||||
|
|
||||||
|
###############################
|
||||||
|
# PRODUCTION #
|
||||||
|
###############################
|
||||||
|
|
||||||
|
# You need to copy or link config/unicorn.rb.example to config/unicorn.rb for both production versions.
|
||||||
|
# Have a look at the deployment guides, if you want to set up huginn on your server:
|
||||||
|
# https://github.com/cantino/huginn/doc
|
||||||
|
|
||||||
|
# Using the threaded worker (consumes less RAM but can run slower)
|
||||||
|
# web: bundle exec unicorn -c config/unicorn.rb
|
||||||
|
# jobs: bundle exec rails runner bin/threaded.rb
|
||||||
|
|
||||||
|
# Old version with separate processes (use this if you have issues with the threaded version)
|
||||||
|
# web: bundle exec unicorn -c config/unicorn.rb
|
||||||
|
# schedule: bundle exec rails runner bin/schedule.rb
|
||||||
|
# twitter: bundle exec rails runner bin/twitter_stream.rb
|
||||||
|
# dj: bundle exec script/delayed_job run
|
||||||
|
|
||||||
|
###############################
|
||||||
|
# Multiple DelayedJob workers #
|
||||||
|
###############################
|
||||||
|
# Per default Huginn can just run one agent at a time. Using a lot of agents or calling slow
|
||||||
|
# external services frequently might require more DelayedJob workers (an indicator for this is
|
||||||
|
# a backlog in your 'Job Management' page).
|
||||||
|
# Every uncommented line starts an additional DelayedJob worker. This works for development, production
|
||||||
|
# and for the threaded and separate worker processes. Keep in mind one worker needs about 300MB of RAM.
|
||||||
|
#
|
||||||
|
#dj2: bundle exec script/delayed_job -i 2 run
|
||||||
|
#dj3: bundle exec script/delayed_job -i 3 run
|
||||||
|
#dj4: bundle exec script/delayed_job -i 4 run
|
||||||
|
#dj5: bundle exec script/delayed_job -i 5 run
|
||||||
|
#dj6: bundle exec script/delayed_job -i 6 run
|
||||||
|
#dj7: bundle exec script/delayed_job -i 7 run
|
||||||
|
#dj8: bundle exec script/delayed_job -i 8 run
|
||||||
|
#dj9: bundle exec script/delayed_job -i 9 run
|
||||||
|
#dj10: bundle exec script/delayed_job -i 10 run
|
||||||
8
tests/apps/python/app.json
Normal file
8
tests/apps/python/app.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"scripts": {
|
||||||
|
"dokku": {
|
||||||
|
"predeploy": "touch /app/predeploy.test",
|
||||||
|
"postdeploy": "touch /app/postdeploy.test"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
5
tests/apps/python/check_deploy
Normal file
5
tests/apps/python/check_deploy
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
output="$(curl -s -S "$1")"
|
||||||
|
echo "$output"
|
||||||
|
test "$output" == "python/http.server"
|
||||||
0
tests/apps/python/null
Normal file
0
tests/apps/python/null
Normal file
17
tests/apps/python/web.py
Normal file
17
tests/apps/python/web.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import http.server
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
class GetHandler(http.server.BaseHTTPRequestHandler):
|
||||||
|
def do_GET(self):
|
||||||
|
self.send_response(200)
|
||||||
|
self.send_header("Content-Type", "text/plain; charset=utf-8")
|
||||||
|
self.end_headers()
|
||||||
|
self.wfile.write("python/http.server".encode("utf-8"))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
port = int(os.getenv("PORT", 5000))
|
||||||
|
server = http.server.HTTPServer(("0.0.0.0", port), GetHandler)
|
||||||
|
print("Listening on port {0}".format(port))
|
||||||
|
server.serve_forever()
|
||||||
11
tests/apps/python/worker.py
Normal file
11
tests/apps/python/worker.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import time
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
print("sleeping for 60 seconds")
|
||||||
|
while True:
|
||||||
|
time.sleep(60)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -263,7 +263,7 @@ assert_urls() {
|
|||||||
|
|
||||||
deploy_app() {
|
deploy_app() {
|
||||||
declare APP_TYPE="$1" GIT_REMOTE="$2" CUSTOM_TEMPLATE="$3" CUSTOM_PATH="$4"
|
declare APP_TYPE="$1" GIT_REMOTE="$2" CUSTOM_TEMPLATE="$3" CUSTOM_PATH="$4"
|
||||||
local APP_TYPE=${APP_TYPE:="nodejs-express"}
|
local APP_TYPE=${APP_TYPE:="python"}
|
||||||
local GIT_REMOTE=${GIT_REMOTE:="dokku@dokku.me:$TEST_APP"}
|
local GIT_REMOTE=${GIT_REMOTE:="dokku@dokku.me:$TEST_APP"}
|
||||||
local GIT_REMOTE_BRANCH=${GIT_REMOTE_BRANCH:="master"}
|
local GIT_REMOTE_BRANCH=${GIT_REMOTE_BRANCH:="master"}
|
||||||
local TMP=${CUSTOM_TMP:=$(mktemp -d "/tmp/dokku.me.XXXXX")}
|
local TMP=${CUSTOM_TMP:=$(mktemp -d "/tmp/dokku.me.XXXXX")}
|
||||||
|
|||||||
Reference in New Issue
Block a user