Deploying Chatwoot Rails, Chatwoot Sidekiq as separate services #9645
-
Hello World and Team Chatwoot, Is it possible to deploy Rails and Sidekiq as separate services via two dockerfiles and using postgres and redis via add on services provided by cloud provider? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
Yes, it is possible to deploy Rails and Sidekiq as separate services using two different Dockerfiles, and leverage PostgreSQL and Redis as add-on services provided by a cloud provider. Here's a general overview of the steps you can follow:
By separating the Rails application and Sidekiq into separate services, you can scale them independently and manage their resources more efficiently. Additionally, using managed PostgreSQL and Redis services from your cloud provider can offload the responsibility of managing and scaling these data stores, allowing you to focus on your application's core functionality. Note that you might need to configure networking and security rules in your cloud provider to allow communication between your Docker containers and the managed services. Also, make sure to follow best practices for securing your Docker containers and managing secrets (e.g., using environment variables or Docker Secrets). |
Beta Was this translation helpful? Give feedback.
-
Thank you for the response, I have set two different dockerfile as below, now the problem is how to connect to managed PostgreSQL and Redis services to both app via .env referred from steps to build image yourself https://www.chatwoot.com/docs/self-hosted/deployment/docker/ for rails appFROM chatwoot/chatwoot:latest
RUN chmod +x docker/entrypoints/rails.sh
EXPOSE 3000
CMD ["rails", "server", "-b", "0.0.0.0", "-p", "3000"] for sidekiq App# Extend from the Chatwoot base image
FROM chatwoot/chatwoot:latest
# Set the working directory
WORKDIR /app
# Command to start Sidekiq
CMD ["bundle", "exec", "sidekiq", "-C", "config/sidekiq.yml"] |
Beta Was this translation helpful? Give feedback.
-
Hi, I think I got it, Here's what I did Docker File for Sidekiq# Extend from the Chatwoot base image
FROM chatwoot/chatwoot:latest
# Set the working directory
WORKDIR /app
ENV RAILS_ENV=production \
REDIS_URL=${REDIS_URL}
RUN chmod +x docker/entrypoints/rails.sh
ENTRYPOINT ["docker/entrypoints/rails.sh"]
# Command to start Sidekiq
CMD ["bundle", "exec", "sidekiq", "-C", "config/sidekiq.yml"] Dockerfile for Rails AppFROM chatwoot/chatwoot:latest
RUN chmod +x docker/entrypoints/rails.sh
ENTRYPOINT ["docker/entrypoints/rails.sh"]
EXPOSE 3000
CMD ["bundle", "exec", "rails", "s", "-b", "0.0.0.0", "-p", "3000"] env for rails app, for more details please refer https://www.chatwoot.com/docs/self-hosted/configuration/environment-variablesDATABASE_URL=your db url
POSTGRES_HOST=your host
POSTGRES_PORT="5432"
POSTGRES_DATABASE=your db name
POSTGRES_USER=your db user
POSTGRES_PASSWORD=your db password
REDIS_URL=your redis url
REDIS_PASSWORD=your redis password
ACTIVE_STORAGE_SERVICE="local"
LOG_LEVEL="error"
LOG_SIZE="1024"
ENABLE_ACCOUNT_SIGNUP=true
DIRECT_UPLOADS_ENABLED=false
DEFAULT_LOCALE="en"
NODE_ENV="production"
RAILS_ENV="production"
INSTALLATION_ENV="docker" Thank you 🎉, happy coding all 💻 |
Beta Was this translation helpful? Give feedback.
-
@shubhenducw looks good but did you need to use the chatwoot image for rails and sidekiq I would like to use something more native. Did you try that ? |
Beta Was this translation helpful? Give feedback.
Yes, it is possible to deploy Rails and Sidekiq as separate services using two different Dockerfiles, and leverage PostgreSQL and Redis as add-on services provided by a cloud provider.
Here's a general overview of the steps you can follow:
Create a Dockerfile for the Rails application:
ruby:3.0.0
)Create a Dockerfile for the Sidekiq service:
ruby:3.0.0
)