2014-12-13 18:56:31 -08:00
|
|
|
shellcheck:
|
|
|
|
|
ifeq ($(shell shellcheck > /dev/null 2>&1 ; echo $$?),127)
|
|
|
|
|
ifeq ($(shell uname),Darwin)
|
|
|
|
|
brew install shellcheck
|
|
|
|
|
else
|
|
|
|
|
sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse'
|
|
|
|
|
sudo apt-get update && sudo apt-get install -y shellcheck
|
|
|
|
|
endif
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
ci-dependencies: shellcheck bats
|
|
|
|
|
|
|
|
|
|
setup-deploy-tests:
|
2014-12-14 14:45:49 -08:00
|
|
|
mkdir -p /home/dokku
|
|
|
|
|
ifdef ENABLE_DOKKU_TRACE
|
|
|
|
|
echo "-----> Enabling tracing"
|
|
|
|
|
echo "export DOKKU_TRACE=1" >> /home/dokku/dokkurc
|
|
|
|
|
endif
|
2014-12-13 18:56:31 -08:00
|
|
|
@echo "Setting dokku.me in /etc/hosts"
|
2015-01-06 12:42:21 -08:00
|
|
|
sudo /bin/bash -c "[[ `ping -c1 dokku.me > /dev/null 2>&1; echo $$?` -eq 0 ]] || echo \"127.0.0.1 dokku.me *.dokku.me www.test.app.dokku.me\" >> /etc/hosts"
|
2014-12-13 18:56:31 -08:00
|
|
|
|
|
|
|
|
@echo "-----> Generating keypair..."
|
|
|
|
|
mkdir -p /root/.ssh
|
|
|
|
|
rm -f /root/.ssh/dokku_test_rsa*
|
|
|
|
|
echo -e "y\n" | ssh-keygen -f /root/.ssh/dokku_test_rsa -t rsa -N ''
|
|
|
|
|
chmod 600 /root/.ssh/dokku_test_rsa*
|
|
|
|
|
|
|
|
|
|
@echo "-----> Setting up ssh config..."
|
2014-12-14 14:45:49 -08:00
|
|
|
ifneq ($(shell ls /root/.ssh/config > /dev/null 2>&1 ; echo $$?),0)
|
2014-12-13 18:56:31 -08:00
|
|
|
echo "Host dokku.me \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config
|
2015-04-25 09:54:49 -07:00
|
|
|
echo "Host 127.0.0.1 \\r\\n Port 22333 \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config
|
2014-12-14 14:45:49 -08:00
|
|
|
else ifeq ($(shell grep dokku.me /root/.ssh/config),)
|
2014-12-13 18:56:31 -08:00
|
|
|
echo "Host dokku.me \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config
|
2015-04-25 09:54:49 -07:00
|
|
|
echo "Host 127.0.0.1 \\r\\n Port 22333 \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
ifeq ($(shell grep 22333 /etc/ssh/sshd_config),)
|
|
|
|
|
sed --in-place "s:^Port 22:Port 22 \\nPort 22333:g" /etc/ssh/sshd_config
|
|
|
|
|
restart ssh
|
2014-12-13 18:56:31 -08:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
@echo "-----> Installing SSH public key..."
|
|
|
|
|
sudo sshcommand acl-remove dokku test
|
|
|
|
|
cat /root/.ssh/dokku_test_rsa.pub | sudo sshcommand acl-add dokku test
|
|
|
|
|
|
|
|
|
|
@echo "-----> Intitial SSH connection to populate known_hosts..."
|
|
|
|
|
ssh -o StrictHostKeyChecking=no dokku@dokku.me help > /dev/null
|
2015-04-25 09:54:49 -07:00
|
|
|
ssh -o StrictHostKeyChecking=no dokku@127.0.0.1 help > /dev/null
|
2014-12-13 18:56:31 -08:00
|
|
|
|
2015-01-05 13:13:43 -08:00
|
|
|
ifeq ($(shell grep dokku.me /home/dokku/VHOST 2>/dev/null),)
|
2014-12-14 15:31:08 -08:00
|
|
|
@echo "-----> Setting default VHOST to dokku.me..."
|
|
|
|
|
echo "dokku.me" > /home/dokku/VHOST
|
|
|
|
|
endif
|
|
|
|
|
|
2014-12-13 18:56:31 -08:00
|
|
|
bats:
|
|
|
|
|
git clone https://github.com/sstephenson/bats.git /tmp/bats
|
|
|
|
|
cd /tmp/bats && sudo ./install.sh /usr/local
|
|
|
|
|
rm -rf /tmp/bats
|
|
|
|
|
|
|
|
|
|
lint:
|
|
|
|
|
# these are disabled due to their expansive existence in the codebase. we should clean it up though
|
|
|
|
|
# SC2034: VAR appears unused - https://github.com/koalaman/shellcheck/wiki/SC2034
|
|
|
|
|
# SC2086: Double quote to prevent globbing and word splitting - https://github.com/koalaman/shellcheck/wiki/SC2086
|
2014-12-23 16:40:28 -08:00
|
|
|
# SC2001: See if you can use ${variable//search/replace} instead. - https://github.com/koalaman/shellcheck/wiki/SC2001
|
2014-12-13 18:56:31 -08:00
|
|
|
@echo linting...
|
2015-11-01 08:46:00 -06:00
|
|
|
@$(QUIET) shellcheck ./contrib/dokku_client.sh
|
2015-11-04 11:00:59 -06:00
|
|
|
@$(QUIET) find . -not -path '*/\.*' | xargs file | egrep "shell|bash" | egrep -v "directory|toml" | awk '{ print $$1 }' | sed 's/://g' | grep -v dokku_client.sh | xargs shellcheck -e SC2034,SC2086,SC2001
|
2014-12-13 18:56:31 -08:00
|
|
|
|
|
|
|
|
unit-tests:
|
|
|
|
|
@echo running unit tests...
|
2015-04-24 13:52:14 -07:00
|
|
|
ifndef UNIT_TEST_BATCH
|
2014-12-13 18:56:31 -08:00
|
|
|
@$(QUIET) bats tests/unit
|
2015-04-24 13:52:14 -07:00
|
|
|
else
|
|
|
|
|
@$(QUIET) ./tests/ci/unit_test_runner.sh $$UNIT_TEST_BATCH
|
|
|
|
|
endif
|
2014-12-13 18:56:31 -08:00
|
|
|
|
2015-07-11 13:50:53 +02:00
|
|
|
deploy-test-checks-root:
|
|
|
|
|
@echo deploying checks-root app...
|
|
|
|
|
cd tests && ./test_deploy ./apps/checks-root dokku.me '' true
|
|
|
|
|
|
2015-02-03 16:46:04 -08:00
|
|
|
deploy-test-clojure:
|
|
|
|
|
@echo deploying config app...
|
|
|
|
|
cd tests && ./test_deploy ./apps/clojure dokku.me
|
|
|
|
|
|
2014-12-14 18:11:17 -08:00
|
|
|
deploy-test-config:
|
|
|
|
|
@echo deploying config app...
|
|
|
|
|
cd tests && ./test_deploy ./apps/config dokku.me
|
|
|
|
|
|
2015-02-07 10:47:04 -08:00
|
|
|
deploy-test-dockerfile:
|
|
|
|
|
@echo deploying dockerfile app...
|
|
|
|
|
cd tests && ./test_deploy ./apps/dockerfile dokku.me
|
|
|
|
|
|
2015-04-03 12:13:39 -07:00
|
|
|
deploy-test-dockerfile-noexpose:
|
|
|
|
|
@echo deploying dockerfile-noexpose app...
|
|
|
|
|
cd tests && ./test_deploy ./apps/dockerfile-noexpose dokku.me
|
|
|
|
|
|
2014-12-14 18:11:17 -08:00
|
|
|
deploy-test-gitsubmodules:
|
2014-12-20 15:27:25 -08:00
|
|
|
@echo deploying gitsubmodules app...
|
2014-12-14 18:11:17 -08:00
|
|
|
cd tests && ./test_deploy ./apps/gitsubmodules dokku.me
|
|
|
|
|
|
|
|
|
|
deploy-test-go:
|
2014-12-20 15:27:25 -08:00
|
|
|
@echo deploying go app...
|
2014-12-14 18:11:17 -08:00
|
|
|
cd tests && ./test_deploy ./apps/go dokku.me
|
|
|
|
|
|
|
|
|
|
deploy-test-java:
|
2015-01-11 16:30:13 -08:00
|
|
|
@echo deploying java app...
|
2014-12-14 18:11:17 -08:00
|
|
|
cd tests && ./test_deploy ./apps/java dokku.me
|
|
|
|
|
|
|
|
|
|
deploy-test-multi:
|
2014-12-20 15:27:25 -08:00
|
|
|
@echo deploying multi app...
|
2014-12-14 18:11:17 -08:00
|
|
|
cd tests && ./test_deploy ./apps/multi dokku.me
|
|
|
|
|
|
|
|
|
|
deploy-test-nodejs-express:
|
2015-01-11 16:30:13 -08:00
|
|
|
@echo deploying nodejs-express app...
|
2014-12-14 18:11:17 -08:00
|
|
|
cd tests && ./test_deploy ./apps/nodejs-express dokku.me
|
|
|
|
|
|
2015-01-09 21:22:05 -08:00
|
|
|
deploy-test-nodejs-express-noprocfile:
|
2015-01-11 16:30:13 -08:00
|
|
|
@echo deploying nodejs-express app with no Procfile...
|
2015-01-09 21:22:05 -08:00
|
|
|
cd tests && ./test_deploy ./apps/nodejs-express-noprocfile dokku.me
|
|
|
|
|
|
2015-07-30 14:29:36 -07:00
|
|
|
deploy-test-nodejs-worker:
|
|
|
|
|
@echo deploying nodejs-worker app...
|
|
|
|
|
cd tests && ./test_deploy ./apps/nodejs-worker dokku.me
|
|
|
|
|
|
2014-12-14 18:11:17 -08:00
|
|
|
deploy-test-php:
|
2014-12-20 15:27:25 -08:00
|
|
|
@echo deploying php app...
|
2014-12-14 18:11:17 -08:00
|
|
|
cd tests && ./test_deploy ./apps/php dokku.me
|
|
|
|
|
|
|
|
|
|
deploy-test-python-flask:
|
2014-12-20 15:27:25 -08:00
|
|
|
@echo deploying python-flask app...
|
2014-12-14 18:11:17 -08:00
|
|
|
cd tests && ./test_deploy ./apps/python-flask dokku.me
|
|
|
|
|
|
2015-03-09 19:07:50 -07:00
|
|
|
deploy-test-ruby:
|
|
|
|
|
@echo deploying ruby app...
|
|
|
|
|
cd tests && ./test_deploy ./apps/ruby dokku.me
|
|
|
|
|
|
2014-12-23 23:43:11 -08:00
|
|
|
deploy-test-scala:
|
|
|
|
|
@echo deploying scala app...
|
|
|
|
|
cd tests && ./test_deploy ./apps/scala dokku.me
|
|
|
|
|
|
2014-12-14 18:11:17 -08:00
|
|
|
deploy-test-static:
|
2014-12-20 15:27:25 -08:00
|
|
|
@echo deploying static app...
|
2014-12-14 18:11:17 -08:00
|
|
|
cd tests && ./test_deploy ./apps/static dokku.me
|
|
|
|
|
|
2014-12-13 18:56:31 -08:00
|
|
|
deploy-tests:
|
|
|
|
|
@echo running deploy tests...
|
2015-07-11 13:50:53 +02:00
|
|
|
@$(QUIET) $(MAKE) deploy-test-checks-root
|
2014-12-14 18:11:17 -08:00
|
|
|
@$(QUIET) $(MAKE) deploy-test-config
|
2015-02-03 16:46:04 -08:00
|
|
|
@$(QUIET) $(MAKE) deploy-test-clojure
|
2015-02-07 10:47:04 -08:00
|
|
|
@$(QUIET) $(MAKE) deploy-test-dockerfile
|
2015-04-03 12:13:39 -07:00
|
|
|
@$(QUIET) $(MAKE) deploy-test-dockerfile-noexpose
|
2014-12-14 18:11:17 -08:00
|
|
|
@$(QUIET) $(MAKE) deploy-test-gitsubmodules
|
|
|
|
|
@$(QUIET) $(MAKE) deploy-test-go
|
|
|
|
|
@$(QUIET) $(MAKE) deploy-test-java
|
2015-01-06 11:20:22 -08:00
|
|
|
@$(QUIET) $(MAKE) deploy-test-multi
|
2014-12-14 18:11:17 -08:00
|
|
|
@$(QUIET) $(MAKE) deploy-test-nodejs-express
|
2015-01-09 21:22:05 -08:00
|
|
|
@$(QUIET) $(MAKE) deploy-test-nodejs-express-noprocfile
|
2015-07-30 14:29:36 -07:00
|
|
|
@$(QUIET) $(MAKE) deploy-test-nodejs-worker
|
2014-12-16 17:37:28 -08:00
|
|
|
@$(QUIET) $(MAKE) deploy-test-php
|
2014-12-14 18:11:17 -08:00
|
|
|
@$(QUIET) $(MAKE) deploy-test-python-flask
|
2014-12-23 23:43:11 -08:00
|
|
|
@$(QUIET) $(MAKE) deploy-test-scala
|
2014-12-20 16:37:41 -08:00
|
|
|
@$(QUIET) $(MAKE) deploy-test-static
|
2014-12-13 18:56:31 -08:00
|
|
|
|
2014-12-14 14:45:49 -08:00
|
|
|
test: setup-deploy-tests lint unit-tests deploy-tests
|