I started a new position knowing there were some problems with the codebase. After a month the owner of the company and I have both come to the conclusion we need to rewrite the project. My first choice would be Crystal.
There are some libraries we need immediately that too be honest are just not well supported or do not exist in crystal. But I can get around the near term problems.
I wanted to hear from the community. What is the current state on production support and operations?
I need a suite of operations tools that integrate into a web framework. Mostly:
Metrics
APM
Logging
Incident response
Also it would be nice to know if there are any glaring holes in the ecosystem. It seems like AWS support is still lacking.
Anyways let me know your thoughts on the current state of Crystal in a production environment.
Depending on what kind of application you’re making is, Athena could also be a good choice . I’d be happy to answer any questions etc if needed as well.
Not directly within its ecosystem. But would be able to use whichever (if any) you wanted. E.g. Jennifer, Granite, Clear, etc.
Alternatively, I found just using DB::Serializable - db 0.11.0 works quite well. Is easy enough to add some helper methods to leverage more of the repository pattern so you only have to really write the SQL once when/if you need a new repo method. You also have to handle inserts yourself, but similarly can exact that to some helper type(s).
I’m still planning on getting an updated version of a example demo application available to serve as reference, based on the blog application from the book. It’s a somewhat naive implementation to keep the book length down, but can serve as a good starting point. Tl;dr being:
Article - The primary entity (model) of the application. Includes some modules to make it be JSON (de)serializable, serializable from the DB, and validatable. Depending on the complexity of your application it may serve better to have a dedicated object to represent the request/response bodies versus coupling that with your DB entity. The entity also has some protected methods that act as simple DB hooks, these could be extracted into a base type/module for better reusability.
Article::Repository - Contains all methods used to query for articles. Similar to the entity itself, common query methods like #find, #find?,#find_all, and #find_by could be implemented in an abstract repo type with generic as the as argument.
EntityManager - Primary type used to interact with the DB from your business logic. Contains public methods to create/update a record, as well as to delete them. Also contains a method to get an Article::Repository instance cached in a class var. Could use a macro to auto-generate these for all entity types. Lastly this type contains the raw SQL used as part of the creation/updating process, which should return the PK of that entity to properly set its #id value. Could maybe do something again with macros to auto generate two methods, one for the column names, and another for column values (all based on ivar names or something).
ArticleController - Example of how the entity manager can be used along with the EntityManager. This is for an older version of Athena, the ParamConverter concept changed, so syntax is not 100% what it would be in the latest version. This controller also makes use of a custom converter that provides the record from the DB in addition to the one deserialized from the request payload. Mainly useful for PUT requests, (and maybe PATCH?).
I had not considered using DB::Serializable but that is a great idea. I think this is actually a really good idea. The hard part is getting from 0 to 1. Getting a fast initial iteration for CRUD and everything is hard. It would be an interesting project to have something scaffold up an initial web application.
It’s still a WIP, but can checkout GitHub - athena-framework/demo at develop. Still need to add an example of auth, update the README.md files, and add some more tests but it should give you the gist of my previous reply and/or serve as an alternate starting point versus the skeleton repository.