Help porting Loomio to Sandstorm
Hello. For the past several days, I've been working on a port of Loomio to the Sandstorm app platform. I think it's going well, and my hope is to have v0.15.0 on the Sandstorm app market sometime this week or next. I'd also like to push the Sandstorm-specific changes upstream for inclusion into Loomio if possible. I built a function that determines whether Loomio is running as a Sandstorm grain, and am selectively disabling/tweaking functionality when that variable is set.
But I'm encountering an odd issue, and I can't seem to find anything in the tech manual. When I delete the initial discussion from new groups, the discussion vanishes but the "plan a trip to the moon" proposal sticks around. When I click on it, I get a "not found" page.
Digging through the code, I see that @discussion.delayed.destroy
is called. This leads me to believe that I need to start scripts/delayed_job
, but I see nothing about this in the manual. Also, starting it doesn't seem to make the proposal vanish either, so I'm wondering if perhaps it's crashing and not logging its failure on stdout. That's something I'll be investigating next.
But do I in fact need to start scripts/delayed_job
, and if so, is there any setup work I need to do first? (I.e. initializing the delayed_job database tables)
I haven't done Rails in quite a while. Can delayed_job periodically run tasks like the automatic closing of proposals? Since the app isn't constantly running, cron isn't an option. Having the tasks run immediately on startup and every 15 minutes or so would be acceptable.
Thanks.

Steve Phillips / @elimisteve Wed 3 Feb 2016 9:27PM
From https://docs.sandstorm.io/en/latest/developing/handbook/ --
The platform is in alpha, so this document is likely to change. We will keep old versions of this document online, and we hope that you will watch this document over time to update your app as the platform updates. There will eventually be API deprecations and backwards-incompatible breakage, though we aim to keep that to a minimum.
Nolan Darilek Thu 4 Feb 2016 2:07AM
Sorry, my gitbucket instance isn't happy so I'll just host this on Github. Here it is:
https://github.com/ndarilek/loomio-sandstorm
Note that Loomio is pulled in via a submodule so you'll need to use --recursive on clone or initialize submodules after.
I definitely want to see this happen but feel like I've bitten off more than I can chew. So any help with this would be greatly appreciated, and I can handle publication to the Sandstorm app market for the time being. This work is based on 0.18. Here are some general notes/challenges:
- Regarding the current PATCH issue, it's been nearly a decade since I used Rails. At the time I recall it having a hack where a
method
query parameter translated into the HTTP method, so https://my.app/api/endpoint?method=PATCH looked like a PATCH even if the real method was GET. Does this still exist, and if so, would anyone mind appending the magic query parameter to all PATCH requests until the issue is fixed on Sandstorm's end? I tried googling for this but couldn't find it, maybe the behavior was dropped or is packaged in a gem. - Loomio knows it is running in Sandstorm because the
SANDSTORM
environment variable is set (value doesn't matter.) I've added a bunch of server-side checks for this variable, have bridged it into the Angular controllers, and have attempted to modify the interface accordingly. - Sandstorm doesn't support sending emails--Loomio doesn't get a user's email address at all, if in fact one is even registered. Likewise, Sandstorm provides usernames, avatars, etc. I'm disabling portions of the interface in Sandstorm if they don't make sense. For instance, you can't set an email address or upload an avatar. You can't delete your account. Likewise, I disabled group/thread volume settings that imply you'll receive emails. We'll need to disable any portions of the interface that don't make sense, based on the presence of the
SANDSTORM
environment variable. - It looks like some Loomio functionality is only available in the admin interface. We'll need to insert a link to /admin somewhere in the UI, because it's a bit difficult to create this link yourself based on the random Sandstorm subdomain for the instance (which is only opened in an iframe and not in the address bar.) I'm not sure where this link would look best. I added it to the older interface but not to the new Angular one.
- Likewise, it doesn't make sense to log out of a Sandstorm-hosted Loomio. Instead, you'd log out of Sandstorm itself. I think I disabled the logout link but who knows what may have changed since 0.18. :)
- Another random challenge I face is that I'm blind, so there are some aspects of this port that I can't verify. For instance, Sandstorm hosts its own user avatars so users can use the same ones across multiple apps, segment them into different identities, etc. I think I've tweaked Loomio to present Sandstorm's avatar URLs instead of its own but can't be sure. Likewise, I hope it is serving up stylesheets, group cover photos, etc. OK but I can't be sure. I think there were some issues uploading group photos that I never resolved, but again I can't test whether uploading group photos works even if I did have the functionality working so it hasn't been a priority for me. :) This is why I'm asking about placement of admin links, because your interface is complex enough that I'm not sure where they would look best.
When I left this I verified basic group create/edit/post functionality, but Loomio is a big app, I'm not too familiar with it, and I'm at a point where I don't want to base my co-op/business/whatever I'm building administrative infrastructure on something that can't run in Sandstorm so my first objective was to get Loomio running in it. Didn't realize how big this task would be. :) Most apps have a smaller scope and are fairly easy to assess, but Loomio is pretty large, and I'd appreciate help finishing this port off and testing functionality you'd expect to work. Happy to answer any Sandstorm-specific questions and accept PRs, or even grant write access to the repo. I don't need to own this, I just want to see it finished. :) I'd also appreciate help cleaning up the commit history if that is a requirement to merge the Sandstorm-specific Loomio changes upstream. This port has touched a lot of files, and I figured a few larger commits were easier to work with than a bunch of microcommits that couldn't individually add much value on their own. But admittedly toward the end I went a bit crazy and just wanted to
Nolan Darilek Thu 4 Feb 2016 2:08AM
...save my progress. Apologies, last comment got cut off awkwardly. :)
James Kiesel Thu 4 Feb 2016 4:05AM
This is a great help, thanks Nolan!
Richard D. Bartlett Thu 4 Feb 2016 4:13AM
@nolandarilek thanks so much for the awesome handover. I wonder if your bullet points should be issues in Github, either on loomio/loomio, or on your new repo - what do you think?
And @jameskiesel - would you be up for becoming a maintainer on that repo?
Incidentally, we've been doing some work to make Loomio work well for people who are blind. If you're interested to share your experiences so we can continue to improve the interface, we'd love to have you in the Accessibility group.
Thanks again! I'm so excited about the positive social impact this work is going to have once it's ready for production :)
Nolan Darilek Thu 4 Feb 2016 2:11PM
Yeah, I'd actually jumped on Loomio right about when your accessibility changes were landing and was/continue to be impressed. That's part of why I really want to see this Sandstorm port finished. :) Thanks for the accessibility link, I just now hit an issue attempting to skim this thread so I'll mention it there.
James Kiesel Thu 4 Feb 2016 4:16AM
Cool. So I think this is very much a plugin-able type bit of functionality, which is cool because it means that if you want to run an instance on Sandstorm, you'll be able to do it by adding a single line in a configuration file, and if not, you don't have to worry about it.
I'm knee-and-wrist deep in plugin territory now, but give me a little time (a week, two, something like that) to mature it a little bit and we'll see what we can do from there.

Josef Davies-Coates Thu 4 Feb 2016 10:20PM
Great to witness this work unfolding, and looking forward to eating the fruits :)
Thank you @nolandarilek @jameskiesel @richarddbartlett
Nolan Darilek Fri 12 Feb 2016 3:07PM
Just an update:
PATCH support on Sandstorm has shipped, so that's no longer an issue. Thanks to folks for +1ing that. :)
We're now dealing with this:
https://github.com/sandstorm-io/sandstorm/issues/1489
which is a new development since I left off last November, and appears to be caused by issues with the Sandstorm Vagrant development box. Hoping that gets resolved soon.
Gauthier Guerin Tue 2 May 2017 6:50AM
Hello,
I was wondering if anyone had followed up on this and whether people think the port is possible now that sandstorm is more mature. Unfortunately I am not a developer so can't help on technical side but I use both sandstorm and loomio so more that happy to to testing.

Felipe Cavalcanti Sat 9 Sep 2017 3:16PM
@nolandarilek I´d like to talk to you in private. Can you get in touch through cavalcanti.fiocruz@gmail.com? tks

Jagan Mohan Thu 10 May 2018 5:14AM
This is just a bump up to see if there has been any updates to the project. Loomio on Sandstorm would be just fantastic. Hope interest in this project has not waned.

Robert Guthrie Thu 10 May 2018 5:50AM
We at Loomio have not heard anything about Loomio+Sandstorm since this thread. In the meantime our Docker based deploy system has been significantly improved though
edit: corrected the link
James Kiesel · Thu 4 Feb 2016 1:50AM
Yes, it seems totally understandable to me that Nolan's at the end of his rope when it comes to doing Loomio customization; Loomio has been decidedly not easy to extend up until this point. That will change drastically this year.