我正在尝试将 Rails 应用程序部署到 digitalocean dokku Droplet。我在 Droplet 上运行了所有必要的命令,然后成功从本地推送。我什至添加了一个域名,看看是否有帮助。
访问域名显示“无法访问此站点”错误,访问IP显示:
欢迎使用 Nginx!如果您看到此页面,则 nginx Web 服务器是 成功安装并运行。需要进一步配置。
我错过了什么?
以下是在 Droplet 上运行的命令。该应用程序被命名为“playlistbuilder”,数据库也被命名为:
dokku apps:create playlistbuilder
dokku plugin:install https://github.com/dokku/dokku-postgres.git postgres
dokku postgres:create playlistbuilder
dokku postgres:link playlistbuilder playlistbuilder
dokku postgres:link playlistbuilder playlistbuilder
dokku domains:add playlistbuilder playlist.creator
下面是运行
git push dokku master
的输出 - 我删除了一些捆绑器输出,因为它似乎与我的问题无关。看来成功了..:
$ git push dokku master
Enumerating objects: 13, done.
Counting objects: 100% (13/13), done.
Delta compression using up to 8 threads
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 777 bytes | 777.00 KiB/s, done.
Total 7 (delta 5), reused 0 (delta 0), pack-reused 0
remote: -----> Cleaning up...
remote: -----> Building playlistbuilder from herokuish
remote: -----> Adding BUILD_ENV to build environment...
remote: BUILD_ENV added successfully
remote: -----> Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
remote: Detected buildpacks: ruby nodejs
remote: -----> Ruby app detected
remote: -----> Installing bundler 2.3.25
remote: -----> Removing BUNDLED WITH version in the Gemfile.lock
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-3.1.2
remote:
remote: ###### WARNING:
remote:
remote: Removing `Gemfile.lock` because it was generated on Windows.
remote: Bundler will do a full resolve so native gems are handled properly.
remote: This may result in unexpected gem versions being used in your app.
remote: In rare occasions Bundler may not be able to resolve your dependencies at all.
remote:
remote: https://devcenter.heroku.com/articles/bundler-windows-gemfile
remote:
remote: -----> Installing dependencies using bundler 2.3.25
remote: Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin bundle install -j4
remote: Fetching gem metadata from https://rubygems.org/...........
remote: Resolving dependencies..........
remote: Using rake 13.2.1
remote: Using concurrent-ruby 1.3.4
...
remote: Using aws-sdk-kms 1.95.0
remote: Fetching aws-sdk-s3 1.170.0
remote: Installing rails_12factor 0.0.3
remote: Installing aws-sdk-s3 1.170.0
remote: Bundle complete! 26 Gemfile dependencies, 92 gems now installed.
remote: Gems in the groups 'development' and 'test' were not installed.
remote: Bundled gems are installed into `./vendor/bundle`
remote: Bundle completed (8.61s)
remote: Cleaning up the bundler cache.
remote: Removing aws-sdk-core (3.211.0)
remote: Removing aws-sdk-s3 (1.169.0)
remote: Removing timeout (0.4.1)
remote: -----> Installing node-v16.18.1-linux-x64
remote: -----> Detecting rake tasks
remote: -----> Preparing app for Rails asset pipeline
remote: Running: rake assets:precompile
remote: Asset precompilation completed (2.26s)
remote: Cleaning assets
remote: Running: rake assets:clean
remote: -----> Detecting rails configuration
remote:
remote: ###### WARNING:
remote:
remote: Removing `Gemfile.lock` because it was generated on Windows.
remote: Bundler will do a full resolve so native gems are handled properly.
remote: This may result in unexpected gem versions being used in your app.
remote: In rare occasions Bundler may not be able to resolve your dependencies at all.
remote:
remote: https://devcenter.heroku.com/articles/bundler-windows-gemfile
remote:
remote: ###### WARNING:
remote:
remote: There is a more recent Ruby version available for you to use:
remote:
remote: 3.1.6
remote:
remote: The latest version will include security and bug fixes. We always recommend
remote: running the latest version of your minor release.
remote:
remote: Please upgrade your Ruby version.
remote:
remote: For all available Ruby versions see:
remote: https://devcenter.heroku.com/articles/ruby-support#supported-runtimes
remote:
remote: ###### WARNING:
remote:
remote: No Procfile detected, using the default web server.
remote: We recommend explicitly declaring how to boot your server process via a Procfile.
remote: https://devcenter.heroku.com/articles/ruby-default-web-server
remote:
remote:
remote: -----> Discovering process types
remote: Default types for -> rake, console, web
remote: -----> Releasing playlistbuilder...
remote: -----> Checking for predeploy task
remote: No predeploy task found, skipping
remote: -----> Checking for release task
remote: No release task found, skipping
remote: =====> Processing deployment checks
remote: No CHECKS file found. Simple container checks will be performed.
remote: For more efficient zero downtime deployments, create a CHECKS file. See https://dokku.com/docs/deployment/zero-downtime-deploys/ for examples
remote: -----> Deploying playlistbuilder via the docker-local scheduler...
remote: -----> Deploying web (count=1)
remote: Attempting pre-flight checks (web.1)
remote: Waiting for 10 seconds (web.1)
remote: Default container check successful (web.1)
remote: Scheduling old container shutdown in 60 seconds (web.1)
remote: =====> Triggering early nginx proxy rebuild
remote: -----> Ensuring network configuration is in sync for playlistbuilder
remote: -----> Configuring playlist.creator...(using built-in template)
remote: -----> Configuring playlistbuilder.packer-6481b5fa-f32f-c6ab-b44d-a2621ac2dcee...(using built-in template)
remote: -----> Creating http nginx.conf
remote: Reloading nginx
remote: -----> Running post-deploy
remote: ! Detected IPv4 domain name with nginx proxy enabled.
remote: ! Ensure the default nginx site is removed before continuing.
remote: -----> Ensuring network configuration is in sync for playlistbuilder
remote: -----> Configuring playlist.creator...(using built-in template)
remote: -----> Configuring playlistbuilder.packer-6481b5fa-f32f-c6ab-b44d-a2621ac2dcee...(using built-in template)
remote: -----> Creating http nginx.conf
remote: Reloading nginx
remote: -----> Renaming containers
remote: Found previous container(s) (2fbdab2249ce) named playlistbuilder.web.1
remote: Renaming container (2fbdab2249ce) playlistbuilder.web.1 to playlistbuilder.web.1.1730987359
remote: Renaming container playlistbuilder.web.1.upcoming-25604 (a33e595155ee) to playlistbuilder.web.1
remote: -----> Checking for postdeploy task
remote: No postdeploy task found, skipping
remote: -----> Shutting down old containers in 60 seconds
remote: =====> Application deployed:
remote: http://playlist.creator
remote: http://playlistbuilder.packer-6481b5fa-f32f-c6ab-b44d-a2621ac2dcee
remote:
To 178.128.157.11:playlistbuilder
a7e10a0..5045835 master -> master
版本:
红宝石 3.1.2
多库 0.30.6
Ubuntu 22.04
感谢@dbugger 为我指明了正确的方向。 @Edmund 对这个问题的回答是我问题的解决方案:
https://stackoverflow.com/a/78882862/5161457
删除默认站点(如果存在):
sudo rm /etc/nginx/sites-enabled/default
测试您的 Nginx 配置:
sudo nginx -t
如果测试通过,重新加载Nginx:
sudo systemctl reload nginx
然后 10 分钟后重试。