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

Buying an album #2

Closed
wants to merge 17 commits into from
Closed

Buying an album #2

wants to merge 17 commits into from

Conversation

chrislo
Copy link
Member

@chrislo chrislo commented Aug 17, 2023

No description provided.

We'll use FactoryBot instead of fixtures.
I'd like to use friendly URLs for artists and albums, so that they are
more search engine friendly and shareable. For example:

    https://jam.coop/albums/the-white-album

Rather than

    https://jam.coop/albums/1

I've added the `friendly_id` gem[1] to achieve this. I removed the
CreateFriendlyIdSlugs migration that was added as part of the
installation for now - this allows slug histories to be versioned if,
for example, the album title changes. Since we don't have any
interface for changing the title yet, I haven't included this
additional complexity.

[1] https://github.com/norman/friendly_id
I had to provide a default artist_id in the migration to add artist_id
to albums to keep rubocop happy, since I used `null: false`. We don't
currently have any data in the production database, so it seems fine
to provide a default id.
We don't want two artists to have the same slug, but it's ok for two
different artists to have albums with the same title (and therefore
the same slug).
I followed the ActiveStorage setup as per the
documentaion[1]. Currently only a local storage option is configured
but I'll add S3 soon.

The tests seem to pass fine in the github action but before installing
libvips I saw

    /home/runner/work/music-coop/music-coop/vendor/bundle/ruby/3.2.0/gems/ruby-vips-2.1.4/lib/vips.rb:51:
    warning: already initialized constant GLib::G_FREE

which I also saw locally, so I've ensured that this library is
installed in CI and added installation instructions to the README.

[1] https://edgeguides.rubyonrails.org/active_storage_overview.html
I've created two S3 buckets under the GFR account
`jam-coop-images-development` and `jam-coop-images-production`. I
created two AWS users with API key-only access `jam-coop-development`
and `jam-coop-production`. The access key and secret for both those
users have been added to development.yml.enc and production.yml.enc.

The development user can be used to test things out in the development
environment by setting `config.active_storage.service` to `:amazon`.
This didn't work for me at first, I was seeing

    __NSCFConstantString initialize] may have been in progress in another thread when fork() was called

in the server log on my (M2) mac. I had to set

    export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES

in my .zshrc and restart the server[1].

[1] https://dev.to/wusher/active-storage-variants-failing-locally-1glm
I've created new buckets in S3 to match this rename. I considered
storing images separately from other objects (such as audio files) but
I'm not sure we need that extra complexity at the moment. A single
bucket for each environment should work for now.
@chrislo chrislo closed this Aug 21, 2023
@chrislo chrislo deleted the buying-an-album branch August 21, 2023 22:56
chrislo added a commit that referenced this pull request Dec 15, 2023
I've updated the previous newsletter text. We should be able to send
this with:

    Interest.where(email_confirmed: true).each do |user|
      BroadcastMailer.newsletter(user).deliver_now
    end
chrislo added a commit that referenced this pull request Dec 15, 2023
I sent a test copy to myself and spotted a few fixes (subject line,
punctuation and some incorrect markup).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant