我已在DigitalOcean的 512MB Droplet 上安装了14.04(带Docker 1.2.0)的 Dokku v0.2.3的全新图像。为了避免内存问题,我照常创建一个交换文件。
我部署了两个用于测试的应用,一个用于子域,另一个用于自定义域,并且效果很好。
这只是一个测试服务器,只是为了看它是如何工作的,如果它的工作原理,总体来看我是否可以使它工作。
因此。接下来的事情是摧毁那个Droplet并创建一个新的部署来部署一些应用程序。我和第一次工作一样,完成these steps here in this article。
基本上:
生成SSH密钥(这显然可行)
访问服务器(http://)以执行dokku的设置(此处我已激活使用虚拟主机命名应用)
更新dokku部署步骤
cd~ / dokku git pull origin master make install
安装dokku postgresql插件
cd / var / lib / dokku / plugins postgresql git clone https://github.com/Kloadut/dokku-pg-plugin dokku plugins-install
将rails测试应用推送到服务器这是输出:
git push dokku master
Counting objects: 6, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (6/6), 491 bytes | 0 bytes/s, done.
Total 6 (delta 2), reused 3 (delta 0)
-----> Cleaning up ...
-----> Building rails-sample ...
Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.1.2
-----> Installing dependencies using 1.6.3
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 -- deployment
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Using rake 10.1.1
Using i18n 0.6.9
Using minitest 4.7.5
Using multi_json 1.8.4
Using tzinfo 0.3.38
Using builder 3.1.4
Using erubis 2.7.0
Using atomic 1.1.15
Using rack 1.5.2
Using polyglot 0.3.4
Using activerecord-deprecated_finders 1.0.3
Using arel 4.0.2
Using coffee-script-source 1.7.0
Using mime-types 1.25.1
Using execjs 2.0.2
Using hike 1.2.3
Using thor 0.18.1
Using kgio 2.9.2
Using json 1.8.1
Using tilt 1.4.1
Using bundler 1.6.3
Using pg 0.17.1
Using raindrops 0.13.0
Using rails_serve_static_assets 0.0.2
Using rails_stdout_logging 0.0.3
Using sass 3.2.14
Using thread_safe 0.2.0
Using rack-test 0.6.2
Using treetop 1.4.15
Using coffee-script 2.2.0
Using sprockets 2.11.0
Using uglifier 2.4.0
Using rails_12factor 0.0.2
Using unicorn 4.8.2
Using rdoc 4.1.1
Using activesupport 4.0.3
Using sdoc 0.4.0
Using mail 2.5.4
Using actionpack 4.0.3
Using activemodel 4.0.3
Using jbuilder 1.5.3
Using actionmailer 4.0.3
Using railties 4.0.3
Using coffee-rails 4.0.1
Using sprockets-rails 2.0.1
Using jquery-rails 3.1.0
Using turbolinks 2.2.1
Using activerecord 4.0.3
Using sass-rails 4.0.1
Using rails 4.0.3
Your bundle is complete!
Gems in the groups development and test were not installed.
It was installed into ./vendor/bundle
Bundle completed (1.64s)
Cleaning up the bundler cache.
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
Asset precompilation completed (2.47s)
Cleaning assets
Running: rake assets:clean
-----> Discovering process types
Procfile declares types -> web
Default process types for Ruby -> rake, console, web, worker
-----> Releasing rails-sample ...
-----> Deploying rails-sample ...
-----> Checking status of PostgreSQL
Found image postgresql/rails-sample database
Checking status... ok.
-----> Running pre-flight checks
check-deploy: /home/dokku/rails-sample/CHECKS not found. attempting to retrieve it from container ...
CHECKS file not found in container. skipping checks.
-----> Running post-deploy
-----> Creating non-ssl nginx.conf
-----> Running nginx-pre-reload
Reloading nginx
-----> Shutting down old container in 60 seconds
=====> Application deployed:
http://rails-sample.domain.com
最后回到服务器,创建数据库并运行rake迁移
dokku postgresql:创建rails-sample docker run -i -t dokku / rails-sample / bin / bash export HOME = / app 对于/app/.profile.d/*中的文件; do source $ file; DONE hash -r cd / app RAILS_ENV =生产佣金db:migrate
现在网络我访问rails-sample.domain.com它只是没有做任何事情。在Chrome上,我收到ERR_CONNECTION_REFUSED
错误。
域可以很好地解析服务器的IP地址。甚至还有带有通配符的A记录指向服务器。
Haven在Google上没有看到这种错误。甚至有一个线索在哪里看可能是错的。 Dokku日志几乎是空的。那里只是起始日志部分:
INFO -- : Refreshing Gem list
INFO -- : listening on addr=0.0.0.0:5000 fd=9
INFO -- : master process ready
INFO -- : worker=0 ready
INFO -- : worker=1 ready
INFO -- : worker=2 ready
很明显,从来没有访问该应用程序。
docker ps
输出:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ce2d9d46f769 dokku/rails-sample:latest "/bin/bash -c '/star About an hour ago Up About an hour 0.0.0.0:49156->5000/tcp dreamy_curie
89a111191b6a postgresql/rails-sample:latest "/usr/bin/start_pgsq About an hour ago Up About an hour 0.0.0.0:49154->5432/tcp focused_mayer
我在哪里可以看看它有什么问题?我已经完成了五次创建过程(在新的水滴上)并且总是出现相同的错误,但我无法弄清楚出了什么问题。它更加令人沮丧,因为它第一次发挥得非常好。
感谢。
更新 当我访问domain.com:49158时,该应用程序似乎工作正常。
更新II 所以域配置似乎没问题。它也与子域一起运行,但只是在它之后指定端口。 似乎端口80 拒绝连接。但不知道如何。 nginx配置文件似乎都可以(ips / ports / hostnames / etc)