Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Less Fat Luke
May 23, 2003

Exciting Lemon

Sil posted:

My account is still eligible for AWS free tier offerings so that's why I'm playing with those while I learn vagrant/chef.

Is RDS worth using Amazon for when I want a dedicated DB server? I'm guessing it's equivalently easy to hookup a DO droplet or an EC2 instance to an RDS instance. There's just so much stuff on AWS. My current plan is Digital Ocean for the app RDS/same DO instance for the DB and S3 for storage space.
RDS is pretty cool if you use the automated multi-zone failover feature. That unfortunately though usually makes it expensive, so how much that's worth is up to you! You can definitely just roll your own MySQL install on an EC2 instance as well; the advantage with the RDS instance is that seamless failover in EC2 by yourself is pretty much impossible to do safely and in an automated fashion since you only control one network channel between hosts and can easily get into a split brain situation.

TL;DR if you're just learning and have free credit go for the smallest RDS with no failover and try it out.

Adbot
ADBOT LOVES YOU

Less Fat Luke
May 23, 2003

Exciting Lemon
Don't worry, you can build a gigantic lovely codebase that becomes legacy in any language!

To be serious though Clojure is pretty cool; a lot of Ruby developers seem to gravitate towards it.

Less Fat Luke
May 23, 2003

Exciting Lemon

duck monster posted:

Are there any decent alternatives to active record that implement a proper data mapping pattern and play nice with the ecosystem.

I'm fairly new to rails (Coming from a django background, new jobs uses rails), but was completely dumbstruck that active record doesnt create database constrains on relationships, and the dude who wrote them apparently doesnt believe in them. Thats a pretty bad sign in my books, so whats the alternatives?
Rails now has foreign key constraints as of 4.2:
http://edgeguides.rubyonrails.org/active_record_migrations.html#active-record-and-referential-integrity

Prior to that anyone who really wanted them was (and still probably are) using a pair of gems named immigrant and foreigner.

That being said you could use DataMapper as mentioned or Sequel I guess. Honestly I've worked with a lot of fairly large Rails apps with and without constraints and it's not nearly as bad as I thought it'd be (I had the same hesitations as you do).

Less Fat Luke
May 23, 2003

Exciting Lemon

prom candy posted:

What are the best tools for doing this? I tried to get something going with capybara but it didn't seem like it was built to test JSON responses.
Using minitest it's pretty straightforward. Start with inheriting from ActionDispatch::IntegrationTest and do something like:
code:
class TestMyShit < ActionDispatch::IntegrationTest
  test 'check a response' do
    post '/rest.json', { param: :value }, { header: :value }
    assert_response :success
    parsed_response = JSON.parse(response.body)
    
    expected_data = { just: :a, big: :old, hash: :representing, the: :response }
    assert_equal expected_data, parsed_response
  end
end
You can get fancy and save the resultant JSON somewhere, configure your auth or data fixtures in the setup, etc. But that's the general pattern I've seen. Some tests go all fine grained and do like:
code:
assert_equal parsed_response[:key][:key2], value

Less Fat Luke
May 23, 2003

Exciting Lemon

Pollyanna posted:

Interesting. Good to know...Single Table Inheritance comes up a lot in interviews in my experience. That's potentially worrisome. Maybe I don't want to use it.
It's definitely the bastard child of Rails, most places recognize it as really gross in retrospect.

Edit: Well, one of many Rails bastard children

Less Fat Luke
May 23, 2003

Exciting Lemon
If both the UI and backend are still Rails apps (which it sounds like) you can split out the models into a separate gem, Rails engine or even a git submodule. It's kind of annoying but I've worked in environments where the models were shared via a private gem and it's doable.

Less Fat Luke
May 23, 2003

Exciting Lemon
And your apps commit histories will be forever poo poo up with `bumped model gem` messages :)

Adbot
ADBOT LOVES YOU

Less Fat Luke
May 23, 2003

Exciting Lemon
Nice, I used to work there. I remember arguing with the CTO in my last few months because he was insisting we would never use "microservices" and I showed him my dev environment with not only the core monolith but like 18 other services necessary for the feature I was working on (money related which made it far worse); he was kinda furious about how everyone stealthed into services but like holy poo poo that monolith was brutal to work with in the pre-Spin days.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply