DEV Community

Antonio
Antonio

Posted on

Problem with Rails...

Hello everyone! I encountered a problem installing Forem SelfHost on DigitalOcean, although I had previously installed it without problems.

It is useless to contact forem.dev, since this site has already been abandoned, so I ask for help here.

The installation is successful, but when I enter the command sudo systemctl restart forem-traefik.service, nothing happens.

There was a similar problem here: DigitalOcean: forem-traefik.service: Job forem-traefik.service/start failed with result 'dependency'. - Author @ben

If I run the command sudo systemctl start forem-rails.service, an error appears:

Job for forem-rails.service failed because the control process exited with error code.
See "systemctl status forem-rails.service" and "journalctl -xeu forem-rails.service" for details.

Enter fullscreen mode Exit fullscreen mode

journalctl -xeu forem-rails.service:

Nov 06 01:37:51 www.informland.com forem-rails-bootstrap[7552]: Disable partial writes in config/application.rb:
Nov 06 01:37:51 www.informland.com forem-rails-bootstrap[7552]:
Nov 06 01:37:51 www.informland.com forem-rails-bootstrap[7552]: config.active_record.partial_inserts = false
Nov 06 01:37:51 www.informland.com forem-rails-bootstrap[7552]:
Nov 06 01:37:51 www.informland.com forem-rails[7527]: rails aborted!
Nov 06 01:37:51 www.informland.com forem-rails[7527]: StandardError: An error has occurred, this and all later migrations canceled: (StandardError)
Nov 06 01:37:51 www.informland.com forem-rails[7527]: === Dangerous operation detected #strong_migrations ===
Nov 06 01:37:51 www.informland.com forem-rails[7527]: Partial writes are enabled, which can cause incorrect values
Nov 06 01:37:51 www.informland.com forem-rails[7527]: to be inserted when changing the default value of a column.
Nov 06 01:37:51 www.informland.com forem-rails[7527]: Disable partial writes in config/application.rb:
Nov 06 01:37:51 www.informland.com forem-rails[7527]: config.active_record.partial_inserts = false
Nov 06 01:37:51 www.informland.com forem-rails-bootstrap[7552]: /opt/apps/forem/db/migrate/20201019012200_change_email_preference_default_values.rb:3:in `change'
Nov 06 01:37:51 www.informland.com forem-rails-bootstrap[7552]: Tasks: TOP => db:prepare
Nov 06 01:37:51 www.informland.com forem-rails-bootstrap[7552]: (See full trace by running task with --trace)
Nov 06 01:37:51 www.informland.com forem-rails[7527]: /opt/apps/forem/db/migrate/20201019012200_change_email_preference_default_values.rb:3:in `change'
Nov 06 01:37:51 www.informland.com forem-rails[7527]: Tasks: TOP => db:prepare
Nov 06 01:37:51 www.informland.com forem-rails[7527]: (See full trace by running task with --trace)
Nov 06 01:37:51 www.informland.com forem-rails-bootstrap[7552]: I, [2024-11-06T01:37:50.024271 #23]  INFO -- ddtrace: [ddtrace] DATADOG CONFIGURATION - PROFILING - {"profiling_enabled">
Nov 06 01:37:51 www.informland.com forem-rails-bootstrap[7552]: I, [2024-11-06T01:37:50.031794 #23]  INFO -- ddtrace: [ddtrace] DATADOG CONFIGURATION - CORE - {"date":"2024-11-06T01:37>
Nov 06 01:37:51 www.informland.com forem-rails-bootstrap[7552]: I, [2024-11-06T01:37:50.788441 #23]  INFO -- honeybadger: ** [Honeybadger] Initializing Honeybadger Error Tracker for Ru>
Nov 06 01:37:51 www.informland.com forem-rails-bootstrap[7552]: I, [2024-11-06T01:37:51.795942 #23]  INFO -- : Migrating to ChangeEmailPreferenceDefaultValues (20201019012200)
Nov 06 01:37:51 www.informland.com forem-rails-bootstrap[7552]: == 20201019012200 ChangeEmailPreferenceDefaultValues: migrating ===============
Nov 06 01:37:51 www.informland.com forem-rails-bootstrap[7552]: E, [2024-11-06T01:37:51.813351 #23] ERROR -- honeybadger: ** [Honeybadger] Unable to send error report: API key is missi>
Nov 06 01:37:51 www.informland.com forem-rails[7527]: I, [2024-11-06T01:37:50.024271 #23]  INFO -- ddtrace: [ddtrace] DATADOG CONFIGURATION - PROFILING - {"profiling_enabled":false}
Nov 06 01:37:51 www.informland.com forem-rails[7527]: I, [2024-11-06T01:37:50.031794 #23]  INFO -- ddtrace: [ddtrace] DATADOG CONFIGURATION - CORE - {"date":"2024-11-06T01:37:50+00:00">
Nov 06 01:37:51 www.informland.com forem-rails[7527]: I, [2024-11-06T01:37:50.788441 #23]  INFO -- honeybadger: ** [Honeybadger] Initializing Honeybadger Error Tracker for Ruby. Ship i>
Nov 06 01:37:51 www.informland.com forem-rails[7527]: I, [2024-11-06T01:37:51.795942 #23]  INFO -- : Migrating to ChangeEmailPreferenceDefaultValues (20201019012200)
Nov 06 01:37:51 www.informland.com forem-rails[7527]: == 20201019012200 ChangeEmailPreferenceDefaultValues: migrating ===============
Nov 06 01:37:51 www.informland.com forem-rails[7527]: E, [2024-11-06T01:37:51.813351 #23] ERROR -- honeybadger: ** [Honeybadger] Unable to send error report: API key is missing. id=ed5>
Nov 06 01:37:51 www.informland.com conmon[7552]: conmon 707de065670f2dfb4e55 <nwarn>: Failed to open cgroups file: /sys/fs/cgroup/machine.slice/machine-libpod_pod_059e3778034af6e7ab375>
Nov 06 01:37:51 www.informland.com podman[7527]: 2024-11-06 01:37:51.897910895 +0000 UTC m=+15.670031717 container died 707de065670f2dfb4e553ddb1d080dd117372942c5abd1358a34a0e8f7a20648>
Nov 06 01:37:52 www.informland.com podman[7612]: 2024-11-06 01:37:52.111013065 +0000 UTC m=+0.197569767 container remove 707de065670f2dfb4e553ddb1d080dd117372942c5abd1358a34a0e8f7a2064>
Nov 06 01:37:52 www.informland.com podman[7612]: 2024-11-06 01:37:52.173605736 +0000 UTC m=+0.260162464 volume remove 9f13dadbb4943e27420eb3e47c3bbac716526ecaa896acd9606ef4a4ccde79fb
Nov 06 01:37:52 www.informland.com systemd[1]: forem-rails.service: Control process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ An ExecStartPre= process belonging to unit forem-rails.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 1.
Nov 06 01:37:52 www.informland.com systemd[1]: forem-rails.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ The unit forem-rails.service has entered the 'failed' state with result 'exit-code'.
Nov 06 01:37:52 www.informland.com systemd[1]: Failed to start forem-rails.service - Forem Rails Service.
░░ Subject: A start job for unit forem-rails.service has failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A start job for unit forem-rails.service has finished with a failure.
░░
░░ The job identifier is 13892 and the job result is failed.
Nov 06 01:37:52 www.informland.com systemd[1]: forem-rails.service: Consumed 1.551s CPU time.
░░ Subject: Resources consumed by unit runtime
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ The unit forem-rails.service completed and consumed the indicated resources.

Enter fullscreen mode Exit fullscreen mode

systemctl list-units forem* --all:

  UNIT                     LOAD   ACTIVE     SUB       JOB   DESCRIPTION
  forem-container.service  loaded inactive   dead            Forem container service
  forem-imgproxy.service   loaded active     running         Forem Imgproxy Service
  forem-openresty.service  loaded inactive   dead      start Forem OpenResty Service
  forem-pod.service        loaded active     running         Forem pod service
  forem-postgresql.service loaded active     running         Forem Postgresql Service
  forem-rails.service      loaded activating start-pre start Forem Rails Service
  forem-redis.service      loaded active     running         Forem Redis Service
  forem-traefik.service    loaded inactive   dead      start Forem Traefik Service
  forem-worker.service     loaded inactive   dead      start Forem Worker Service
  forem.service            loaded active     exited          Forem Service

Enter fullscreen mode Exit fullscreen mode

foremctl status:

CONTAINER ID  IMAGE                                    COMMAND               CREATED         STATUS         PORTS                                     NAMES
0554224b6823  localhost/podman-pause:5.2.4-1728259200                        27 minutes ago  Up 27 minutes  0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp  059e3778034a-infra
063379be747a  docker.io/darthsim/imgproxy:v2           imgproxy              27 minutes ago  Up 27 minutes  0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp  forem-imgproxy
e646bc30cd18  docker.io/library/postgres:11            postgres              27 minutes ago  Up 27 minutes  0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp  forem-postgresql
e39e6e9f4bbb  docker.io/library/redis:6.0.1            redis-server --ap...  27 minutes ago  Up 27 minutes  0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp  forem-redis
Enter fullscreen mode Exit fullscreen mode

Can anyone help solve the problem? :)

Top comments (10)

Collapse
 
katafrakt profile image
Paweł Świątkowski

This is most likely a bug in Forem. The migration ChangeEmailPreferenceDefaultValues does not pass static checks from strong_migrations gem.

The fix is rather simple. Go to config/application.rb and disable partial writes with

config.active_record.partial_inserts = false
Enter fullscreen mode Exit fullscreen mode

But it should be fixed in the code of Forem too, I think.

Collapse
 
nnm profile image
Antonio • Edited

Hi @katafrakt ! Thanks for the answer. But in the config github.com/forem/forem/blob/main/c... I didn't find this line:

config.active_record.partial_inserts = false
Enter fullscreen mode Exit fullscreen mode

Should I just add it?

Collapse
 
katafrakt profile image
Paweł Świątkowski

Yes. It should be safe to add.

Thread Thread
 
nnm profile image
Antonio • Edited

@katafrakt Pawel, I forgot which folder the Forem files are in?

drwxr-xr-x.  12 root root 4.0K Nov  6 15:50 .
drwxr-xr-x.  12 root root 4.0K Nov  6 15:50 ..
lrwxrwxrwx.   3 root root    7 Aug  1  2022 bin -> usr/bin
drwxr-xr-x.   8 root root 1.0K Nov  6 15:51 boot
drwxr-xr-x.  18 root root 3.7K Nov  6 15:51 dev
drwxr-xr-x.  86 root root 8.0K Nov  6 15:51 etc
lrwxrwxrwx.   3 root root    8 Aug  1  2022 home -> var/home
lrwxrwxrwx.   3 root root    7 Aug  1  2022 lib -> usr/lib
lrwxrwxrwx.   3 root root    9 Aug  1  2022 lib64 -> usr/lib64
lrwxrwxrwx.   3 root root    9 Aug  1  2022 media -> run/media
lrwxrwxrwx.   3 root root    7 Aug  1  2022 mnt -> var/mnt
lrwxrwxrwx.   3 root root    7 Aug  1  2022 opt -> var/opt
lrwxrwxrwx.   3 root root   14 Aug  1  2022 ostree -> sysroot/ostree
dr-xr-xr-x. 294 root root    0 Nov  6 15:51 proc
lrwxrwxrwx.   3 root root   12 Aug  1  2022 root -> var/roothome
drwxr-xr-x.  44 root root 1.2K Nov  6 15:51 run
lrwxrwxrwx.   3 root root    8 Aug  1  2022 sbin -> usr/sbin
lrwxrwxrwx.   3 root root    7 Aug  1  2022 srv -> var/srv
dr-xr-xr-x.  13 root root    0 Nov  6 15:51 sys
drwxr-xr-x.   4 root root   93 Aug  1  2022 sysroot
drwxrwxrwt.  13 root root  280 Nov  6 16:14 tmp
drwxr-xr-x.  12 root root  155 Jan  1  1970 usr
drwxr-xr-x.  24 root root 4.0K Nov  6 15:51 var
Enter fullscreen mode Exit fullscreen mode

Previously I was able to access Forem files by opening a Rails container, but now that container won't start. So I can't access the application.rb file.

After restarting with the command sudo systemctl restart forem.service, the container with Rails appears, but after a few seconds it immediately disappears.

CONTAINER ID  IMAGE                                    COMMAND               CREATED            STATUS            PORTS                                     NAMES
3c1a2cfe6062  localhost/podman-pause:5.2.4-1728259200                        About an hour ago  Up About an hour  0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp  7e844a8cd198-infra
0a8fa7b526dd  docker.io/darthsim/imgproxy:v2           imgproxy              About an hour ago  Up About an hour  0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp  forem-imgproxy
25ded131cf24  docker.io/library/postgres:11            postgres              About an hour ago  Up About an hour  0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp  forem-postgresql
555988dcc1f7  docker.io/library/redis:6.0.1            redis-server --ap...  About an hour ago  Up About an hour  0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp  forem-redis
f59ccd98756b  localhost/forem/forem:current            bootstrap             6 seconds ago      Up 5 seconds      0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp  forem-rails-bootstrap

Enter fullscreen mode Exit fullscreen mode
CONTAINER ID  IMAGE                                    COMMAND               CREATED            STATUS            PORTS                                     NAMES
3c1a2cfe6062  localhost/podman-pause:5.2.4-1728259200                        About an hour ago  Up About an hour  0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp  7e844a8cd198-infra
0a8fa7b526dd  docker.io/darthsim/imgproxy:v2           imgproxy              About an hour ago  Up About an hour  0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp  forem-imgproxy
25ded131cf24  docker.io/library/postgres:11            postgres              About an hour ago  Up About an hour  0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp  forem-postgresql
555988dcc1f7  docker.io/library/redis:6.0.1            redis-server --ap...  About an hour ago  Up About an hour  0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp  forem-redis

Enter fullscreen mode Exit fullscreen mode
Thread Thread
 
katafrakt profile image
Paweł Świątkowski

I'm not really familiar with this set up. If the container now dies, perhaps there's something wrong with the config file. Where did you add this line mentioned in the previous comment?

Thread Thread
 
nnm profile image
Antonio • Edited

I haven't added it anywhere yet. I wanted to add it to forem/config
/application.rb
, but as I already wrote, I can't open the Rails container to change the file. After installing Forem, this problem with Rails immediately appears :)

When starting Rails, it gives an error. The logs indicate this:

Nov 06 01:37:51 www.informland.com forem-rails-bootstrap[7552]: Disable partial writes in config/application.rb:
Nov 06 01:37:51 www.informland.com forem-rails-bootstrap[7552]:
Nov 06 01:37:51 www.informland.com forem-rails-bootstrap[7552]: config.active_record.partial_inserts = false
Nov 06 01:37:51 www.informland.com forem-rails-bootstrap[7552]:
Nov 06 01:37:51 www.informland.com forem-rails[7527]: rails aborted!
Nov 06 01:37:51 www.informland.com forem-rails[7527]: StandardError: An error has occurred, this and all later migrations canceled: (StandardError)
Nov 06 01:37:51 www.informland.com forem-rails[7527]: === Dangerous operation detected #strong_migrations ===
Nov 06 01:37:51 www.informland.com forem-rails[7527]: Partial writes are enabled, which can cause incorrect values
Nov 06 01:37:51 www.informland.com forem-rails[7527]: to be inserted when changing the default value of a column.
Nov 06 01:37:51 www.informland.com forem-rails[7527]: Disable partial writes in config/application.rb:
Nov 06 01:37:51 www.informland.com forem-rails[7527]: config.active_record.partial_inserts = false
Nov 06 01:37:51 www.informland.com forem-rails-bootstrap[7552]: /opt/apps/forem/db/migrate/20201019012200_change_email_preference_default_values.rb:3:in `change'
Nov 06 01:37:51 www.informland.com forem-rails-bootstrap[7552]: Tasks: TOP => db:prepare
Nov 06 01:37:51 www.informland.com forem-rails-bootstrap[7552]: (See full trace by running task with --trace)
Nov 06 01:37:51 www.informland.com forem-rails[7527]: /opt/apps/forem/db/migrate/20201019012200_change_email_preference_default_values.rb:3:in `change'
Nov 06 01:37:51 www.informland.com forem-rails[7527]: Tasks: TOP => db:prepare
Nov 06 01:37:51 www.informland.com forem-rails[7527]: (See full trace by running task with --trace)
Nov 06 01:37:51 www.informland.com forem-rails-bootstrap[7552]: I, [2024-11-06T01:37:50.024271 #23]  INFO -- ddtrace: [ddtrace] DATADOG CONFIGURATION - PROFILING - {"profiling_enabled">
Nov 06 01:37:51 www.informland.com forem-rails-bootstrap[7552]: I, [2024-11-06T01:37:50.031794 #23]  INFO -- ddtrace: [ddtrace] DATADOG CONFIGURATION - CORE - {"date":"2024-11-06T01:37>
Nov 06 01:37:51 www.informland.com forem-rails-bootstrap[7552]: I, [2024-11-06T01:37:50.788441 #23]  INFO -- honeybadger: ** [Honeybadger] Initializing Honeybadger Error Tracker for Ru>
Nov 06 01:37:51 www.informland.com forem-rails-bootstrap[7552]: I, [2024-11-06T01:37:51.795942 #23]  INFO -- : Migrating to ChangeEmailPreferenceDefaultValues (20201019012200)
Nov 06 01:37:51 www.informland.com forem-rails-bootstrap[7552]: == 20201019012200 ChangeEmailPreferenceDefaultValues: migrating ===============
Nov 06 01:37:51 www.informland.com forem-rails-bootstrap[7552]: E, [2024-11-06T01:37:51.813351 #23] ERROR -- honeybadger: ** [Honeybadger] Unable to send error report: API key is missi>
Nov 06 01:37:51 www.informland.com forem-rails[7527]: I, [2024-11-06T01:37:50.024271 #23]  INFO -- ddtrace: [ddtrace] DATADOG CONFIGURATION - PROFILING - {"profiling_enabled":false}
Nov 06 01:37:51 www.informland.com forem-rails[7527]: I, [2024-11-06T01:37:50.031794 #23]  INFO -- ddtrace: [ddtrace] DATADOG CONFIGURATION - CORE - {"date":"2024-11-06T01:37:50+00:00">
Nov 06 01:37:51 www.informland.com forem-rails[7527]: I, [2024-11-06T01:37:50.788441 #23]  INFO -- honeybadger: ** [Honeybadger] Initializing Honeybadger Error Tracker for Ruby. Ship i>
Nov 06 01:37:51 www.informland.com forem-rails[7527]: I, [2024-11-06T01:37:51.795942 #23]  INFO -- : Migrating to ChangeEmailPreferenceDefaultValues (20201019012200)
Nov 06 01:37:51 www.informland.com forem-rails[7527]: == 20201019012200 ChangeEmailPreferenceDefaultValues: migrating ===============
Nov 06 01:37:51 www.informland.com forem-rails[7527]: E, [2024-11-06T01:37:51.813351 #23] ERROR -- honeybadger: ** [Honeybadger] Unable to send error report: API key is missing. id=ed5>
Nov 06 01:37:51 www.informland.com conmon[7552]: conmon 707de065670f2dfb4e55 <nwarn>: Failed to open cgroups file: /sys/fs/cgroup/machine.slice/machine-libpod_pod_059e3778034af6e7ab375>
Nov 06 01:37:51 www.informland.com podman[7527]: 2024-11-06 01:37:51.897910895 +0000 UTC m=+15.670031717 container died 707de065670f2dfb4e553ddb1d080dd117372942c5abd1358a34a0e8f7a20648>
Nov 06 01:37:52 www.informland.com podman[7612]: 2024-11-06 01:37:52.111013065 +0000 UTC m=+0.197569767 container remove 707de065670f2dfb4e553ddb1d080dd117372942c5abd1358a34a0e8f7a2064>
Nov 06 01:37:52 www.informland.com podman[7612]: 2024-11-06 01:37:52.173605736 +0000 UTC m=+0.260162464 volume remove 9f13dadbb4943e27420eb3e47c3bbac716526ecaa896acd9606ef4a4ccde79fb
Nov 06 01:37:52 www.informland.com systemd[1]: forem-rails.service: Control process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ An ExecStartPre= process belonging to unit forem-rails.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 1.
Nov 06 01:37:52 www.informland.com systemd[1]: forem-rails.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ The unit forem-rails.service has entered the 'failed' state with result 'exit-code'.
Nov 06 01:37:52 www.informland.com systemd[1]: Failed to start forem-rails.service - Forem Rails Service.
░░ Subject: A start job for unit forem-rails.service has failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A start job for unit forem-rails.service has finished with a failure.
░░
░░ The job identifier is 13892 and the job result is failed.
Nov 06 01:37:52 www.informland.com systemd[1]: forem-rails.service: Consumed 1.551s CPU time.
░░ Subject: Resources consumed by unit runtime
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ The unit forem-rails.service completed and consumed the indicated resources.

Enter fullscreen mode Exit fullscreen mode
The unit forem-rails.service has entered the 'failed' state with result 'exit-code'.

Failed to start forem-rails.service - Forem Rails Service.
Enter fullscreen mode Exit fullscreen mode
Thread Thread
 
katafrakt profile image
Paweł Świątkowski

Could you share the instructions you are following with this? You should not change it inside the running container, rather somewhere in the code and rebuild the container. This needs to be changed by the time the container starts.

Thread Thread
 
nnm profile image
Antonio • Edited

Pawel, thank you very much for your help! I haven't encountered this yet. If you have time, could you tell me how to rebuild and upload the container to the server?

I can thank you with PayPal :)

Thread Thread
 
katafrakt profile image
Paweł Świątkowski

I assume you are using this github.com/forem/selfhost, right? Unfortunately from what I see this uses some pre-built docker image and I don't know Ansible to know how you can replace it with your own.

Thread Thread
 
nnm profile image
Antonio

True. I don't know either. I'll have to study.