Finishing Galley

Tagged: elixir

Well hello there,

Today I'm delighted to say that I've deployed Galleyº, making it the first project of my "4-projects-a-year" that has been completed (and with 2 weeks to spare). In this post, I'll write about why I think I was able to complete this project, and about deployment. Let's start with the latter.

Deployment on Fly.io.

I have been seeing fly.io show up in a few online posts, on hackernews, etc for about a month or two. The CTA/tagline of Fly is:

Deploy App Servers Close to Your Users

Run your full stack apps (and databases!) all over the world. No ops required.

The above is right there on their home page (and I must mention that their home page loads so quickly is seems like it's on localhost.)

Fly also seems gung-ho in support of Phoenix + Elixir (the creator of Phoenix works there, I believe). Deployment was easy. I ran into issues with my project because I had switched from postgres to sqlite, but had not properly updated the "config" in phoenix for what ecto was expecting (instead):

   config :galley, Galley.Repo,
     # ssl: true,
-    url: database_url,
+    database: database_url,
     pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"),
     socket_options: maybe_ipv6

Here's a git diff of the mistake I had to hunt around for a while - I had simply misconfigured the ecto repo - when using sqlite you need to have a database key - not a url key!

I had missed the above, while following this gist, which was very helpful. But! I'm not here to talk about switching to sqlite - I already covered thatº in some detail.

There isn't much more to say about Fly. I followed their quickstart guide, created an application, created a volume, and then after fixing the sqlite stuff, deployed the application. After that, as expected, several things weren't working in production that were locally (all secret and api related things - s3, sendgrid etc).

Now things are running! I'm excited. While the tasks are done, I have just a few remaining things to do:

  • update the user table to create a "roles" column for types of users (admin, contributor, read-only) (done!)

  • write a function I can run from the iEx shell to "promote" users to a role. (done!)

  • write a function that can generate user accounts from the ssh console shell so that I can create friends and family an account (registration is indefinitely closed; Galley is invite-only). (done!)

  • make myself an admin so I can do admin-y things: (done!)

    • make the sqlite database exportable from the web app in case something goes wrong. (done!)

  • add some recipes! I might write a script that converts all the recipes in Ari's Gardenº to Galley, which shouldn't be too hard, since ari's just uses a giant json file (although, I will have to write some kind of parser to remove the syntax I used to describe steps in a recipe.)

I worked pretty hard on adding all the recipes to aris garden, so I feel that I should put in the work to automate moving all of them to Galley. It will probably take a little while, but there are some 50 to 60~ recipes there.

Getting things done

Well, maybe I'm not exactly done since I have the list of things to do. But right now, I can use Galley on the web and not my local computer. I have a big list of "someday" things to do - but these things were not in my original MVP for the 3 months I had to work on this.

Getting the project "done" feels good. After Visitorº not getting done I felt a little weird about this whole endeavour ( I still do in many ways ). But - this whole thing is an experiment to learn about how I want to execute on projects, goals and daydreams (as well as to try new things this year).

So, did anything make Galley different from Visitor that I was able to get Galley done? The most obvious is that Galley is a web project and Visitor is a game. I write code for the web all day during my day job. Even though I had to re-acquaint with Elixir, I had used it before and it's not dissimilar to clojure. Phoenix handles so much for you - authentication, setting up your router, database, migrations... it's amazing.

Visitor is a game - I haven't built many games - I've never even built a complete one. I don't work on games during the workday and I don't use GDscript or godot very often. Visitor is also a multidisciplinary project that involves drawing, writing and (soon enough) music. Perhaps it's a little obvious why one got done in three months and the other didn'tº.

With that said, from time to time working on Galley I questioned why I was doing something that felt a bit too similar to work. Visitor has elements removed from coding, which was exciting: storyboarding, drawing, etc. That's an important takeaway!

I also consider visitor to be an artistic project, and Galley to be a utility. The former is expression, personal, and inherently political. The latter is intended to simply be useful and to make life easier. Two very different things.

That's all I have to reflect on at this point. I think I will probably use the next two weeks to wrap up the admin tasks on Galley, and get back to Visitor.

If you made it to the end of this post, thanks for reading!

o/

WT