Postgres数据库未在Kubernetes Pod中迁移
我正在尝试将我的ROR应用程序部署在Kubernetes上。我正在使用PostgreSQL作为数据库。我正在分别部署前端和后端,并且正在使用ConfigMap注入环境变量。但是,我注意到一种奇怪的行为。有时,数据库正在迁移,有时不是。有时,该应用程序正常工作,而有时数据库不会迁移。我真的无法弄清楚是什么问题。日志还说您有1个未决的迁移。
这是我的dockerfile
fron-end:
FROM ruby:3.0.3
RUN apt-get update && apt-get install -y \
curl vim wget \
build-essential \
libpq-dev &&\
curl -sL https://deb.nodesource.com/setup_12.x | bash - && \
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
COPY . .
RUN bundle install &&\
gem install rails
ENTRYPOINT ["bash" , "commands.sh"]
是命令
#!/bin/bash
bundle install
rails db:create
rails db:migrate
rails db:seed
rails db:migrate
rails server -b 0.0.0.0
这 。 有人可以帮我弄清楚发生了什么事吗?
I'm trying to deploy my RoR application on Kubernetes. I'm using PostgreSQL as the database. I'm deploying both the front-end and back-end separately and I'm using configmap to inject the environment variables. However, I'm noticing a strange behaviour. Sometimes, the database is getting migrated and sometimes it isn't. Sometimes, the app works fine whereas sometimes the database isn't getting migrated. I really can't figure out what's the issue. The logs also says you have 1 pending migration.
Here's my Dockerfile
for the fron-end:
FROM ruby:3.0.3
RUN apt-get update && apt-get install -y \
curl vim wget \
build-essential \
libpq-dev &&\
curl -sL https://deb.nodesource.com/setup_12.x | bash - && \
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
COPY . .
RUN bundle install &&\
gem install rails
ENTRYPOINT ["bash" , "commands.sh"]
here's commands.sh
#!/bin/bash
bundle install
rails db:create
rails db:migrate
rails db:seed
rails db:migrate
rails server -b 0.0.0.0
I'm using postrSQL latest image for my database.
Can someone help me figure out what's happening?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论