Bookmarks

Bookmarks

50554 bookmarks
Custom sorting
Shikiji
Shikiji
A beautiful and powerful syntax highlighter
·shikiji.netlify.app·
Shikiji
HerokuからCloud Run + Litestreamへ移行した - memo.yammer.jp
HerokuからCloud Run + Litestreamへ移行した - memo.yammer.jp
はじめに Herokuの無料枠が終了することにあわせて、個人で動かしているRailsアプリケーションを他の場所へ移行する。 いままで無料で使わせていただいたこと感謝しつつも、月千円ほど払うほどのアプリケーションでもないので、ほぼ無料で移行できそうな場所を探すことにした。1 コンテナをホスティングできるGoogle Cloud Runは従量課金制だが、個人で使う分にはほぼ無料なので、これを選ぶことにする。 Cloud Runで使うRDBは一般にはGoogle Cloud SQLが推奨されていそうだが、ここでは安さのためにSQLite3 + Litestream + Google Cloud St
·memo.yammer.jp·
HerokuからCloud Run + Litestreamへ移行した - memo.yammer.jp
Tech stack for my email courses project
Tech stack for my email courses project
Efficient email courses tech stack: Ruby, Rails, SQLite, litestack, Avo, Tailwind, ERBs, Phlex, Minitest, Sitepress, Debug, Propshaft, Hotwire, direnv...
·allaboutcoding.ghinda.com·
Tech stack for my email courses project
Brand-new Rails 7 apps exceed Heroku’s memory quotas | justin․searls․co
Brand-new Rails 7 apps exceed Heroku’s memory quotas | justin․searls․co
Update: Judging by this commit and the current status of main, this should be fixed for Rails 8. Great PR thread about this, by the way. In the history of Ruby on Rails, one of the healthiest pressures to keep memory usage down has been the special role Heroku has played as "easiest place to get started hosting Rails apps". In general, Rails Core and Heroku's staff have done a pretty good job of balancing the eternal tension between advancing the framework while still making sure a new app can comfortably run on Heroku's free (or now, cheap) "dyno" servers over the last 17(!) years. Being able to git push an app to a server and have everything "just work" has always been a major driver of Rails' adoption, and it's seen as obviously important to everyone involved that such a low-friction deployment experience—even if developers ultimately move their app elsewhere—is worth preserving. And that means being cognizant of resource consumption at every level in the stack. Anyway, there have been numerous bumps in the road along the way, and I think I just hit one. I just pushed what basically amounts to a vanilla Rails 7.1.3 app to Heroku and immediately saw this familiar error everywhere in my logs: Error R14 (Memory quota exceeded) It started literally minutes after deploying the app. The app was taking up about 520MB. What gives? I even remembered to avoid loading Rails' most memory-hungry component, Active Mailbox!
·justin.searls.co·
Brand-new Rails 7 apps exceed Heroku’s memory quotas | justin․searls․co
Announcing RBS support for AWS SDK for Ruby V3 | AWS Developer Tools Blog
Announcing RBS support for AWS SDK for Ruby V3 | AWS Developer Tools Blog
RBS is a language to describe the structure of Ruby programs. We are happy to announce that AWS SDK for Ruby V3 now supports RBS type signatures! RBS support is released in aws-sdk-core version 3.191.0 and in every service gem (such as aws-sdk-s3) that depends on this version of core. RBS signatures are currently code […]
·aws.amazon.com·
Announcing RBS support for AWS SDK for Ruby V3 | AWS Developer Tools Blog
A Packwerk Retrospective | Rails at Scale
A Packwerk Retrospective | Rails at Scale
In September, 2020, our team at Shopify released a Ruby gem named Packwerk, a tool to enforce boundaries and modularize Rails applications. Since its release, Packwerk has taken on a life of its own, inspiring blog posts, conference talks, and even an entire gem ecosystem. Its popularity is an indication that Packwerk clearly filled a void in the Rails community.
·railsatscale.com·
A Packwerk Retrospective | Rails at Scale
Ruby's Exceptional Creatures
Ruby's Exceptional Creatures
Exceptional Creatures is Honeybadger.io's documentation of Ruby's exception system, with a twist. Collect them all!
·exceptionalcreatures.com·
Ruby's Exceptional Creatures
Composite primary keys in Rails - Honeybadger Developer Blog
Composite primary keys in Rails - Honeybadger Developer Blog
There are scenarios where a combination of columns needs to be used as the primary key. This is where composite primary keys come into play. This article explores composite primary keys, how they work in Rails, when they should be used, and what to consider when using them.
·honeybadger.io·
Composite primary keys in Rails - Honeybadger Developer Blog
Self-hosted observability stack for Ruby on Rails apps | Michal Kazmierczak
Self-hosted observability stack for Ruby on Rails apps | Michal Kazmierczak
Observability is becoming a standard. Cloud observability providers deliver a high-end solutions for the storage and visualization of the telemetry data. Yet, application owners may consider an entirely in-house approach. Here is how you can achieve it for a Ruby on Rails app.
·mkaz.me·
Self-hosted observability stack for Ruby on Rails apps | Michal Kazmierczak
Exploring Campfire | Drifting Ruby
Exploring Campfire | Drifting Ruby
In this episode, we explore the Campfire code from 37signals' Once product line. We'll install the product and grab the code base to get it up and running on our development environment.
·driftingruby.com·
Exploring Campfire | Drifting Ruby
Hatchbox.io
Hatchbox.io
Ruby on Rails hosting made simple for small businesses. Deploy apps to servers that you own and control while you focus on building great apps.
·hatchbox.io·
Hatchbox.io
FerretDB
FerretDB
A truly Open Source MongoDB alternative, built on Postgres FerretDB allows you to use MongoDB drivers seamlessly with PostgreSQL as the database backend. Use all tools, drivers, UIs, and the same query language and stay open-source.
·ferretdb.com·
FerretDB
Multi-Database Support in DuckDB - DuckDB
Multi-Database Support in DuckDB - DuckDB
TL;DR: DuckDB can attach SQLite, Postgres and MySQL databases in addition to databases stored in its own format. This allows data to be read into DuckDB and moved between these systems in a convenient manner. In modern data analysis, data must often be combined from a wide variety of different sources. Data might sit in CSV files on your machine, in Parquet files in a data lake, or in an operational database. DuckDB has strong support for moving data between many different data sources. However, this support has previously been limited to reading data and writing data to files. DuckDB supports advanced operations on its own native storage format – such as deleting rows, updating values, or altering the schema of a table. It supports all of these operations using ACID semantics. This guarantees that your database is always left in a sane state – operations are atomic and do not partially complete. DuckDB now has a pluggable storage and transactional layer. This flexible layer allows new storage back-ends to be created by DuckDB extensions. These storage back-ends can support all database operations in the same way that DuckDB supports them, including inserting data and even modifying schemas. The SQLite, Postgres and MySQL extensions implement this new pluggable storage and transactional layer, allowing DuckDB to connect to those systems and operate on them in the same way that it operates on its own native storage engine. These extensions enable a number of useful features. For example, using these extensions you can: Export data from SQLite to JSON Read data from Parquet into Postgres Move data from MySQL to Postgres … and much more. Attaching Databases The ATTACH statement can be used to attach a new database to the system. By default, a native DuckDB file will be attached. The TYPE parameter can be used to specify a different storage type. Alternatively, the {type}: prefix can be used. For example, using the SQLite extension, we can open a SQLite database file and query it as we would query a DuckDB database. ATTACH 'sakila.db' AS sakila (TYPE sqlite); SELECT title, release_year, length FROM sakila.film LIMIT 5; ┌──────────────────┬──────────────┬────────┐ │ title │ release_year │ length │ │ varchar │ varchar │ int64 │ ├──────────────────┼──────────────┼────────┤ │ ACADEMY DINOSAUR │ 2006 │ 86 │ │ ACE GOLDFINGER │ 2006 │ 48 │ │ ADAPTATION HOLES │ 2006 │ 50 │ │ AFFAIR PREJUDICE │ 2006 │ 117 │ │ AFRICAN EGG │ 2006 │ 130 │ └──────────────────┴──────────────┴────────┘ The USE command switches the main database. USE sakila; SELECT first_name, last_name FROM actor LIMIT 5; ┌────────────┬──────────────┐ │ first_name │ last_name │ │ varchar │ varchar │ ├────────────┼──────────────┤ │ PENELOPE │ GUINESS │ │ NICK │ WAHLBERG │ │ ED │ CHASE │ │ JENNIFER │ DAVIS │ │ JOHNNY │ LOLLOBRIGIDA │ └────────────┴──────────────┘ The SQLite database can be manipulated as if it were a native DuckDB database. For example, we can create a new table, populate it with values from a Parquet file, delete a few rows from the table and alter the schema of the table. CREATE TABLE lineitem AS FROM 'lineitem.parquet' LIMIT 1000; DELETE FROM lineitem WHERE l_returnflag = 'N'; ALTER TABLE lineitem DROP COLUMN l_comment; The duckdb_databases table contains a list of all attached databases and their types. SELECT database_name, path, type FROM duckdb_databases; ┌───────────────┬───────────┬─────────┐ │ database_name │ path │ type │ │ varchar │ varchar │ varchar │ ├───────────────┼───────────┼─────────┤ │ sakila │ sakila.db │ sqlite │ │ memory │ NULL │ duckdb │ └───────────────┴───────────┴─────────┘ Mix and Match While attaching to different database types is useful – it becomes even more powerful when used in combination. For example, we can attach both a SQLite, MySQL and a Postgres database. ATTACH 'sqlite:sakila.db' AS sqlite; ATTACH 'postgres:dbname=postgresscanner' AS postgres; ATTACH 'mysql:user=root database=mysqlscanner' AS mysql; Now we can move data between these attached databases and query them together. Let’s copy the film table to MySQL, and the actor table to Postgres: CREATE TABLE mysql.film AS FROM sqlite.film; CREATE TABLE postgres.actor AS FROM sqlite.actor; We can now join tables from these three attached databases together. Let’s find all of the actors that starred in Ace Goldfinger. SELECT first_name, last_name FROM mysql.film JOIN sqlite.film_actor ON (film.film_id = film_actor.film_id) JOIN postgres.actor ON (actor.actor_id = film_actor.actor_id) WHERE title = 'ACE GOLDFINGER'; ┌────────────┬───────────┐ │ first_name │ last_name │ │ varchar │ varchar │ ├────────────┼───────────┤ │ BOB │ FAWCETT │ │ MINNIE │ ZELLWEGER │ │ SEAN │ GUINESS │ │ CHRIS │ DEPP │ └────────────┴───────────┘ Running EXPLAIN on the query shows how the data from the different engines is combined into the final query result. ┌───────────────────────────┐ │ PROJECTION │ │ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │ │ first_name │ │ last_name │ └─────────────┬─────────────┘ ┌─────────────┴─────────────┐ │ HASH_JOIN │ │ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │ │ INNER │ │ film_id = film_id ├───────────────────────────────────────────┐ └─────────────┬─────────────┘ │ ┌─────────────┴─────────────┐ ┌─────────────┴─────────────┐ │ HASH_JOIN │ │ FILTER │ │ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │ │ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │ │ INNER │ │ (title = 'ACE GOLDFINGER')│ │ actor_id = actor_id ├──────────────┐ │ │ └─────────────┬─────────────┘ │ └─────────────┬─────────────┘ ┌─────────────┴─────────────┐┌─────────────┴─────────────┐┌─────────────┴─────────────┐ │ SQLITE_SCAN ││ POSTGRES_SCAN ││ MYSQL_SCAN │ │ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ││ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ││ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │ │ sakila.db:film_actor ││ actor ││ film │ │ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ││ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ││ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │ │ film_id ││ actor_id ││ film_id │ │ actor_id ││ first_name ││ title │ │ ││ last_name ││ │ └───────────────────────────┘└───────────────────────────┘└───────────────────────────┘ Several changes have been made to Postgres extension since the last release. Use FORCE INSTALL postgres to install the latest version of the extension. Transactions All statements executed within DuckDB are executed within a transaction. If an explicit BEGIN TRANSACTION is not called, every statement will execute in its own transaction. This also applies to queries that are executed over other storage engines. These storage engines also support explicit BEGIN, COMMIT and ROLLBACK statements. For example, we can begin a transaction within our attached SQLite database, make a change, and then roll it back. The original data will be restored. BEGIN; TRUNCATE film; SELECT title, release_year, length FROM film; ┌─────────┬──────────────┬────────┐ │ title │ release_year │ length │ │ varchar │ varchar │ int64 │ ├─────────────────────────────────┤ │ 0 rows │ └─────────────────────────────────┘ ROLLBACK; SELECT title, release_year, length FROM film LIMIT 5; ┌──────────────────┬──────────────┬────────┐ │ title │ release_year │ length │ │ varchar │ varchar │ int64 │ ├──────────────────┼──────────────┼────────┤ │ ACADEMY DINOSAUR │ 2006 │ 86 │ │ ACE GOLDFINGER │ 2006 │ 48 │ │ ADAPTATION HOLES │ 2006 │ 50 │ │ AFFAIR PREJUDICE │ 2006 │ 117 │ │ AFRICAN EGG │ 2006 │ 130 │ └──────────────────┴──────────────┴────────┘ Multi-Database Transactions Every storage engine has their own transactions that are stand-alone and managed by the storage engine itself. Opening a transaction in Postgres, for example, calls BEGIN TRANSACTION in the Postgres client. The transaction is managed by Postgres itself. Similarly, when the transaction is committed or rolled back, the storage engine handles this by itself. Transactions are used both for reading and for writing data. For reading data, they are used to provide a consistent snapshot of the database. For writing, they are used to ensure all data in a transaction is packed together and written at the same time. When executing a transaction that involves multiple attached databases we need to open multiple transactions: one per attached database that is used in the transaction. While this is not a problem when reading from the database, it becomes complicated when writing. In particular, when we want to COMMIT a transaction it is challenging to ensure that either (a) every database has successfully committed, or (b) every database has rolled back. For that reason, it is currently not supported to write to multiple attached databases in a single transaction. Instead, an error is thrown when this is attempted: BEGIN; CREATE TABLE postgres.new_table(i INT); CREATE TABLE mysql.new_table(i INT); Error: Attempting to write to database "mysql" in a transaction that has already modified database "postgres" – a single transaction can only write to a single attached database. Copying Data Between Databases CREATE TABLE AS, INSERT INTO and COPY can be used to copy data between different attached databases. The dedicated COPY FROM DATABASE ... TO can be used to copy all data from one database to another. This includes all tables and views that are stored in the source database. -- attach a Postgres database ATTACH 'postgres:dbname=postgresscanner' AS postgres; -- attach a DuckDB file ATTACH 'database.db' AS ddb; -- export all tables and views from the Postgres database to the DuckDB file COPY FROM DATABASE postgres TO ddb; Note that this statement is currently only available in the development build. It will be available in the next DuckDB release (v0.10). Directly Opening a Database The explicit ATTACH statement is not required to connect to a different database type. When instantiating a DuckDB instance a connection can be made directly to a different database type using the {type}: prefix. For example, to connect to a SQLite file, use sqlite:file.db. To connect to a Postgres instance, use postgres:dbname=postgresscanner. This can be done in any client, including the CLI. For instance: CLI: duckdb sqlite:file.db Python: import duckdb con = duck...
·duckdb.org·
Multi-Database Support in DuckDB - DuckDB
PostgreSQL: Why true Open Source matters
PostgreSQL: Why true Open Source matters
Data oulives applications. Data matters. So does reliable and well maintained software as well. Read more about Open Source benefits.
·cybertec-postgresql.com·
PostgreSQL: Why true Open Source matters