因此,我正在用postgresql数据库创建一个最小的rails应用程序。我想确保rails应用程序工作,并确保docker和您的工作rails应用程序尽可能相似。
FROM ruby:latest
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
RUN mkdir /rails_docker
WORKDIR /rails_docker
COPY Gemfile /rails_docker/Gemfile
COPY Gemfile.lock /rails_docker/Gemfile.lock
RUN bundle install
COPY . /rails_docker
version: '3'
services:
db:
image: postgres
restart: always
environment:
POSTGRES_USER: 'samnorton'
POSTGRES_PASSWORD: 'grace0512'
volumes:
- postgres-data:/var/lib/postgresql/data
ports:
- '9999:5432'
web:
build: .
command: bundle exec rails s -p 3000 -b '0.0.0.0'
volumes:
- .:/rails_docker
ports:
- "3000:3000"
depends_on:
- db
volumes:
postgres-data:
driver: local
data-K54C:~/Desktop/rails_docker$ sudo docker-compose up
[sudo] password for sam:
railsdocker_db_1 is up-to-date
Starting railsdocker_web_1 ...
Starting railsdocker_web_1 ... done
Attaching to railsdocker_db_1, railsdocker_web_1
db_1 | 2019-12-12 14:20:38.333 UTC [1] LOG: starting PostgreSQL 12.0 (Debian 12.0-2.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
db_1 | 2019-12-12 14:20:38.342 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
db_1 | 2019-12-12 14:20:38.342 UTC [1] LOG: listening on IPv6 address "::", port 5432
db_1 | 2019-12-12 14:20:38.411 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1 | 2019-12-12 14:20:38.547 UTC [25] LOG: database system was shut down at 2019-12-12 14:20:06 UTC
db_1 | 2019-12-12 14:20:38.609 UTC [1] LOG: database system is ready to accept connections
db_1 | 2019-12-12 14:24:47.800 UTC [1] LOG: received smart shutdown request
db_1 | 2019-12-12 14:24:47.841 UTC [1] LOG: background worker "logical replication launcher" (PID 31) exited with exit code 1
db_1 | 2019-12-12 14:24:47.844 UTC [26] LOG: shutting down
db_1 | 2019-12-12 14:24:48.094 UTC [1] LOG: database system is shut down
db_1 | 2019-12-12 15:54:38.528 UTC [1] LOG: starting PostgreSQL 12.0 (Debian 12.0-2.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
db_1 | 2019-12-12 15:54:38.543 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
db_1 | 2019-12-12 15:54:38.543 UTC [1] LOG: listening on IPv6 address "::", port 5432
db_1 | 2019-12-12 15:54:38.627 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1 | 2019-12-12 15:54:38.806 UTC [23] LOG: database system was shut down at 2019-12-12 14:24:48 UTC
db_1 | 2019-12-12 15:54:39.053 UTC [1] LOG: database system is ready to accept connections
db_1 | 2019-12-12 16:40:42.473 UTC [1] LOG: received smart shutdown request
db_1 | 2019-12-12 16:40:42.590 UTC [1] LOG: background worker "logical replication launcher" (PID 29) exited with exit code 1
db_1 | 2019-12-12 16:40:42.590 UTC [24] LOG: shutting down
db_1 | 2019-12-12 16:40:43.398 UTC [1] LOG: database system is shut down
db_1 | 2019-12-13 00:02:44.643 UTC [1] LOG: starting PostgreSQL 12.0 (Debian 12.0-2.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
db_1 | 2019-12-13 00:02:44.665 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
db_1 | 2019-12-13 00:02:44.665 UTC [1] LOG: listening on IPv6 address "::", port 5432
db_1 | 2019-12-13 00:02:44.751 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1 | 2019-12-13 00:02:44.947 UTC [23] LOG: database system was shut down at 2019-12-12 16:40:43 UTC
db_1 | 2019-12-13 00:02:45.179 UTC [1] LOG: database system is ready to accept connections
db_1 | 2019-12-13 00:32:00.742 UTC [1] LOG: received smart shutdown request
db_1 | 2019-12-13 00:32:01.089 UTC [1] LOG: background worker "logical replication launcher" (PID 29) exited with exit code 1
db_1 | 2019-12-13 00:32:01.089 UTC [24] LOG: shutting down
db_1 | 2019-12-13 00:32:02.353 UTC [1] LOG: database system is shut down
db_1 | 2019-12-13 01:01:34.874 UTC [1] LOG: starting PostgreSQL 12.0 (Debian 12.0-2.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
db_1 | 2019-12-13 01:01:34.896 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
db_1 | 2019-12-13 01:01:34.896 UTC [1] LOG: listening on IPv6 address "::", port 5432
db_1 | 2019-12-13 01:01:35.035 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1 | 2019-12-13 01:01:35.479 UTC [23] LOG: database system was shut down at 2019-12-13 00:32:01 UTC
db_1 | 2019-12-13 01:01:35.873 UTC [1] LOG: database system is ready to accept connections
web_1 | Usage:
web_1 | rails new APP_PATH [options]
web_1 |
web_1 | Options:
web_1 | [--skip-namespace], [--no-skip-namespace] # Skip namespace (affects only isolated applications)
web_1 | -r, [--ruby=PATH] # Path to the Ruby binary of your choice
web_1 | # Default: /usr/local/bin/ruby
web_1 | -m, [--template=TEMPLATE] # Path to some application template (can be a filesystem path or URL)
web_1 | -d, [--database=DATABASE] # Preconfigure for selected database (options: mysql/postgresql/sqlite3/oracle/frontbase/ibm_db/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)
web_1 | # Default: sqlite3
web_1 | [--skip-yarn], [--no-skip-yarn] # Don't use Yarn for managing JavaScript dependencies
web_1 | [--skip-gemfile], [--no-skip-gemfile] # Don't create a Gemfile
web_1 | -G, [--skip-git], [--no-skip-git] # Skip .gitignore file
web_1 | [--skip-keeps], [--no-skip-keeps] # Skip source control .keep files
web_1 | -M, [--skip-action-mailer], [--no-skip-action-mailer] # Skip Action Mailer files
web_1 | -O, [--skip-active-record], [--no-skip-active-record] # Skip Active Record files
web_1 | [--skip-active-storage], [--no-skip-active-storage] # Skip Active Storage files
web_1 | -P, [--skip-puma], [--no-skip-puma] # Skip Puma related files
web_1 | -C, [--skip-action-cable], [--no-skip-action-cable] # Skip Action Cable files
web_1 | -S, [--skip-sprockets], [--no-skip-sprockets] # Skip Sprockets files
web_1 | [--skip-spring], [--no-skip-spring] # Don't install Spring application preloader
web_1 | [--skip-listen], [--no-skip-listen] # Don't generate configuration that depends on the listen gem
web_1 | [--skip-coffee], [--no-skip-coffee] # Don't use CoffeeScript
web_1 | -J, [--skip-javascript], [--no-skip-javascript] # Skip JavaScript files
web_1 | [--skip-turbolinks], [--no-skip-turbolinks] # Skip turbolinks gem
web_1 | -T, [--skip-test], [--no-skip-test] # Skip test files
web_1 | [--skip-system-test], [--no-skip-system-test] # Skip system test files
web_1 | [--skip-bootsnap], [--no-skip-bootsnap] # Skip bootsnap gem
web_1 | [--dev], [--no-dev] # Setup the application with Gemfile pointing to your Rails checkout
web_1 | [--edge], [--no-edge] # Setup the application with Gemfile pointing to Rails repository
web_1 | [--rc=RC] # Path to file containing extra configuration options for rails command
web_1 | [--no-rc], [--no-no-rc] # Skip loading of extra configuration options from .railsrc file
web_1 | [--api], [--no-api] # Preconfigure smaller stack for API only apps
web_1 | -B, [--skip-bundle], [--no-skip-bundle] # Don't run bundle install
web_1 | [--webpack=WEBPACK] # Preconfigure for app-like JavaScript with Webpack (options: react/vue/angular/elm/stimulus)
web_1 |
web_1 | Runtime options:
web_1 | -f, [--force] # Overwrite files that already exist
web_1 | -p, [--pretend], [--no-pretend] # Run but do not make any changes
web_1 | -q, [--quiet], [--no-quiet] # Suppress status output
web_1 | -s, [--skip], [--no-skip] # Skip files that already exist
web_1 |
web_1 | Rails options:
web_1 | -h, [--help], [--no-help] # Show this help message and quit
web_1 | -v, [--version], [--no-version] # Show Rails version number and quit
web_1 |
web_1 | Description:
web_1 | The 'rails new' command creates a new Rails application with a default
web_1 | directory structure and configuration at the path you specify.
web_1 |
web_1 | You can specify extra command-line arguments to be used every time
web_1 | 'rails new' runs in the .railsrc configuration file in your home directory.
web_1 |
web_1 | Note that the arguments specified in the .railsrc file don't affect the
web_1 | defaults values shown above in this help message.
web_1 |
web_1 | Example:
web_1 | rails new ~/Code/Ruby/weblog
web_1 |
web_1 | This generates a skeletal Rails installation in ~/Code/Ruby/weblog.
railsdocker_web_1 exited with code 0
in the the curent case you are not using the right rails directory i think
在运行sudo docker-compose build
和sudo docker-compose up
之后,我得到以下错误:
data-K54C:~/Desktop/rails_docker$ sudo docker-compose up
railsdocker_db_1 is up-to-date
Recreating railsdocker_web_1 ...
Recreating railsdocker_web_1 ... error
ERROR: for railsdocker_web_1 no such image: sha256:6d066f5f04e34f6f442d4a68fb4124e1093bb6a976593087d5ebc92478abfaae: No such image: sha256:6d066f5f04e34f6f442d4a68fb4124e1093bb6a976593087d5ebc92478abfaae
ERROR: for web no such image: sha256:6d066f5f04e34f6f442d4a68fb4124e1093bb6a976593087d5ebc92478abfaae: No such image: sha256:6d066f5f04e34f6f442d4a68fb4124e1093bb6a976593087d5ebc92478abfaae
ERROR: Encountered errors while bringing up the project.
sam@sam-K54C:~/Desktop/rails_docker$ clear
尝试替换命令
,如下所示:
command: bundle exec bin/rails s -p 3000 -b '0.0.0.0'
那应该管用。
我改了日期。php中的时区。从“Europe/Berlin”到“Europe/London”的ini(实际上我在整个MAMP文件夹中的所有9个php.ini文件实例中都这么做了),从那以后,我在MAMP phpinfo中收到了这个警告 警告:phpinfo():依赖系统的时区设置是不安全的。您需要使用日期。时区设置或date\u default\u timezone\u set()函数。如果您使用
问题内容: 我想在Rails 4应用程序中使用material-ui组件库。我目前正在使用react-rails gem将.jsx编译添加到资产管道。我已经在gemfile中通过rails-assets添加了material-ui,如下所示: 我需要在application.js文件中添加该库,如下所示: 但是,我不断收到错误消息“找不到文件’material-ui”。如何将我的Rails应用程序
我找不到Rails,让travis去工作。当测试开始运行时,仍然会出现数据库连接错误。 和 我必须使用单独的数据库配置。 知道我做错了什么吗?按照http://about.travis-ci.org/docs/user/database-setup/中的文档,除了我必须将数据库配置复制到正确的位置之外。
我可以将其更改为正确的容器主机名-->plaintext://kafka:9092,但这样我就无法用其他应用程序再次访问kafka实例了。有什么简单的方法可以解决这个问题吗?
我在Rails应用程序上使用gem。 想设置一个列表属性,但在swagger官方数据类型中没有找到: https://swagger.io/docs/specification/data-models/data-types/ 字符串 数 整数 布尔 数组 对象 例如,响应数据将是: 尝试过: 这是字符串。
我有一个/应用程序。我使用来处理MongoDB的操作。我已经将MongoDB连接字符串存储在文件中,连接到数据库的文件如下所示, 我有一个登录路线,像每一个其他的应用程序和一切工作完美地在本地。由于它在本地运行得非常好,我决定在一个类似于生产的环境中进行测试。 为了使其生产准备就绪,我手动创建了数据库并创建了用户,并使用该用户在集合中插入了一个文档。此文档包含我登录应用程序所需的数据。我已经在Di