@spree/docs 0.1.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.
Files changed (183) hide show
  1. package/README.md +54 -0
  2. package/dist/api-reference/platform/authentication.md +38 -0
  3. package/dist/api-reference/store-api/authentication.md +188 -0
  4. package/dist/api-reference/store-api/errors.md +277 -0
  5. package/dist/api-reference/store-api/idempotency.md +129 -0
  6. package/dist/api-reference/store-api/introduction.md +34 -0
  7. package/dist/api-reference/store-api/localization.md +279 -0
  8. package/dist/api-reference/store-api/metadata.md +160 -0
  9. package/dist/api-reference/store-api/monetary-amounts.md +65 -0
  10. package/dist/api-reference/store-api/querying.md +399 -0
  11. package/dist/api-reference/store-api/rate-limitting.md +103 -0
  12. package/dist/api-reference/store-api/relations.md +185 -0
  13. package/dist/api-reference/storefront/authentication.md +88 -0
  14. package/dist/api-reference/tutorials/adyen-integration-guide-for-android.md +165 -0
  15. package/dist/api-reference/tutorials/adyen-integration-guide-for-ios.md +194 -0
  16. package/dist/api-reference/tutorials/quick-checkout-with-stripe.md +248 -0
  17. package/dist/api-reference/v2/fetching-multiple-resources.md +26 -0
  18. package/dist/api-reference/v2/filtering-and-sorting.md +53 -0
  19. package/dist/api-reference/v2/introduction.md +22 -0
  20. package/dist/api-reference/v2/pagination.md +37 -0
  21. package/dist/api-reference/webhooks-events.md +883 -0
  22. package/dist/developer/admin/admin.md +205 -0
  23. package/dist/developer/admin/authentication.md +59 -0
  24. package/dist/developer/admin/components.md +711 -0
  25. package/dist/developer/admin/custom-css.md +243 -0
  26. package/dist/developer/admin/custom-javascript.md +116 -0
  27. package/dist/developer/admin/extending-ui.md +1964 -0
  28. package/dist/developer/admin/form-builder.md +444 -0
  29. package/dist/developer/admin/helper-methods.md +531 -0
  30. package/dist/developer/admin/navigation.md +805 -0
  31. package/dist/developer/admin/tables.md +491 -0
  32. package/dist/developer/advanced/adding_spree_to_rails_app.md +106 -0
  33. package/dist/developer/cli/quickstart.md +137 -0
  34. package/dist/developer/contributing/creating-an-extension.md +258 -0
  35. package/dist/developer/contributing/developing-spree.md +339 -0
  36. package/dist/developer/contributing/quickstart.md +32 -0
  37. package/dist/developer/contributing/updating-extensions.md +67 -0
  38. package/dist/developer/core-concepts/addresses.md +265 -0
  39. package/dist/developer/core-concepts/adjustments.md +107 -0
  40. package/dist/developer/core-concepts/architecture.md +177 -0
  41. package/dist/developer/core-concepts/calculators.md +323 -0
  42. package/dist/developer/core-concepts/customers.md +230 -0
  43. package/dist/developer/core-concepts/events.md +624 -0
  44. package/dist/developer/core-concepts/imports-exports.md +698 -0
  45. package/dist/developer/core-concepts/inventory.md +191 -0
  46. package/dist/developer/core-concepts/markets.md +250 -0
  47. package/dist/developer/core-concepts/media.md +167 -0
  48. package/dist/developer/core-concepts/metafields.md +187 -0
  49. package/dist/developer/core-concepts/orders.md +328 -0
  50. package/dist/developer/core-concepts/payments.md +710 -0
  51. package/dist/developer/core-concepts/pricing.md +163 -0
  52. package/dist/developer/core-concepts/products.md +360 -0
  53. package/dist/developer/core-concepts/promotions.md +322 -0
  54. package/dist/developer/core-concepts/reports.md +206 -0
  55. package/dist/developer/core-concepts/search-filtering.md +237 -0
  56. package/dist/developer/core-concepts/shipments.md +212 -0
  57. package/dist/developer/core-concepts/slugs.md +111 -0
  58. package/dist/developer/core-concepts/staff-roles.md +123 -0
  59. package/dist/developer/core-concepts/store-credits-gift-cards.md +317 -0
  60. package/dist/developer/core-concepts/stores.md +117 -0
  61. package/dist/developer/core-concepts/taxes.md +135 -0
  62. package/dist/developer/core-concepts/translations.md +120 -0
  63. package/dist/developer/core-concepts/users.md +299 -0
  64. package/dist/developer/core-concepts/webhooks.md +378 -0
  65. package/dist/developer/create-spree-app/quickstart.md +158 -0
  66. package/dist/developer/customization/api.md +93 -0
  67. package/dist/developer/customization/authentication.md +88 -0
  68. package/dist/developer/customization/checkout.md +204 -0
  69. package/dist/developer/customization/configuration.md +55 -0
  70. package/dist/developer/customization/decorators.md +523 -0
  71. package/dist/developer/customization/dependencies.md +232 -0
  72. package/dist/developer/customization/emails.md +21 -0
  73. package/dist/developer/customization/extensions.md +92 -0
  74. package/dist/developer/customization/metadata.md +236 -0
  75. package/dist/developer/customization/model-preferences.md +130 -0
  76. package/dist/developer/customization/permissions.md +265 -0
  77. package/dist/developer/customization/quickstart.md +229 -0
  78. package/dist/developer/customization/routes.md +24 -0
  79. package/dist/developer/customization/v4/admin-panel.md +78 -0
  80. package/dist/developer/customization/v4/authentication.md +210 -0
  81. package/dist/developer/customization/v4/checkout.md +212 -0
  82. package/dist/developer/customization/v4/deface.md +251 -0
  83. package/dist/developer/customization/v4/images.md +86 -0
  84. package/dist/developer/customization/v4/storefront.md +450 -0
  85. package/dist/developer/deployment/assets.md +87 -0
  86. package/dist/developer/deployment/aws.md +335 -0
  87. package/dist/developer/deployment/caching.md +27 -0
  88. package/dist/developer/deployment/cdn.md +39 -0
  89. package/dist/developer/deployment/database.md +155 -0
  90. package/dist/developer/deployment/docker.md +128 -0
  91. package/dist/developer/deployment/emails.md +77 -0
  92. package/dist/developer/deployment/environment_variables.md +111 -0
  93. package/dist/developer/deployment/heroku.md +51 -0
  94. package/dist/developer/deployment/render.md +95 -0
  95. package/dist/developer/getting-started/quickstart.md +82 -0
  96. package/dist/developer/how-to/custom-payment-method.md +374 -0
  97. package/dist/developer/how-to/custom-promotion.md +373 -0
  98. package/dist/developer/how-to/custom-report.md +387 -0
  99. package/dist/developer/how-to/custom-search-provider.md +230 -0
  100. package/dist/developer/multi-store/quickstart.md +71 -0
  101. package/dist/developer/multi-store/setup.md +38 -0
  102. package/dist/developer/multi-tenant/configuration.md +41 -0
  103. package/dist/developer/multi-tenant/core-concepts.md +75 -0
  104. package/dist/developer/multi-tenant/installation.md +96 -0
  105. package/dist/developer/multi-tenant/quickstart.md +20 -0
  106. package/dist/developer/multi-vendor/installation.md +45 -0
  107. package/dist/developer/multi-vendor/quickstart.md +17 -0
  108. package/dist/developer/sdk/admin/quickstart.md +22 -0
  109. package/dist/developer/sdk/authentication.md +89 -0
  110. package/dist/developer/sdk/configuration.md +225 -0
  111. package/dist/developer/sdk/quickstart.md +82 -0
  112. package/dist/developer/sdk/store/account.md +67 -0
  113. package/dist/developer/sdk/store/cart-checkout.md +140 -0
  114. package/dist/developer/sdk/store/markets.md +151 -0
  115. package/dist/developer/sdk/store/payments.md +96 -0
  116. package/dist/developer/sdk/store/products.md +149 -0
  117. package/dist/developer/sdk/store/wishlists.md +52 -0
  118. package/dist/developer/security/pci_compliance.md +15 -0
  119. package/dist/developer/security/security_policy.md +68 -0
  120. package/dist/developer/storefront/blocks.md +285 -0
  121. package/dist/developer/storefront/custom-css.md +260 -0
  122. package/dist/developer/storefront/custom-javascript.md +166 -0
  123. package/dist/developer/storefront/helper-methods.md +1288 -0
  124. package/dist/developer/storefront/links.md +298 -0
  125. package/dist/developer/storefront/nextjs/architecture.md +150 -0
  126. package/dist/developer/storefront/nextjs/customization.md +141 -0
  127. package/dist/developer/storefront/nextjs/deployment.md +180 -0
  128. package/dist/developer/storefront/nextjs/quickstart.md +92 -0
  129. package/dist/developer/storefront/nextjs/spree-next-package.md +314 -0
  130. package/dist/developer/storefront/pages.md +163 -0
  131. package/dist/developer/storefront/sections.md +569 -0
  132. package/dist/developer/storefront/storefront.md +56 -0
  133. package/dist/developer/storefront/themes.md +161 -0
  134. package/dist/developer/tutorial/admin.md +134 -0
  135. package/dist/developer/tutorial/extending-models.md +380 -0
  136. package/dist/developer/tutorial/file-uploads.md +121 -0
  137. package/dist/developer/tutorial/introduction.md +33 -0
  138. package/dist/developer/tutorial/model.md +41 -0
  139. package/dist/developer/tutorial/page-builder.md +487 -0
  140. package/dist/developer/tutorial/rich-text.md +73 -0
  141. package/dist/developer/tutorial/seo.md +332 -0
  142. package/dist/developer/tutorial/storefront.md +352 -0
  143. package/dist/developer/tutorial/testing.md +558 -0
  144. package/dist/developer/upgrades/2.0-to-2.1.md +46 -0
  145. package/dist/developer/upgrades/2.1-to-2.2.md +59 -0
  146. package/dist/developer/upgrades/2.2-to-2.3.md +44 -0
  147. package/dist/developer/upgrades/2.3-to-2.4.md +42 -0
  148. package/dist/developer/upgrades/3.0-to-3.1.md +47 -0
  149. package/dist/developer/upgrades/3.1-to-3.2.md +34 -0
  150. package/dist/developer/upgrades/3.2-to-3.3.md +70 -0
  151. package/dist/developer/upgrades/3.3-to-3.4.md +36 -0
  152. package/dist/developer/upgrades/3.4-to-3.5.md +44 -0
  153. package/dist/developer/upgrades/3.5-to-3.6.md +40 -0
  154. package/dist/developer/upgrades/3.6-to-3.7.md +62 -0
  155. package/dist/developer/upgrades/3.7-to-4.0.md +152 -0
  156. package/dist/developer/upgrades/4.0-to-4.1.md +92 -0
  157. package/dist/developer/upgrades/4.1-to-4.2.md +109 -0
  158. package/dist/developer/upgrades/4.10-to-5.0.md +129 -0
  159. package/dist/developer/upgrades/4.2-to-4.3.md +100 -0
  160. package/dist/developer/upgrades/4.3-to-4.4.md +125 -0
  161. package/dist/developer/upgrades/4.4-to-4.5.md +94 -0
  162. package/dist/developer/upgrades/4.5-to-4.6.md +119 -0
  163. package/dist/developer/upgrades/4.6-to-4.7.md +39 -0
  164. package/dist/developer/upgrades/4.8-to-4.9.md +24 -0
  165. package/dist/developer/upgrades/4.9-to-4.10.md +24 -0
  166. package/dist/developer/upgrades/4.x-to-4.8.md +52 -0
  167. package/dist/developer/upgrades/5.0-to-5.1.md +28 -0
  168. package/dist/developer/upgrades/5.1-to-5.2.md +127 -0
  169. package/dist/developer/upgrades/5.2-to-5.3.md +338 -0
  170. package/dist/developer/upgrades/5.3-to-5.4.md +248 -0
  171. package/dist/developer/upgrades/quickstart.md +36 -0
  172. package/dist/integrations/analytics/google-analytics.md +64 -0
  173. package/dist/integrations/analytics/google-tag-manager.md +78 -0
  174. package/dist/integrations/integrations.md +39 -0
  175. package/dist/integrations/marketing/klaviyo.md +99 -0
  176. package/dist/integrations/payments/adyen.md +90 -0
  177. package/dist/integrations/payments/paypal.md +41 -0
  178. package/dist/integrations/payments/razorpay.md +45 -0
  179. package/dist/integrations/payments/stripe.md +109 -0
  180. package/dist/integrations/search/meilisearch.md +236 -0
  181. package/dist/integrations/sso-mfa-social-login/admin-dashboard.md +57 -0
  182. package/dist/integrations/sso-mfa-social-login/storefront.md +56 -0
  183. package/package.json +27 -0
@@ -0,0 +1,335 @@
1
+ ---
2
+ title: Amazon Web Services (AWS)
3
+ description: Learn how to deploy your Spree application on Amazon Web Services (AWS).
4
+ ---
5
+
6
+ Amazon Web Services offers reliable, scalable, and inexpensive cloud computing services. AWS is also one of the most popular choices for hosting a Spree application.
7
+
8
+ We recommend using AWS ECS Fargate to host your Spree application via [Docker image](/developer/deployment/docker).
9
+
10
+ ## Required AWS services
11
+
12
+ To fully run your Spree application on AWS, you will need the following services:
13
+
14
+ | Service | Description |
15
+ |---------|-------------|
16
+ | [AWS ECS Fargate](https://aws.amazon.com/fargate/) | Amazon Elastic Container Service (ECS) is a fully managed container orchestration service that allows you to run and scale containerized applications without managing the underlying infrastructure. |
17
+ | [AWS RDS](https://aws.amazon.com/rds/) | Amazon Relational Database Service makes it easy to set up, operate, and scale a relational database in the cloud. Spree works great with multiple databases: [Amazon Aurora both MySQL and PostgreSQL variants](https://aws.amazon.com/rds/aurora/), [RDS PostgreSQL](https://aws.amazon.com/rds/postgresql/), [RDS MySQL](https://aws.amazon.com/rds/mysql/) and [RDS MariaDB](https://aws.amazon.com/rds/mariadb/) |
18
+ | [AWS ElastiCache](https://aws.amazon.com/elasticache/redis/?nc=sn&loc=2&dn=1) | Valkey or Redis instance for background jobs (Sidekiq), [caching](/developer/deployment/caching), and Action Cable. |
19
+ | [AWS S3](https://aws.amazon.com/s3/) | Object storage service to store and read your uploaded files such as Product images, etc. [More information](/developer/deployment/assets#aws-s3). |
20
+ | [AWS CloudFront](https://aws.amazon.com/cloudfront/) | Fast content delivery network CDN to speed up your asset images/stylesheets/javascript delivery. This will greatly enhance your application responsiveness. |
21
+ | [AWS Route 53](https://aws.amazon.com/route53/) | Domain name system (DNS) service to manage your domain names and DNS records. |
22
+ | [AWS Certificate Manager](https://aws.amazon.com/certificate-manager/) | AWS Certificate Manager is a service that provides you with SSL/TLS certificates that you can use to secure your application. Spree in production works only with HTTPS. |
23
+ | [AWS ECR](https://aws.amazon.com/ecr/) | Amazon Elastic Container Registry is a fully managed Docker container registry that makes it easy to store, manage, and deploy Docker container images. |
24
+
25
+ ## Docker Image
26
+
27
+ You can use the [official Docker image](/developer/deployment/docker) (`ghcr.io/spree/spree`) directly, or build your own from your Rails application's Dockerfile.
28
+
29
+ To build and deploy a custom image to AWS ECR via GitHub Actions:
30
+
31
+ ```yaml
32
+ name: Deploy to AWS Fargate
33
+
34
+ on:
35
+ push:
36
+ branches: [ main ]
37
+ pull_request:
38
+ branches: [ main ]
39
+
40
+ env:
41
+ AWS_REGION: us-east-1
42
+ ECR_REPOSITORY: spree-starter
43
+ ECS_SERVICE_WEB: spree-web
44
+ ECS_SERVICE_WORKER: spree-worker
45
+ ECS_CLUSTER: spree-cluster
46
+
47
+ jobs:
48
+ build:
49
+ name: Build and Push to ECR
50
+ runs-on: ubuntu-latest
51
+
52
+ outputs:
53
+ image: ${{ steps.build-image.outputs.image }}
54
+ image-tag: ${{ steps.build-image.outputs.image-tag }}
55
+
56
+ steps:
57
+ - name: Checkout code
58
+ uses: actions/checkout@v4
59
+
60
+ - name: Configure AWS credentials
61
+ uses: aws-actions/configure-aws-credentials@v4
62
+ with:
63
+ aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
64
+ aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
65
+ aws-region: ${{ env.AWS_REGION }}
66
+
67
+ - name: Login to Amazon ECR
68
+ id: login-ecr
69
+ uses: aws-actions/amazon-ecr-login@v2
70
+
71
+ - name: Build, tag, and push image to Amazon ECR
72
+ id: build-image
73
+ env:
74
+ ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
75
+ IMAGE_TAG: ${{ github.sha }}
76
+ run: |
77
+ # Build a docker container and push it to ECR
78
+ docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
79
+ docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
80
+ echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
81
+ echo "image-tag=$IMAGE_TAG" >> $GITHUB_OUTPUT
82
+
83
+ deploy-web:
84
+ name: Deploy Web Service
85
+ runs-on: ubuntu-latest
86
+ needs: build
87
+ if: github.ref == 'refs/heads/main'
88
+
89
+ steps:
90
+ - name: Checkout code
91
+ uses: actions/checkout@v4
92
+
93
+ - name: Configure AWS credentials
94
+ uses: aws-actions/configure-aws-credentials@v4
95
+ with:
96
+ aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
97
+ aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
98
+ aws-region: ${{ env.AWS_REGION }}
99
+
100
+ - name: Fill in the new image ID in the Amazon ECS task definition
101
+ id: task-def-web
102
+ uses: aws-actions/amazon-ecs-render-task-definition@v1
103
+ env:
104
+ ECR_REGISTRY: ${{ needs.build.outputs.image }}
105
+ IMAGE_TAG: ${{ needs.build.outputs.image-tag }}
106
+ AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
107
+ with:
108
+ task-definition: .aws/web-task-definition.json
109
+ container-name: web
110
+ image: ${{ needs.build.outputs.image }}
111
+
112
+ - name: Deploy Amazon ECS task definition for web
113
+ uses: aws-actions/amazon-ecs-deploy-task-definition@v1
114
+ with:
115
+ task-definition: ${{ steps.task-def-web.outputs.task-definition }}
116
+ service: ${{ env.ECS_SERVICE_WEB }}
117
+ cluster: ${{ env.ECS_CLUSTER }}
118
+ wait-for-service-stability: true
119
+
120
+ deploy-worker:
121
+ name: Deploy Worker Service
122
+ runs-on: ubuntu-latest
123
+ needs: build
124
+ if: github.ref == 'refs/heads/main'
125
+
126
+ steps:
127
+ - name: Checkout code
128
+ uses: actions/checkout@v4
129
+
130
+ - name: Configure AWS credentials
131
+ uses: aws-actions/configure-aws-credentials@v4
132
+ with:
133
+ aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
134
+ aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
135
+ aws-region: ${{ env.AWS_REGION }}
136
+
137
+ - name: Fill in the new image ID in the Amazon ECS task definition
138
+ id: task-def-worker
139
+ uses: aws-actions/amazon-ecs-render-task-definition@v1
140
+ env:
141
+ ECR_REGISTRY: ${{ needs.build.outputs.image }}
142
+ IMAGE_TAG: ${{ needs.build.outputs.image-tag }}
143
+ AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
144
+ with:
145
+ task-definition: .aws/worker-task-definition.json
146
+ container-name: worker
147
+ image: ${{ needs.build.outputs.image }}
148
+
149
+ - name: Deploy Amazon ECS task definition for worker
150
+ uses: aws-actions/amazon-ecs-deploy-task-definition@v1
151
+ with:
152
+ task-definition: ${{ steps.task-def-worker.outputs.task-definition }}
153
+ service: ${{ env.ECS_SERVICE_WORKER }}
154
+ cluster: ${{ env.ECS_CLUSTER }}
155
+ wait-for-service-stability: true
156
+
157
+ migrate:
158
+ name: Run Database Migrations
159
+ runs-on: ubuntu-latest
160
+ needs: [build, deploy-web]
161
+ if: github.ref == 'refs/heads/main'
162
+
163
+ steps:
164
+ - name: Checkout code
165
+ uses: actions/checkout@v4
166
+
167
+ - name: Configure AWS credentials
168
+ uses: aws-actions/configure-aws-credentials@v4
169
+ with:
170
+ aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
171
+ aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
172
+ aws-region: ${{ env.AWS_REGION }}
173
+
174
+ - name: Run database migrations
175
+ run: |
176
+ aws ecs run-task \
177
+ --cluster ${{ env.ECS_CLUSTER }} \
178
+ --task-definition spree-web \
179
+ --overrides '{
180
+ "containerOverrides": [{
181
+ "name": "web",
182
+ "command": ["bundle", "exec", "rails", "db:migrate"]
183
+ }]
184
+ }' \
185
+ --launch-type FARGATE \
186
+ --network-configuration '{
187
+ "awsvpcConfiguration": {
188
+ "subnets": ["'${{ secrets.SUBNET_ID_1 }}'", "'${{ secrets.SUBNET_ID_2 }}'"],
189
+ "securityGroups": ["'${{ secrets.SECURITY_GROUP_ID }}'"],
190
+ "assignPublicIp": "ENABLED"
191
+ }
192
+ }'
193
+ ```
194
+
195
+ This action requires secrets to be set in your GitHub repository. You can find the full list of secrets in the [AWS ECS Deploy Task Definition](https://github.com/aws-actions/amazon-ecs-deploy-task-definition) GitHub Actions repository.
196
+
197
+ | Secret | Description |
198
+ |--------|-------------|
199
+ | `AWS_ACCESS_KEY_ID` | AWS access key ID |
200
+ | `AWS_SECRET_ACCESS_KEY` | AWS secret access key |
201
+ | `AWS_ACCOUNT_ID` | AWS account ID |
202
+ | `SUBNET_ID_1` | First subnet ID |
203
+ | `SUBNET_ID_2` | Second subnet ID |
204
+ | `SECURITY_GROUP_ID` | Security group ID |
205
+
206
+ ## Environment variables
207
+
208
+ For a full list of Docker environment variables, please refer to the [Environment variables](/developer/deployment/environment_variables) page.
209
+
210
+ ## ECS tasks
211
+
212
+ You will need to create two ECS task definitions: one for the web service and one for the worker service.
213
+
214
+ ### Web service
215
+
216
+ ```json
217
+ {
218
+ "family": "spree-web",
219
+ "networkMode": "awsvpc",
220
+ "requiresCompatibilities": ["FARGATE"],
221
+ "cpu": "512",
222
+ "memory": "1024",
223
+ "executionRoleArn": "arn:aws:iam::${AWS_ACCOUNT_ID}:role/ecsTaskExecutionRole",
224
+ "taskRoleArn": "arn:aws:iam::${AWS_ACCOUNT_ID}:role/ecsTaskRole",
225
+ "containerDefinitions": [
226
+ {
227
+ "name": "web",
228
+ "image": "${ECR_REGISTRY}/${ECR_REPOSITORY}:${IMAGE_TAG}",
229
+ "portMappings": [
230
+ {
231
+ "containerPort": 3000,
232
+ "protocol": "tcp"
233
+ }
234
+ ],
235
+ "essential": true,
236
+ "environment": [
237
+ {
238
+ "name": "RAILS_ENV",
239
+ "value": "production"
240
+ },
241
+ {
242
+ "name": "PORT",
243
+ "value": "3000"
244
+ }
245
+ ],
246
+ "secrets": [
247
+ {
248
+ "name": "DATABASE_URL",
249
+ "valueFrom": "arn:aws:secretsmanager:${AWS_REGION}:${AWS_ACCOUNT_ID}:secret:spree/database-url"
250
+ },
251
+ {
252
+ "name": "REDIS_URL",
253
+ "valueFrom": "arn:aws:secretsmanager:${AWS_REGION}:${AWS_ACCOUNT_ID}:secret:spree/redis-url"
254
+ },
255
+ {
256
+ "name": "SECRET_KEY_BASE",
257
+ "valueFrom": "arn:aws:secretsmanager:${AWS_REGION}:${AWS_ACCOUNT_ID}:secret:spree/secret-key-base"
258
+ }
259
+ ],
260
+ "logConfiguration": {
261
+ "logDriver": "awslogs",
262
+ "options": {
263
+ "awslogs-group": "/ecs/spree-web",
264
+ "awslogs-region": "${AWS_REGION}",
265
+ "awslogs-stream-prefix": "ecs"
266
+ }
267
+ },
268
+ "healthCheck": {
269
+ "command": ["CMD-SHELL", "curl -f http://localhost:3000/up || exit 1"],
270
+ "interval": 30,
271
+ "timeout": 5,
272
+ "retries": 3,
273
+ "startPeriod": 60
274
+ }
275
+ }
276
+ ]
277
+ }
278
+ ```
279
+
280
+ ### Worker service
281
+
282
+ ```json
283
+ {
284
+ "family": "spree-worker",
285
+ "networkMode": "awsvpc",
286
+ "requiresCompatibilities": ["FARGATE"],
287
+ "cpu": "256",
288
+ "memory": "512",
289
+ "executionRoleArn": "arn:aws:iam::${AWS_ACCOUNT_ID}:role/ecsTaskExecutionRole",
290
+ "taskRoleArn": "arn:aws:iam::${AWS_ACCOUNT_ID}:role/ecsTaskRole",
291
+ "containerDefinitions": [
292
+ {
293
+ "name": "worker",
294
+ "image": "${ECR_REGISTRY}/${ECR_REPOSITORY}:${IMAGE_TAG}",
295
+ "command": ["bundle", "exec", "sidekiq"],
296
+ "essential": true,
297
+ "environment": [
298
+ {
299
+ "name": "RAILS_ENV",
300
+ "value": "production"
301
+ }
302
+ ],
303
+ "secrets": [
304
+ {
305
+ "name": "DATABASE_URL",
306
+ "valueFrom": "arn:aws:secretsmanager:${AWS_REGION}:${AWS_ACCOUNT_ID}:secret:spree/database-url"
307
+ },
308
+ {
309
+ "name": "REDIS_URL",
310
+ "valueFrom": "arn:aws:secretsmanager:${AWS_REGION}:${AWS_ACCOUNT_ID}:secret:spree/redis-url"
311
+ },
312
+ {
313
+ "name": "SECRET_KEY_BASE",
314
+ "valueFrom": "arn:aws:secretsmanager:${AWS_REGION}:${AWS_ACCOUNT_ID}:secret:spree/secret-key-base"
315
+ }
316
+ ],
317
+ "logConfiguration": {
318
+ "logDriver": "awslogs",
319
+ "options": {
320
+ "awslogs-group": "/ecs/spree-worker",
321
+ "awslogs-region": "${AWS_REGION}",
322
+ "awslogs-stream-prefix": "ecs"
323
+ }
324
+ },
325
+ "healthCheck": {
326
+ "command": ["CMD-SHELL", "pgrep -f sidekiq || exit 1"],
327
+ "interval": 30,
328
+ "timeout": 5,
329
+ "retries": 3,
330
+ "startPeriod": 60
331
+ }
332
+ }
333
+ ]
334
+ }
335
+ ```
@@ -0,0 +1,27 @@
1
+ ---
2
+ title: Caching
3
+ description: Configure caching for your Spree application
4
+ ---
5
+
6
+ Caching improves performance by storing the results of expensive database queries and template renders in memory.
7
+
8
+ ## Setting up Redis as Cache Store
9
+
10
+ Spree comes pre-configured to use Redis for caching in production. Just set the `REDIS_URL` environment variable — no gem installation or code changes needed.
11
+
12
+ ```bash
13
+ REDIS_URL=redis://localhost:6379/0
14
+ ```
15
+
16
+ When `REDIS_URL` is set, Spree automatically uses it for caching. When not set, it falls back to an in-memory cache store.
17
+
18
+ ## Testing Locally
19
+
20
+ To enable caching in the development environment:
21
+
22
+ ```bash
23
+ cd server
24
+ bin/rails dev:cache
25
+ ```
26
+
27
+ You will need to restart your web server after this.
@@ -0,0 +1,39 @@
1
+ ---
2
+ title: CDN
3
+ description: >-
4
+ Learn how to improve performance of your Spree application by using a CDN (Content Delivery Network).
5
+ ---
6
+
7
+ To improve performance of your Spree application, we recommend using a CDN (Content Delivery Network) to cache images and static files.
8
+
9
+ We recommend using [Cloudflare](https://www.cloudflare.com/) as your CDN provider. It's free and simple to setup.
10
+
11
+ After setting up your Cloudflare account and adding your domain name to Cloudflare, you will need to set your cache settings.
12
+
13
+ Go to your domain name in Cloudflare and click on "Caching" tab and select "Cache Rules".
14
+
15
+ ![Cloudflare Cache Rules](/images/developer/deployment/cloudflare_caching.png)
16
+
17
+ Click on "Create Rule" and setup the rule as bellow:
18
+
19
+ ![Cloudflare Cache Rule Settings](/images/developer/deployment/cloudflare_cache_rule_1.png)
20
+
21
+ Supply the first value with
22
+
23
+ ```url
24
+ /rails/active_storage/representations/
25
+ ```
26
+
27
+ and the second value with
28
+
29
+ ```url
30
+ /assets
31
+ ```
32
+
33
+ This will handle caching of both images and static files such as JavaScript and CSS files.
34
+
35
+ Now scroll down and set the settings as bellow:
36
+
37
+ ![Cloudflare Cache Rule Settings](/images/developer/deployment/cloudflare_cache_rule_2.png)
38
+
39
+ Finally, click on "Deploy" and you are done!
@@ -0,0 +1,155 @@
1
+ ---
2
+ title: Database Configuration
3
+ description: Learn how to configure Spree to work with PostgreSQL, MySQL, or SQLite.
4
+ ---
5
+
6
+ ## Supported Databases
7
+
8
+ | Database | Development | Production | Notes |
9
+ |----------|:-----------:|:----------:|-------|
10
+ | **PostgreSQL** | Yes | Yes | Recommended for production. Best performance for large catalogs and high traffic |
11
+ | **MySQL** | Yes | Yes | Fully supported. A great choice if your team already uses MySQL |
12
+ | **SQLite** | Yes | Yes | Zero-configuration setup. Ideal for development, small stores, and getting started quickly |
13
+
14
+ ## Configuring Your Database
15
+
16
+ ### Using DATABASE_URL
17
+
18
+ The simplest way to configure your database is via the `DATABASE_URL` environment variable:
19
+
20
+ ```bash
21
+ # PostgreSQL
22
+ DATABASE_URL=postgres://user:pass@localhost:5432/spree
23
+
24
+ # MySQL
25
+ DATABASE_URL=mysql2://user:pass@localhost:3306/spree
26
+
27
+ # SQLite
28
+ DATABASE_URL=sqlite3:db/production.sqlite3
29
+ ```
30
+
31
+ ### Using database.yml
32
+
33
+ You can also configure the database in `config/database.yml`:
34
+
35
+ **PostgreSQL:**
36
+
37
+ ```yaml
38
+ default: &default
39
+ adapter: postgresql
40
+ encoding: unicode
41
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
42
+
43
+ development:
44
+ <<: *default
45
+ database: spree_development
46
+
47
+ production:
48
+ <<: *default
49
+ database: spree_production
50
+ url: <%= ENV["DATABASE_URL"] %>
51
+ ```
52
+
53
+ **MySQL:**
54
+
55
+ ```yaml
56
+ default: &default
57
+ adapter: mysql2
58
+ encoding: utf8mb4
59
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
60
+
61
+ development:
62
+ <<: *default
63
+ database: spree_development
64
+
65
+ production:
66
+ <<: *default
67
+ database: spree_production
68
+ url: <%= ENV["DATABASE_URL"] %>
69
+ ```
70
+
71
+ **SQLite:**
72
+
73
+ ```yaml
74
+ default: &default
75
+ adapter: sqlite3
76
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
77
+ timeout: 5000
78
+
79
+ development:
80
+ <<: *default
81
+ database: db/development.sqlite3
82
+
83
+ production:
84
+ <<: *default
85
+ database: db/production.sqlite3
86
+ ```
87
+
88
+
89
+ ## Switching Databases
90
+
91
+ The easiest way to switch your existing Spree application to a different database is using the built-in Rails command:
92
+
93
+ ```bash
94
+ # Switch to PostgreSQL
95
+ bin/rails db:system:change --to=postgresql
96
+
97
+ # Switch to MySQL
98
+ bin/rails db:system:change --to=mysql
99
+
100
+ # Switch to SQLite
101
+ bin/rails db:system:change --to=sqlite3
102
+ ```
103
+
104
+ This command will:
105
+ - Update your `Gemfile` with the correct database gem
106
+ - Generate a new `config/database.yml` configured for the selected database
107
+
108
+ After running the command, complete the switch:
109
+
110
+ 1. Install the new gem:
111
+
112
+ ```bash
113
+ bundle install
114
+ ```
115
+
116
+ 2. Create the new database and run migrations:
117
+
118
+ ```bash
119
+ bin/rails db:create db:migrate
120
+ ```
121
+
122
+ 3. Optionally load sample data:
123
+
124
+ ```bash
125
+ bin/rails spree_sample:load
126
+ ```
127
+
128
+ ## Creating a New App with a Specific Database
129
+
130
+ When creating a new Spree application with the manual installation method, pass the `-d` flag to `rails new`:
131
+
132
+ ```bash
133
+ # PostgreSQL
134
+ rails new my_store -d postgresql -m https://raw.githubusercontent.com/spree/spree/main/spree/template.rb
135
+
136
+ # MySQL
137
+ rails new my_store -d mysql -m https://raw.githubusercontent.com/spree/spree/main/spree/template.rb
138
+
139
+ # SQLite (default, no flag needed)
140
+ rails new my_store -m https://raw.githubusercontent.com/spree/spree/main/spree/template.rb
141
+ ```
142
+
143
+ ## Cloud Database Services
144
+
145
+ For production deployments, you can use managed database services:
146
+
147
+ | Provider | PostgreSQL | MySQL |
148
+ |----------|-----------|-------|
149
+ | **AWS** | RDS PostgreSQL, Aurora PostgreSQL | RDS MySQL, Aurora MySQL, RDS MariaDB |
150
+ | **Google Cloud** | Cloud SQL for PostgreSQL | Cloud SQL for MySQL |
151
+ | **Azure** | Azure Database for PostgreSQL | Azure Database for MySQL |
152
+ | **Heroku** | Heroku Postgres | JawsDB, ClearDB |
153
+ | **Render** | Render PostgreSQL | — |
154
+
155
+ Set the `DATABASE_URL` environment variable to the connection string provided by your cloud provider.
@@ -0,0 +1,128 @@
1
+ ---
2
+ title: Docker
3
+ description: Run the official Spree Docker image or build your own.
4
+ ---
5
+
6
+ ## Official Docker Image
7
+
8
+ Spree publishes multi-arch Docker images (`linux/amd64` and `linux/arm64`) to the GitHub Container Registry on every release.
9
+
10
+ ```bash
11
+ docker pull ghcr.io/spree/spree:latest
12
+ ```
13
+
14
+ ### Available Tags
15
+
16
+ | Tag | Description |
17
+ |-----|-------------|
18
+ | `latest` | Latest stable release |
19
+ | `5.1.3` | Specific version |
20
+ | `5.1` | Latest patch for a minor version |
21
+
22
+ Browse all tags on the [GitHub Packages page](https://github.com/spree/spree/pkgs/container/spree).
23
+
24
+ ### Running the Image
25
+
26
+ The image runs a Puma web server on port 3000. You also need a worker container for background jobs (Sidekiq):
27
+
28
+ ```yaml docker-compose.yml
29
+ services:
30
+ postgres:
31
+ image: postgres:17-alpine
32
+ environment:
33
+ POSTGRES_HOST_AUTH_METHOD: trust
34
+ volumes:
35
+ - postgres_data:/var/lib/postgresql/data
36
+ healthcheck:
37
+ test: pg_isready -U postgres
38
+ interval: 5s
39
+ timeout: 5s
40
+ retries: 5
41
+
42
+ redis:
43
+ image: redis:7-alpine
44
+ volumes:
45
+ - redis_data:/data
46
+ healthcheck:
47
+ test: redis-cli ping
48
+ interval: 5s
49
+ timeout: 5s
50
+ retries: 5
51
+
52
+ web:
53
+ image: ghcr.io/spree/spree:latest
54
+ depends_on:
55
+ postgres:
56
+ condition: service_healthy
57
+ redis:
58
+ condition: service_healthy
59
+ environment:
60
+ DATABASE_URL: postgres://postgres@postgres:5432/spree_production
61
+ REDIS_URL: redis://redis:6379/0
62
+ SECRET_KEY_BASE: change-me-to-a-real-secret
63
+ RAILS_FORCE_SSL: "false"
64
+ RAILS_ASSUME_SSL: "false"
65
+ ports:
66
+ - "3000:3000"
67
+ healthcheck:
68
+ test: curl -f http://localhost:3000/up || exit 1
69
+ interval: 10s
70
+ timeout: 5s
71
+ retries: 10
72
+ start_period: 30s
73
+
74
+ worker:
75
+ image: ghcr.io/spree/spree:latest
76
+ depends_on:
77
+ web:
78
+ condition: service_healthy
79
+ environment:
80
+ DATABASE_URL: postgres://postgres@postgres:5432/spree_production
81
+ REDIS_URL: redis://redis:6379/0
82
+ SECRET_KEY_BASE: change-me-to-a-real-secret
83
+ command: bundle exec sidekiq
84
+
85
+ volumes:
86
+ postgres_data:
87
+ redis_data:
88
+ ```
89
+
90
+ Start everything:
91
+
92
+ ```bash
93
+ docker compose up -d
94
+ ```
95
+
96
+ The database is automatically created and migrated on first boot. The app is available at [http://localhost:3000](http://localhost:3000).
97
+
98
+ > **TIP:** Use [create-spree-app](/developer/create-spree-app/quickstart) for a fully scaffolded Docker setup with `.env` files, health checks, and optional Next.js storefront — all configured automatically.
99
+
100
+ ### Required Environment Variables
101
+
102
+ | Variable | Description | Example |
103
+ | --- | --- | --- |
104
+ | `DATABASE_URL` | PostgreSQL connection URL | `postgres://user:pass@host:5432/spree` |
105
+ | `REDIS_URL` | Redis URL for jobs, caching, and Action Cable | `redis://redis:6379/0` |
106
+ | `SECRET_KEY_BASE` | Secret key for session encryption | Generate with `bin/rails secret` |
107
+
108
+ See [Environment Variables](/developer/deployment/environment_variables) for the full list.
109
+
110
+ ## Building Your Own Image
111
+
112
+ If you have your own Rails application with Spree installed, build a Docker image from your app's Dockerfile:
113
+
114
+ ```bash
115
+ docker build -t my-spree .
116
+ ```
117
+
118
+ Then use your custom image in place of `ghcr.io/spree/spree`:
119
+
120
+ ```bash
121
+ docker run -p 3000:3000 \
122
+ -e DATABASE_URL=postgres://user:pass@host:5432/spree \
123
+ -e REDIS_URL=redis://localhost:6379/0 \
124
+ -e SECRET_KEY_BASE=your-secret \
125
+ my-spree
126
+ ```
127
+
128
+ > **TIP:** When creating a new Rails app with Spree via `rails new -m`, a production-ready Dockerfile is generated automatically by Rails.