Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run Production from Dockerfile, not Docker Compose? #3145

Open
1 task done
kiarafbickers opened this issue Oct 5, 2022 · 4 comments
Open
1 task done

Run Production from Dockerfile, not Docker Compose? #3145

kiarafbickers opened this issue Oct 5, 2022 · 4 comments
Labels
question Support and discussion of existing and new functionality support Help with using or running Octobox

Comments

@kiarafbickers
Copy link

kiarafbickers commented Oct 5, 2022

Are you experiencing this issue in octobox.io or your own instance?

  • My instance

If your issue is related to an Octobox.io subscription purchase please ensure you have installed the Octobox GitHub App for the repositories concerned.

Summary of Problem

  • What are you trying to do?

I'm attempting to deploy octobox to railway.app, however docker compose is not supported. How do I run this app in production without docker compose?

  • What happens?

When I try to run the application as is I get this error message, Looks like your app is listening on 127.0.0.1. You may need to listen on 0.0.0.0 instead

  • What should have happened?

It should be able to run in production from the dockerfile.

Steps to Reproduce the Issue

(help octobox maintainers reproduce your issue to make it easier to fix)

Build the current main branch on the Railway.app, the error message will display at the top of the Deploy Logs.

Versions, Operating System and Hardware

  • Which version/commit of Octobox are you using?

Latest

  • How are you deploying Octobox (Docker, Heroku, Openshift, etc)

Docker on Railway.app

@andrew
Copy link
Member

andrew commented Oct 5, 2022

I've not used railway.app before but it looks like you'll need to get octobox to run in production mode rather than development:

andrew@Andrews-MBP repos % rails server --help
Usage:
  rails server -u [thin/puma/webrick] [options]

Options:
  -e, [--environment=ENVIRONMENT]              # Specifies the environment to run this server under (test/development/production).
  -p, [--port=port]                            # Runs Rails on the specified port - defaults to 3000.
  -b, [--binding=IP]                           # Binds Rails to the specified IP - defaults to 'localhost' in development and '0.0.0.0' in other environments'.

Looks like you can set environment variables in Railway.app so adding RAILS_ENV=production should fix the port error.

@andrew andrew added question Support and discussion of existing and new functionality support Help with using or running Octobox labels Oct 5, 2022
@kiarafbickers
Copy link
Author

kiarafbickers commented Oct 5, 2022

That seems to work, however now I'm getting another error message: "RAILS_ENV=production" executable file not found in $PATH unknown.

Maybe this can be fixed from the Dockerfile?


ENV APP_ROOT /usr/src/app
ENV OCTOBOX_DATABASE_PORT 5432
WORKDIR $APP_ROOT

# =============================================
# System layer

# Will invalidate cache as soon as the Gemfile changes
COPY Gemfile Gemfile.lock $APP_ROOT/

# * Setup system
# * Install Ruby dependencies
RUN apk add --update \
    build-base \
    netcat-openbsd \
    git \
    nodejs \
    postgresql-dev \
    tzdata \
    curl-dev \
 && rm -rf /var/cache/apk/* \
 && gem update --system \
 && gem install bundler foreman \
 && bundle config --global frozen 1 \
 && bundle config set without 'test' \
 && bundle install --jobs 2

# ========================================================
# Application layer

# Copy application code
COPY . $APP_ROOT

# Precompile assets for a production environment.
# This is done to include assets in production images on Dockerhub.
RUN RAILS_ENV=production bundle exec rake assets:precompile

# * Generate the docs
# * Make files OpenShift conformant
RUN RAILS_ENV=development bin/rails api_docs:generate \
 && chgrp -R 0 $APP_ROOT \
 && chmod -R g=u $APP_ROOT

# Startup
CMD ["bin/docker-start"]

@andrew
Copy link
Member

andrew commented Oct 5, 2022

I'm off on holiday for a week so won't be able to help debug until I get back, but it seems that railway is trying to run that envirnoment variable as a command, did you add it in the variables section as documented? https://docs.railway.app/develop/variables

@andrew
Copy link
Member

andrew commented Oct 5, 2022

I was able to get the app started on railway (https://octobox-production.up.railway.app/), I set the following ENV vars:

Screenshot 2022-10-05 at 22 53 45

You will need to add a few more in from following the installation guide: https://github.com/octobox/octobox/blob/master/docs/INSTALLATION.md to be able to login via github etc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Support and discussion of existing and new functionality support Help with using or running Octobox
Projects
None yet
Development

No branches or pull requests

2 participants