bullet_train 1.27.0 → 1.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5641e1bba44d5adf9523e1fd45e19d2eea108328bb5feb2b23443e20a8ea6113
4
- data.tar.gz: 05e864b4627de4d59b9fbaa9b5471281bb6f23955404070032a7adcd40dfd161
3
+ metadata.gz: 8857c92fdfe34adf9b1ea9713b8706e0ae9ac89eb9ed16ec775f57066fb507eb
4
+ data.tar.gz: 3bb45989b17d76203fda0666a52c986f39bf6f0d4f045d7a730f36479ab5efed
5
5
  SHA512:
6
- metadata.gz: 071b3ca1424d792da9af1f3a15991e5efc9d0e9ccf10db1bdc14a1eee53db63e59a8be250fce975f1beab86290d48ccd3e1f3b9e4201dd0e48a49af21e14a43a
7
- data.tar.gz: 2fe6a3b4638c964af074eb0978b867e85e652fc25e0079dfcbdaef1176a38f1739d4cd6441739870173f7e4a5f306bd0176d20e6d95348cb9815c1f102ed9a01
6
+ metadata.gz: 05a88ce952824e3c9272f7f893356f9ca7c54654f713eb1f720ae6b5f0e1541e46ecb37ea542989964b73bae7b3938fde1deca5fb0893d9c7fb71f8b4937979b
7
+ data.tar.gz: 1484085ca14bed023f4f76b217eb7ee3b4319c754c682518427f258c1f46d54af553a98932d99e170c227218cf0ca539a82df3081acb4a8883d1ce1aa7320549
data/docs/docker.md ADDED
@@ -0,0 +1,94 @@
1
+ # Using Docker with Bullet Train
2
+
3
+ We publish a number of pre-built Docker images, and we include a couple of `Dockerfile`s in
4
+ new (and upgraded) Bullet Train projects to help you get started.
5
+
6
+
7
+ ## Pre-built Images
8
+
9
+ The images that we publish are layered to give us flexibility in how final images are produced.
10
+
11
+ * `bullet_train/base` - This is the most basic image, and it contains only _runtime_ dependencies
12
+ that are needed for any/all reasonable use of a Bullet Train app. It contains things like `ruby`,
13
+ a postgres client, and image manipulation libraries.
14
+ * `bullet_train/build` - This image builds upon `base` and included dependencies needed to build the
15
+ app, but not to run it. Specifically it adds `node` which is required for building assets, but
16
+ is not needed at runtime.
17
+ * `bullet_train/dev` - This image starts with `build` and adds dependencies that are needed in
18
+ development mode, but that aren't needed in production.
19
+ * `bullet_train` - This image contains the full starter repo and is ready to run. You generally
20
+ won't use this image, but if you wanted to give Bullet Train a quick test run it might be useful.
21
+
22
+ The `Dockerfile`s for these building-block images are in the [`dockerfiles` directory of the `core` repo.](https://github.com/bullet-train-co/bullet_train-core/tree/main/dockerfiles)
23
+
24
+ These images are versioned along with the gems, and they're built and published as part of our release process.
25
+
26
+ You can find the packages here: <https://github.com/orgs/bullet-train-co/packages>
27
+
28
+ You can install one of the images directly by doing something like this:
29
+
30
+ ```
31
+ docker pull ghcr.io/bullet-train-co/bullet_train/base:1.27.0
32
+ ```
33
+
34
+ And in a `Dockerfile` you can do this:
35
+
36
+ ```
37
+ FROM ghcr.io/bullet-train-co/bullet_train/base:1.27.0
38
+ ```
39
+
40
+ ## Application Images
41
+
42
+ We include two `Dockerfile`s in the starter repo:
43
+
44
+ * `Dockerfile` is intended for building production images. Out of the box it should produce an image that is ready
45
+ to deploy based on the current version of your app.
46
+ * `dev.Dockerfile` is intended to be run locally.
47
+
48
+ ## `Dockerfile`
49
+
50
+ The main `Dockerfile` in a Bulle Train app is a two-stage file that's intented to produce a production-ready image.
51
+
52
+ The first stage is based on `bullet_train/build`. In this stage there is a block where you can install any native
53
+ **built-time** dependencies needed by your app. (Most apps probably won't need to install anything in this stage.)
54
+
55
+ The second stage is based on `bullet_train/base` and is intended to be the smallest possible image that can be
56
+ shipped to production. In this stage there is a block where you can install any custom **runtime** dependencies you need.
57
+
58
+ ## `dev.Dockerfile`
59
+
60
+ `dev.Dockerfile` is intended to be used for running your app locally within Docker. This file uses `bullet_train/dev` as
61
+ the base image and gives you a block where you can install any runtime and development dependencies.
62
+
63
+ This file assumes that the local copy of the application will be mounted into the image. The convenience scripts below handle
64
+ that for you, and then your local changes will be reflected into the Docker image immediately.
65
+
66
+ To make easy use of `dev.Dockerfile` we've included a number of convenience scripts in `bin/docker-dev`
67
+
68
+ ```
69
+ bin/docker-dev/
70
+ ├── build - Build the image. Usually only needed after changing dependencies in `dev.Dockerfile`.
71
+ ├── console - Run `rails console` inside Docker.
72
+ ├── create - Create your development application container.
73
+ ├── destroy - Destroy the development application container and image.
74
+ ├── entrypoint - Used by `dev.Dockerfile` to start the rails server in your container.
75
+ ├── shell - Get a bash shell inside your development application container.
76
+ ├── start - Launch your development application container.
77
+ └── stop - Stop your development application container.
78
+ ```
79
+
80
+ To get started with `dev.Dockerfile` you'd typically do this sequence:
81
+
82
+ ```
83
+ bin/docker-dev/build
84
+ bin/docker-dev/create
85
+ bin/docker-dev/start
86
+ ```
87
+
88
+ By default `bullet_train/dev` and `dev.Dockerfile` use the `host.docker.internal` virtual
89
+ host to allow the app to connect to postgres and redis running on the host machine.
90
+
91
+ In the future we plan to add a Docker Compose configuration that will allow you to run
92
+ postgres and redis in their own containers.
93
+
94
+
data/docs/index.md CHANGED
@@ -15,6 +15,7 @@
15
15
  - [JavaScript](/docs/javascript.md)
16
16
  - [Style Sheets](/docs/stylesheets.md)
17
17
  - [Internationalization](/docs/i18n.md)
18
+ - [Docker](/docs/docker.md)
18
19
 
19
20
  ## Developer Tools
20
21
  - [Super Scaffolding](/docs/super-scaffolding.md)
@@ -1,3 +1,3 @@
1
1
  module BulletTrain
2
- VERSION = "1.27.0"
2
+ VERSION = "1.28.0"
3
3
  end
data/lib/bullet_train.rb CHANGED
@@ -180,7 +180,15 @@ def silence_logs?
180
180
  end
181
181
 
182
182
  def openai_enabled?
183
- ENV["OPENAI_ACCESS_TOKEN"].present?
183
+ if ENV["OPENAI_ACCESS_TOKEN"].present? && !defined?(OpenAI)
184
+ Rails.logger.warn "OpenAI access token is set, but the OpenAI gem is not loaded. Please add the 'ruby-openai' gem to your Gemfile to enable OpenAI features."
185
+ end
186
+
187
+ if !ENV["OPENAI_ACCESS_TOKEN"].present? && defined?(OpenAI)
188
+ Rails.logger.warn "OpenAI access token is not set, but the OpenAI gem is loaded. Please set the OPENAI_ACCESS_TOKEN environment variable to enable OpenAI features."
189
+ end
190
+
191
+ ENV["OPENAI_ACCESS_TOKEN"].present? && defined?(OpenAI)
184
192
  end
185
193
 
186
194
  def openai_organization_exists?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet_train
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.27.0
4
+ version: 1.28.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
@@ -598,6 +598,7 @@ files:
598
598
  - docs/billing/stripe.md
599
599
  - docs/billing/usage.md
600
600
  - docs/desktop.md
601
+ - docs/docker.md
601
602
  - docs/field-partials.md
602
603
  - docs/field-partials/address-field.md
603
604
  - docs/field-partials/buttons.md