fatfreecrm / fat_free_crm

Ruby on Rails CRM platform
http://www.fatfreecrm.com
Other
3.58k stars 1.33k forks source link

Create a demo docker image #1017

Open steveyken opened 2 years ago

steveyken commented 2 years ago

If we have a docker image with demo data loaded, we could use this as a way to 'snap back' the data to a clean state once a day. This would enable the demo to get up and running again.

johnbumgardner commented 1 year ago

With this demo image, we could set up a demo heroku instance to let people test the app before they clone the repo

lauriejefferson commented 1 year ago

Is this issue still open? I would like to work on it.

steveyken commented 1 year ago

Thank you, yes that would be very helpful

On Mon, 5 Jun 2023 at 20:02, Laurie Jefferson @.***> wrote:

Is this issue still open? I would like to work on it.

— Reply to this email directly, view it on GitHub https://github.com/fatfreecrm/fat_free_crm/issues/1017#issuecomment-1576657841, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABENTQSJYTZ6E7YJD5YQ5LXJXDGJANCNFSM6AAAAAAQ6AAKYM . You are receiving this because you authored the thread.Message ID: @.***>

lauriejefferson commented 1 year ago

I forked the repo. Can this issue be assigned to me under 'Assignees'? Thanks.

johnbumgardner commented 1 year ago

I forked the repo. Can this issue be assigned to me under 'Assignees'? Thanks.

done

lauriejefferson commented 1 year ago

Your Docker Compose file is pulling an image of postgres:9.5, which according to endoflife.date is deprecated. The official Postgres images on Docker Hub start with version 12.15-bullseye. Is your docker-compose.yml file out of date?

johnbumgardner commented 1 year ago

Your Docker Compose file is pulling an image of postgres:9.5, which according to endoflife.date is deprecated. The official Postgres images on Docker Hub start with version 12.15-bullseye. Is your docker-compose.yml file out of date?

it is; go ahead and bump this version

lauriejefferson commented 1 year ago

Ruby is also out of date. The Dockerfile is using ruby:2.7, which is deprecated according to endoflife.date. The official Ruby image on Docker Hub starts at 3.0-alpine, docker-hub-ruby. Is the Dockerfile up to date?

johnbumgardner commented 1 year ago

upgrading to Ruby 3.0 is kind of a bigger job. thats on my todo list after finishing the rails 7 migration. for now 2.7 should be fine

lauriejefferson commented 1 year ago

I'm having a similar issue as #961 when I run docker-compose. I created the two volumes pgdata and gems and run docker-compose up. Docker can create the /home/app directory, but it hangs on the RUN step and takes a really long time to run the apt-get commands (250s): Here's the error output. Rails doesn't appear to be able to connect to Postgres, from the error on lines 422-425.

steveyken commented 1 year ago

Thank you Laurie, I think there are a couple of issues here...

ActiveRecord::ConnectionNotEstablished: could not connect to server: No such file or directory

0 232.7 Is the server running locally and accepting#0 232.7

connections on Unix domain socket

"/var/run/postgresql/.s.PGSQL.5432"?

As you say, postgres is not contactable... it's looking for a unix socket rather than a TCP host. I can see you're copying the correct config/database.postgres.docker.yml file which should switch ActiveRecord into TCP mode rather than UNIX socket but it doesn't appear to be working. If you aren't already doing this, you could try setting the environment variables in that file DB_USERNAME, DB_PASSWORD, DB_HOST, DB_PORT, DB_DATABASE to values that docker compose is setting up for the DB instance, that might be enough to trigger the change.

Secondly, FFCRM shouldn't need database access to run rake assets:compile in the first place... this is a bug I am currently in the process of fixing and will submit a PR shortly. Once merged, you'll likely need to update to the latest master anyway.

Hope that helps and thanks for looking into this.

Regards, Steve

On Tue, 6 Jun 2023 at 02:12, Laurie Jefferson @.***> wrote:

I'm having a similar issue as #960 https://github.com/fatfreecrm/fat_free_crm/pull/960 when I run docker-compose. I created the two volumes pgdata and gems and run docker-compose up. Docker can create the /home/app directory, but it hangs on the RUN step and takes a really long time to run the apt-get commands (250s): Here's the error output https://hastebin.com/share/omajisakab.shell. Rails doesn't appear to be able to connect to Postgres, from the error on lines 422-425.

— Reply to this email directly, view it on GitHub https://github.com/fatfreecrm/fat_free_crm/issues/1017#issuecomment-1577251570, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABENTWN3NZ7BR2QTSV3UMDXJYOQPANCNFSM6AAAAAAQ6AAKYM . You are receiving this because you authored the thread.Message ID: @.***>

steveyken commented 1 year ago

Ref PR #1121

lauriejefferson commented 1 year ago

Steve, I tried setting the env variables to the values in docker-compose, which gave me a new error "could not translate host name "db" to address: Name or service not known". I then tried setting the host: host.docker.internal in the database.postgres.docker.yml file, and got the original "could not establish a connection" error message. I'll continue once PR #1121 is completed.

johnbumgardner commented 1 year ago

Steve, I tried setting the env variables to the values in docker-compose, which gave me a new error "could not translate host name "db" to address: Name or service not known". I then tried setting the host: host.docker.internal in the database.postgres.docker.yml file, and got the original "could not establish a connection" error message. I'll continue once PR #1121 is completed.

the issue youre experiencing is probably unrelated to the PR Steve is fixing. try deploying the postgres container using docker compose, then creating a side container and seeing if you can use the CLI to resolve the hostname of the pg container. may require tinkering with the docker compose yml

lauriejefferson commented 4 months ago

@steveyken @johnbumgardner @brynary @olleolleolle Please see PR #1123. Can this issue be closed?