commit
33eca3bf39
20 files changed
+180
-165
No files matched your search
@@ -0,0 +1,6 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
insert_final_newline = true
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
+97
-97
@@ -3,120 +3,120 @@ require "sinatra"
|
|||||||
require "open3"
|
require "open3"
|
||||||
|
|
||||||
if ARGV[0] == "onboot"
|
if ARGV[0] == "onboot"
|
||||||
File.open("/etc/init/dokku-installer.conf", "w") do |f|
|
File.open("/etc/init/dokku-installer.conf", "w") do |f|
|
||||||
f.puts "start on runlevel [2345]"
|
f.puts "start on runlevel [2345]"
|
||||||
f.puts "exec #{File.absolute_path(__FILE__)} selfdestruct"
|
f.puts "exec #{File.absolute_path(__FILE__)} selfdestruct"
|
||||||
end
|
end
|
||||||
File.open("/etc/nginx/conf.d/dokku-installer.conf", "w") do |f|
|
File.open("/etc/nginx/conf.d/dokku-installer.conf", "w") do |f|
|
||||||
f.puts "upstream dokku-installer { server 127.0.0.1:2000; }"
|
f.puts "upstream dokku-installer { server 127.0.0.1:2000; }"
|
||||||
f.puts "server {"
|
f.puts "server {"
|
||||||
f.puts " listen 80;"
|
f.puts " listen 80;"
|
||||||
f.puts " location / {"
|
f.puts " location / {"
|
||||||
f.puts " proxy_pass http://dokku-installer;"
|
f.puts " proxy_pass http://dokku-installer;"
|
||||||
f.puts " }"
|
f.puts " }"
|
||||||
f.puts "}"
|
f.puts "}"
|
||||||
end
|
end
|
||||||
`rm /etc/nginx/sites-enabled/*`
|
`rm /etc/nginx/sites-enabled/*`
|
||||||
puts "Installed Upstart service and default Nginx virtualhost for installer to run on boot."
|
puts "Installed Upstart service and default Nginx virtualhost for installer to run on boot."
|
||||||
exit
|
exit
|
||||||
end
|
end
|
||||||
|
|
||||||
version = "v0.2.1"
|
version = "v0.3.0"
|
||||||
dokku_root = ENV["DOKKU_ROOT"] || "/home/dokku"
|
dokku_root = ENV["DOKKU_ROOT"] || "/home/dokku"
|
||||||
admin_key = `cat /root/.ssh/authorized_keys`.split("\n").first
|
admin_key = `cat /root/.ssh/authorized_keys`.split("\n").first
|
||||||
hostname = `bash -c '[[ $(dig +short $HOSTNAME) ]] && echo $HOSTNAME || curl icanhazip.com'`.strip
|
hostname = `bash -c '[[ $(dig +short $HOSTNAME) ]] && echo $HOSTNAME || curl icanhazip.com'`.strip
|
||||||
template = DATA.read
|
template = DATA.read
|
||||||
|
|
||||||
set :port, 2000
|
set :port, 2000
|
||||||
set :environment, :production
|
set :environment, :production
|
||||||
disable :protection
|
disable :protection
|
||||||
|
|
||||||
get "/" do
|
get "/" do
|
||||||
ERB.new(template).result binding
|
ERB.new(template).result binding
|
||||||
end
|
end
|
||||||
|
|
||||||
post "/setup" do
|
post "/setup" do
|
||||||
if params[:vhost] == "true"
|
if params[:vhost] == "true"
|
||||||
File.open("#{dokku_root}/VHOST", "w") {|f| f.write params[:hostname] }
|
File.open("#{dokku_root}/VHOST", "w") {|f| f.write params[:hostname] }
|
||||||
else
|
else
|
||||||
`rm #{dokku_root}/VHOST`
|
`rm #{dokku_root}/VHOST`
|
||||||
end
|
end
|
||||||
File.open("#{dokku_root}/HOSTNAME", "w") {|f| f.write params[:hostname] }
|
File.open("#{dokku_root}/HOSTNAME", "w") {|f| f.write params[:hostname] }
|
||||||
Open3.capture2("sshcommand acl-add dokku admin", :stdin_data => params[:key])
|
Open3.capture2("sshcommand acl-add dokku admin", :stdin_data => params[:key])
|
||||||
Thread.new {
|
Thread.new {
|
||||||
`rm /etc/nginx/conf.d/dokku-installer.conf && /etc/init.d/nginx stop && /etc/init.d/nginx start`
|
`rm /etc/nginx/conf.d/dokku-installer.conf && /etc/init.d/nginx stop && /etc/init.d/nginx start`
|
||||||
`rm /etc/init/dokku-installer.conf && stop dokku-installer`
|
`rm /etc/init/dokku-installer.conf && stop dokku-installer`
|
||||||
}.run if ARGV[0] == "selfdestruct"
|
}.run if ARGV[0] == "selfdestruct"
|
||||||
end
|
end
|
||||||
|
|
||||||
__END__
|
__END__
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Dokku Setup</title>
|
<title>Dokku Setup</title>
|
||||||
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" />
|
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" />
|
||||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="container" style="width: 640px;">
|
<div class="container" style="width: 640px;">
|
||||||
<form id="form" role="form">
|
<form id="form" role="form">
|
||||||
<h1>Dokku Setup <small><%= version %></small></h1>
|
<h1>Dokku Setup <small><%= version %></small></h1>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<h3><small style="text-transform: uppercase;">Admin Access</small></h3>
|
<h3><small style="text-transform: uppercase;">Admin Access</small></h3>
|
||||||
<label for="key">Public Key</label><br />
|
<label for="key">Public Key</label><br />
|
||||||
<textarea class="form-control" name="key" rows="7" id="key"><%= admin_key %></textarea>
|
<textarea class="form-control" name="key" rows="7" id="key"><%= admin_key %></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<h3><small style="text-transform: uppercase;">Hostname Configuration</small></h3>
|
<h3><small style="text-transform: uppercase;">Hostname Configuration</small></h3>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="hostname">Hostname</label>
|
<label for="hostname">Hostname</label>
|
||||||
<input class="form-control" type="text" id="hostname" name="hostname" value="<%= hostname %>" />
|
<input class="form-control" type="text" id="hostname" name="hostname" value="<%= hostname %>" />
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label><input id="vhost" name="vhost" type="checkbox" value="true"> Use <abbr title="Nginx will be run on port 80 and backend to your apps based on hostname">virtualhost naming</abbr> for apps</label>
|
<label><input id="vhost" name="vhost" type="checkbox" value="true"> Use <abbr title="Nginx will be run on port 80 and backend to your apps based on hostname">virtualhost naming</abbr> for apps</label>
|
||||||
</div>
|
</div>
|
||||||
<p>Your app URLs will look like:</p>
|
<p>Your app URLs will look like:</p>
|
||||||
<pre id="example">http://hostname:port</pre>
|
<pre id="example">http://hostname:port</pre>
|
||||||
</div>
|
</div>
|
||||||
<button type="button" onclick="setup()" class="btn btn-primary">Finish Setup</button> <span style="padding-left: 20px;" id="result"></span>
|
<button type="button" onclick="setup()" class="btn btn-primary">Finish Setup</button> <span style="padding-left: 20px;" id="result"></span>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div id="error-output"></div>
|
<div id="error-output"></div>
|
||||||
<script>
|
<script>
|
||||||
function setup() {
|
function setup() {
|
||||||
if ($.trim($("#key").val()) == "") {
|
if ($.trim($("#key").val()) == "") {
|
||||||
alert("Your admin public key cannot be blank.")
|
alert("Your admin public key cannot be blank.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if ($.trim($("#hostname").val()) == "") {
|
if ($.trim($("#hostname").val()) == "") {
|
||||||
alert("Your hostname cannot be blank.")
|
alert("Your hostname cannot be blank.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
data = $("#form").serialize()
|
data = $("#form").serialize()
|
||||||
$("input,textarea,button").prop("disabled", true);
|
$("input,textarea,button").prop("disabled", true);
|
||||||
$.post('/setup', data)
|
$.post('/setup', data)
|
||||||
.done(function() {
|
.done(function() {
|
||||||
$("#result").html("Success!")
|
$("#result").html("Success!")
|
||||||
window.location.href = "http://progrium.viewdocs.io/dokku/application-deployment";
|
window.location.href = "http://progrium.viewdocs.io/dokku/application-deployment";
|
||||||
})
|
})
|
||||||
.fail(function(data) {
|
.fail(function(data) {
|
||||||
$("#result").html("Something went wrong...")
|
$("#result").html("Something went wrong...")
|
||||||
$("#error-output").html(data.responseText)
|
$("#error-output").html(data.responseText)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function update() {
|
function update() {
|
||||||
if ($("#vhost").is(":checked") && $("#hostname").val().match(/^(\d{1,3}\.){3}\d{1,3}$/)) {
|
if ($("#vhost").is(":checked") && $("#hostname").val().match(/^(\d{1,3}\.){3}\d{1,3}$/)) {
|
||||||
alert("In order to use virtualhost naming, the hostname must not be an IP but a valid domain name.")
|
alert("In order to use virtualhost naming, the hostname must not be an IP but a valid domain name.")
|
||||||
$("#vhost").prop('checked', false);
|
$("#vhost").prop('checked', false);
|
||||||
}
|
}
|
||||||
if ($("#vhost").is(':checked')) {
|
if ($("#vhost").is(':checked')) {
|
||||||
$("#example").html("http://<app-name>."+$("#hostname").val())
|
$("#example").html("http://<app-name>."+$("#hostname").val())
|
||||||
} else {
|
} else {
|
||||||
$("#example").html("http://"+$("#hostname").val()+":<app-port>")
|
$("#example").html("http://"+$("#hostname").val()+":<app-port>")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$("#vhost").change(update);
|
$("#vhost").change(update);
|
||||||
$("#hostname").change(update);
|
$("#hostname").change(update);
|
||||||
update();
|
update();
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
VERSION="$1"
|
VERSION="$1"
|
||||||
IMPORT_DIR="$2"
|
IMPORT_DIR="$2"
|
||||||
TARGET_DIR="$3"
|
TARGET_DIR="$3"
|
||||||
@@ -15,4 +16,3 @@ for app in $APPS; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
exit $ret
|
exit $ret
|
||||||
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
VERSION="$1"
|
VERSION="$1"
|
||||||
BASE_DIR="$2"
|
BASE_DIR="$2"
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
VERSION="$1"
|
VERSION="$1"
|
||||||
IMPORT_DIR="$2"
|
IMPORT_DIR="$2"
|
||||||
TARGET_DIR="$3"
|
TARGET_DIR="$3"
|
||||||
|
|
||||||
[[ -f $IMPORT_DIR/.sshcommand ]] && mv $IMPORT_DIR/.sshcommand $TARGET_DIR/.sshcommand
|
[[ -f $IMPORT_DIR/.sshcommand ]] && mv $IMPORT_DIR/.sshcommand $TARGET_DIR/.sshcommand
|
||||||
if [[ -f $IMPORT_DIR/.ssh/authorized_keys ]]; then
|
if [[ -f $IMPORT_DIR/.ssh/authorized_keys ]]; then
|
||||||
mkdir -p $TARGET_DIR/.ssh
|
mkdir -p $TARGET_DIR/.ssh
|
||||||
cat $IMPORT_DIR/.ssh/authorized_keys $TARGET_DIR/.ssh/authorized_keys | uniq > $TARGET_DIR/.ssh/authorized_keys
|
cat $IMPORT_DIR/.ssh/authorized_keys $TARGET_DIR/.ssh/authorized_keys | uniq > $TARGET_DIR/.ssh/authorized_keys
|
||||||
chmod 0700 $TARGET_DIR/.ssh
|
chmod 0700 $TARGET_DIR/.ssh
|
||||||
chmod 0600 $TARGET_DIR/.ssh/*
|
chmod 0600 $TARGET_DIR/.ssh/*
|
||||||
fi
|
fi
|
||||||
[[ -f $IMPORT_DIR/HOSTNAME ]] && mv $IMPORT_DIR/HOSTNAME $TARGET_DIR/HOSTNAME
|
[[ -f $IMPORT_DIR/HOSTNAME ]] && mv $IMPORT_DIR/HOSTNAME $TARGET_DIR/HOSTNAME
|
||||||
[[ -f $IMPORT_DIR/VHOST ]] && mv $IMPORT_DIR/VHOST $TARGET_DIR/VHOST
|
[[ -f $IMPORT_DIR/VHOST ]] && mv $IMPORT_DIR/VHOST $TARGET_DIR/VHOST
|
||||||
@@ -31,13 +31,13 @@ case "$1" in
|
|||||||
|
|
||||||
run)
|
run)
|
||||||
if [[ -z $2 ]]; then
|
if [[ -z $2 ]]; then
|
||||||
echo "Please specify an app to run the command on"
|
echo "Please specify an app to run the command on"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
APP="$2"; IMAGE="dokku/$APP"
|
APP="$2"; IMAGE="dokku/$APP"
|
||||||
if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then
|
if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then
|
||||||
echo "App $APP does not exist"
|
echo "App $APP does not exist"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
shift 2
|
shift 2
|
||||||
|
|
||||||
@@ -48,8 +48,8 @@ case "$1" in
|
|||||||
url)
|
url)
|
||||||
APP="$2";
|
APP="$2";
|
||||||
if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then
|
if [[ ! -d "$DOKKU_ROOT/$APP" ]]; then
|
||||||
echo "App $APP does not exist"
|
echo "App $APP does not exist"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -f "$DOKKU_ROOT/$APP/URL" ]]; then
|
if [[ -f "$DOKKU_ROOT/$APP/URL" ]]; then
|
||||||
@@ -74,4 +74,3 @@ EOF
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
if [[ ! -f "$DOKKU_ROOT/HOSTNAME" ]]; then
|
if [[ ! -f "$DOKKU_ROOT/HOSTNAME" ]]; then
|
||||||
echo $(hostname -f) > $DOKKU_ROOT/HOSTNAME
|
echo $(hostname -f) > $DOKKU_ROOT/HOSTNAME
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# temporary hack for https://github.com/progrium/dokku/issues/82
|
# temporary hack for https://github.com/progrium/dokku/issues/82
|
||||||
|
|||||||
@@ -68,4 +68,3 @@ EOF
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
CURRENT_BACKUP_VERSION=1
|
CURRENT_BACKUP_VERSION=1
|
||||||
set -e; case "$1" in
|
|
||||||
|
case "$1" in
|
||||||
backup:export)
|
backup:export)
|
||||||
OUTPUT_FILE="$2"
|
OUTPUT_FILE="$2"
|
||||||
BACKUP_DIR="$DOKKU_ROOT"
|
BACKUP_DIR="$DOKKU_ROOT"
|
||||||
@@ -24,9 +26,9 @@ set -e; case "$1" in
|
|||||||
|
|
||||||
# if no file specified, output to stdout
|
# if no file specified, output to stdout
|
||||||
if [[ -z $OUTPUT_FILE ]]; then
|
if [[ -z $OUTPUT_FILE ]]; then
|
||||||
cat $BACKUP_TMP_FILE
|
cat $BACKUP_TMP_FILE
|
||||||
else
|
else
|
||||||
mv $BACKUP_TMP_FILE $OUTPUT_FILE
|
mv $BACKUP_TMP_FILE $OUTPUT_FILE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -rf $BACKUP_TMP_DIR
|
rm -rf $BACKUP_TMP_DIR
|
||||||
@@ -48,14 +50,14 @@ set -e; case "$1" in
|
|||||||
tar xf $INPUT_FILE --directory=$BACKUP_TMP_DIR
|
tar xf $INPUT_FILE --directory=$BACKUP_TMP_DIR
|
||||||
|
|
||||||
if [[ ! -f $BACKUP_TMP_DIR/.dokku_backup_version ]]; then
|
if [[ ! -f $BACKUP_TMP_DIR/.dokku_backup_version ]]; then
|
||||||
echo "Unable to determine backup version"
|
echo "Unable to determine backup version"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
VERSION=$(< $BACKUP_TMP_DIR/.dokku_backup_version)
|
VERSION=$(< $BACKUP_TMP_DIR/.dokku_backup_version)
|
||||||
if [[ $VERSION -ne 1 ]]; then
|
if [[ $VERSION -ne 1 ]]; then
|
||||||
echo "Unknown format version $VERSION"
|
echo "Unknown format version $VERSION"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Importing a version $VERSION backup..."
|
echo "Importing a version $VERSION backup..."
|
||||||
@@ -91,4 +93,3 @@ EOF
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
+17
-16
@@ -14,6 +14,7 @@
|
|||||||
# in seconds).
|
# in seconds).
|
||||||
|
|
||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
CONTAINERID="$1"; APP="$2"; PORT="$3" ; HOSTNAME="${4:-localhost}"
|
CONTAINERID="$1"; APP="$2"; PORT="$3" ; HOSTNAME="${4:-localhost}"
|
||||||
|
|
||||||
# source in app env to get DOKKU_CHECKS_WAIT and any other necessary vars
|
# source in app env to get DOKKU_CHECKS_WAIT and any other necessary vars
|
||||||
@@ -27,23 +28,23 @@ WAIT="${DOKKU_CHECKS_WAIT:-5}"
|
|||||||
# after successfully copying the file. Thus, we suppress stderr.
|
# after successfully copying the file. Thus, we suppress stderr.
|
||||||
# ref: https://github.com/dotcloud/docker/issues/3986
|
# ref: https://github.com/dotcloud/docker/issues/3986
|
||||||
if [[ ! -f "$FILENAME" ]] ; then
|
if [[ ! -f "$FILENAME" ]] ; then
|
||||||
echo " check-deploy: $FILENAME not found. attempting to retrieve it from container ..."
|
echo " check-deploy: $FILENAME not found. attempting to retrieve it from container ..."
|
||||||
TMPDIR=$(mktemp -d /tmp/CHECKS.XXXXX)
|
TMPDIR=$(mktemp -d /tmp/CHECKS.XXXXX)
|
||||||
docker cp $CONTAINERID:/app/CHECKS $TMPDIR 2> /dev/null || true
|
docker cp $CONTAINERID:/app/CHECKS $TMPDIR 2> /dev/null || true
|
||||||
if [[ ! -s "${TMPDIR}/CHECKS" ]] ; then
|
if [[ ! -s "${TMPDIR}/CHECKS" ]] ; then
|
||||||
echo " CHECKS file not found in container. skipping checks."
|
echo " CHECKS file not found in container. skipping checks."
|
||||||
rm -rf $TMPDIR
|
rm -rf $TMPDIR
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo " CHECKS file found in container"
|
echo " CHECKS file found in container"
|
||||||
FILENAME=${TMPDIR}/CHECKS
|
FILENAME=${TMPDIR}/CHECKS
|
||||||
|
|
||||||
function cleanup() {
|
function cleanup() {
|
||||||
echo " removing CHECKS file copied from container"
|
echo " removing CHECKS file copied from container"
|
||||||
rm -rf $TMPDIR
|
rm -rf $TMPDIR
|
||||||
}
|
}
|
||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Waiting $WAIT seconds ..."
|
echo "Waiting $WAIT seconds ..."
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
VERSION="$1"
|
VERSION="$1"
|
||||||
BASE_DIR="$2"
|
BASE_DIR="$2"
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
VERSION="$1"
|
VERSION="$1"
|
||||||
IMPORT_DIR="$2"
|
IMPORT_DIR="$2"
|
||||||
@@ -7,5 +8,5 @@ TARGET_DIR="$3"
|
|||||||
|
|
||||||
cd $IMPORT_DIR
|
cd $IMPORT_DIR
|
||||||
for file in */ENV; do
|
for file in */ENV; do
|
||||||
cp $file "$TARGET_DIR/$file"
|
cp $file "$TARGET_DIR/$file"
|
||||||
done
|
done
|
||||||
@@ -75,7 +75,6 @@ config_write() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
|
||||||
config)
|
config)
|
||||||
APP="$2"
|
APP="$2"
|
||||||
|
|
||||||
@@ -186,4 +185,3 @@ EOF
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -1,18 +1,20 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
VERSION="$1"
|
VERSION="$1"
|
||||||
IMPORT_DIR="$2"
|
IMPORT_DIR="$2"
|
||||||
TARGET_DIR="$3"
|
TARGET_DIR="$3"
|
||||||
APPS="$4"
|
APPS="$4"
|
||||||
|
|
||||||
while read APP; do
|
while read APP; do
|
||||||
APP_PATH="$TARGET_DIR/$APP";
|
APP_PATH="$TARGET_DIR/$APP";
|
||||||
git init --bare $APP_PATH > /dev/null
|
git init --bare $APP_PATH > /dev/null
|
||||||
PRERECEIVE_HOOK="$APP_PATH/hooks/pre-receive"
|
PRERECEIVE_HOOK="$APP_PATH/hooks/pre-receive"
|
||||||
cat > $PRERECEIVE_HOOK <<EOF
|
cat > $PRERECEIVE_HOOK <<EOF
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e; set -o pipefail;
|
set -e; set -o pipefail;
|
||||||
|
|
||||||
cat | DOKKU_ROOT="$DOKKU_ROOT" dokku git-hook $APP
|
cat | DOKKU_ROOT="$DOKKU_ROOT" dokku git-hook $APP
|
||||||
EOF
|
EOF
|
||||||
chmod +x $PRERECEIVE_HOOK
|
chmod +x $PRERECEIVE_HOOK
|
||||||
done < $APPS > /dev/null
|
done < $APPS > /dev/null
|
||||||
+19
-19
@@ -2,19 +2,19 @@
|
|||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
git_archive_all() {
|
git_archive_all() {
|
||||||
APP=$1; REV=$2
|
APP=$1; REV=$2
|
||||||
TMP_WORK_DIR=$(mktemp -d)
|
TMP_WORK_DIR=$(mktemp -d)
|
||||||
chmod 755 $TMP_WORK_DIR
|
chmod 755 $TMP_WORK_DIR
|
||||||
unset GIT_DIR GIT_WORK_TREE
|
unset GIT_DIR GIT_WORK_TREE
|
||||||
git clone $DOKKU_ROOT/$APP $TMP_WORK_DIR &> /dev/null
|
git clone $DOKKU_ROOT/$APP $TMP_WORK_DIR &> /dev/null
|
||||||
pushd $TMP_WORK_DIR > /dev/null
|
pushd $TMP_WORK_DIR > /dev/null
|
||||||
git config advice.detachedHead false
|
git config advice.detachedHead false
|
||||||
git checkout $REV &> /dev/null
|
git checkout $REV &> /dev/null
|
||||||
git submodule update --init --recursive &> /dev/null
|
git submodule update --init --recursive &> /dev/null
|
||||||
find -name .git -prune -exec rm -rf {} \; > /dev/null
|
find -name .git -prune -exec rm -rf {} \; > /dev/null
|
||||||
tar c .
|
tar c .
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
rm -rf $TMP_WORK_DIR > /dev/null
|
rm -rf $TMP_WORK_DIR > /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@@ -31,7 +31,6 @@ case "$1" in
|
|||||||
echo $'\e[1G\e[K'"-----> WARNING: deploy did not complete, you must push to master."
|
echo $'\e[1G\e[K'"-----> WARNING: deploy did not complete, you must push to master."
|
||||||
echo $'\e[1G\e[K'"-----> for example, try 'git push <dokku> ${refname/refs\/heads\/}:master'"
|
echo $'\e[1G\e[K'"-----> for example, try 'git push <dokku> ${refname/refs\/heads\/}:master'"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@@ -40,14 +39,15 @@ case "$1" in
|
|||||||
APP_PATH=$DOKKU_ROOT/$APP
|
APP_PATH=$DOKKU_ROOT/$APP
|
||||||
|
|
||||||
if [[ $1 == "git-receive-pack" && ! -d "$APP_PATH/refs" ]]; then
|
if [[ $1 == "git-receive-pack" && ! -d "$APP_PATH/refs" ]]; then
|
||||||
git init --bare $APP_PATH > /dev/null
|
git init --bare $APP_PATH > /dev/null
|
||||||
PRERECEIVE_HOOK="$APP_PATH/hooks/pre-receive"
|
PRERECEIVE_HOOK="$APP_PATH/hooks/pre-receive"
|
||||||
cat > $PRERECEIVE_HOOK <<EOF
|
cat > $PRERECEIVE_HOOK <<EOF
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e; set -o pipefail;
|
set -e; set -o pipefail;
|
||||||
|
|
||||||
cat | DOKKU_ROOT="$DOKKU_ROOT" dokku git-hook $APP
|
cat | DOKKU_ROOT="$DOKKU_ROOT" dokku git-hook $APP
|
||||||
EOF
|
EOF
|
||||||
chmod +x $PRERECEIVE_HOOK
|
chmod +x $PRERECEIVE_HOOK
|
||||||
fi
|
fi
|
||||||
|
|
||||||
args=$@
|
args=$@
|
||||||
@@ -57,5 +57,5 @@ EOF
|
|||||||
help)
|
help)
|
||||||
cat
|
cat
|
||||||
;;
|
;;
|
||||||
esac
|
|
||||||
|
|
||||||
|
esac
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
VERSION="$1"
|
VERSION="$1"
|
||||||
BASE_DIR="$2"
|
BASE_DIR="$2"
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
VERSION="$1"
|
VERSION="$1"
|
||||||
IMPORT_DIR="$2"
|
IMPORT_DIR="$2"
|
||||||
@@ -8,6 +9,6 @@ TARGET_DIR="$3"
|
|||||||
cd $IMPORT_DIR
|
cd $IMPORT_DIR
|
||||||
|
|
||||||
for file in */tls/server.*; do
|
for file in */tls/server.*; do
|
||||||
mkdir -p $(dirname $TARGET_DIR$file)
|
mkdir -p $(dirname $TARGET_DIR$file)
|
||||||
cp $file $TARGET_DIR$file
|
cp $file $TARGET_DIR$file
|
||||||
done
|
done
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
# latest stable NGINX 1.4.x with websocket support
|
# latest stable NGINX 1.4.x with websocket support
|
||||||
apt-get install -qq -y software-properties-common python-software-properties
|
apt-get install -qq -y software-properties-common python-software-properties
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
sudo /etc/init.d/nginx reload > /dev/null
|
sudo /etc/init.d/nginx reload > /dev/null
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
|
|
||||||
APP="$1"; PORT="$2"
|
APP="$1"; PORT="$2"
|
||||||
WILDCARD_SSL="$DOKKU_ROOT/tls"
|
WILDCARD_SSL="$DOKKU_ROOT/tls"
|
||||||
SSL="$DOKKU_ROOT/$APP/tls"
|
SSL="$DOKKU_ROOT/$APP/tls"
|
||||||
|
|||||||
Reference in new issue
Block a user