Cliquez ici pour udemy https://www.udemy.com/course/rails-kj/ Apprentissage
[Application de tableau d'affichage SNS] (https://github.com/kkoji/rails-lecture/tree/current_user_method) J'ai le droit de faire.
Rails série 5 Ruby 2.4.5 mysql2
Enfin j'essaye de me déployer sur heroku
Jusqu'à ce que vous déployez Rails sur Docker avec Heroku Je suis bloqué en essayant d'utiliser MySQL avec Heroku Référez-vous à, essayez
En tant que flux, Ajouter clearDB en tant que module complémentaire Définir dans la configuration (changer en mysql2) Connexion CLI heroku Connectez-vous au conteneur Heroku heroku create~~ heroku container:push web heroku container:release web heroku run rails db:migrate heroku open heroku run rails assets:precompile heroku config:add RAILS_ENV=production (Je ne comprends pas le pipeline d'actifs)
Cependant, une erreur d'application s'est produite lors de l'ouverture d'heroku et aux journaux heroku --tail
2020-08-31T00:05:17.338031+00:00 app[api]: Deployed web (09d5e5e0baba) by user [email protected]
2020-08-31T00:05:17.338031+00:00 app[api]: Release v14 created by user [email protected]
2020-08-31T00:05:17.566831+00:00 heroku[web.1]: State changed from crashed to starting
2020-08-31T00:05:33.102257+00:00 app[api]: Starting process with command `rails db:migrate` by user [email protected]
2020-08-31T00:05:41.271963+00:00 heroku[web.1]: Starting process with command `irb`
2020-08-31T00:05:44.759411+00:00 app[web.1]: Switch to inspect mode.
2020-08-31T00:05:44.760171+00:00 app[web.1]:
2020-08-31T00:05:44.815317+00:00 heroku[web.1]: Process exited with status 0
2020-08-31T00:05:44.849695+00:00 heroku[web.1]: State changed from starting to crashed
2020-08-31T00:05:44.852418+00:00 heroku[web.1]: State changed from crashed to starting
2020-08-31T00:05:52.851790+00:00 heroku[run.7980]: State changed from starting to up
2020-08-31T00:05:52.856447+00:00 heroku[run.7980]: Awaiting client
2020-08-31T00:05:52.891424+00:00 heroku[run.7980]: Starting process with command `rails db:migrate`
2020-08-31T00:05:59.894902+00:00 heroku[run.7980]: Process exited with status 0
2020-08-31T00:05:59.927380+00:00 heroku[run.7980]: State changed from up to complete
2020-08-31T00:06:05.419295+00:00 heroku[web.1]: Starting process with command `irb`
2020-08-31T00:06:08.786074+00:00 app[web.1]: Switch to inspect mode.
2020-08-31T00:06:08.786799+00:00 app[web.1]:
2020-08-31T00:06:08.879555+00:00 heroku[web.1]: Process exited with status 0
2020-08-31T00:06:08.991140+00:00 heroku[web.1]: State changed from starting to crashed
2020-08-31T00:09:58.194158+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=glacial-temple-79557.herokuapp.com request_id=432296e9-7359-4456-bbc2-b885e514a27d fwd="111.97.175.96" dyno= connect= service= status=503 bytes= protocol=https
2020-08-31T00:09:59.223351+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=glacial-temple-79557.herokuapp.com request_id=12c8e692-769d-45a7-9967-ce77256746eb fwd="111.97.175.96" dyno= connect= service= status=503 bytes= protocol=https
C'est sorti.
plus loin, Heroku run rails console c
Running via Spring preloader in process 18
WARNING: Spring is running in production. To fix this make sure the spring gem is only present in `development` and `test` groups in your Gemfile and make sure you always use `bundle install --without development test` in production
Loading production environment (Rails 5.0.7.2)
pour cette raison, Modifier l'installation du bundle avec Dockerfile
FROM ruby:2.4.5
RUN apt-get update -qq && apt-get install -y build-essential nodejs
RUN mkdir /app
WORKDIR /app
COPY Gemfile /app/Gemfile
COPY Gemfile.lock /app/Gemfile.lock
RUN bundle install --without development test
COPY . /app
Je l'ai réécrit, mais ça n'a pas guéri.
Hmmm faible ...
Sous Docker-compose.yml
Docker-compose.yml
version: '3'
services:
web:
build: .
command: bundle exec rails s -p 3000 -b '0.0.0.0'
volumes:
- .:/app
ports:
- 3000:3000
depends_on:
- db
tty: true
stdin_open: true
db:
image: mysql:5.7
volumes:
- db-volume:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: password
volumes:
db-volume:
Recommended Posts