Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Update developer documentation to reflect changes in Spree Starter

Damian Legawiec4bdc25c3362d
diff --git a/docs/developer/customization/quickstart.mdx b/docs/developer/customization/quickstart.mdx
index 21b2a47259..3daf1d7f23 100644
--- a/docs/developer/customization/quickstart.mdx
+++ b/docs/developer/customization/quickstart.mdx
@@ -15,7 +15,7 @@ There are several ways you can achieve this:
Changing currency, shipping zones, languages - it's very easy to do.
- Go to **Admin > Configuration > General Settings**
+ Go to **Admin > Settings**
<img src="/images/spree_admin_store_settings.png" alt="Spree Admin Store Settings" />
</Accordion>
diff --git a/docs/developer/deployment/assets.mdx b/docs/developer/deployment/assets.mdx
index ff6f1cf153..47e4342c36 100644
--- a/docs/developer/deployment/assets.mdx
+++ b/docs/developer/deployment/assets.mdx
@@ -14,10 +14,10 @@ To use Amazon S3 as your storage service, you need to configure the storage in t
```yaml
amazon:
service: S3
- access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
- secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
- region: "" # e.g. 'us-east-1'
- bucket: your_own_bucket-<%= Rails.env %>
+ access_key_id: <%= ENV.fetch("AWS_ACCESS_KEY_ID", "") %>
+ secret_access_key: <%= ENV.fetch("AWS_SECRET_ACCESS_KEY", "") %>
+ region: <%= ENV.fetch("AWS_REGION", "") %>
+ bucket: <%= ENV.fetch("AWS_BUCKET", "spree-#{Rails.env}") %>
```
You will also need to add the `aws-sdk-s3` gem to your Gemfile.
@@ -34,23 +34,9 @@ Now you need to switch the storage service in your `config/environments/producti
config.active_storage.service = :amazon
```
-Now you will need to grab the credentials from your AWS S3 bucket and add them to rails credentials by running the following command:
+Now you will need to grab the credentials from your AWS S3 bucket and set them as environment variables used in the `config/storage.yml` file on your hosting provider.
-```bash
-EDITOR="code --wait" bin/rails credentials:edit
-```
-
-Add the following credentials:
-
-```yaml
-aws:
- access_key_id: <your_access_key_id>
- secret_access_key: <your_secret_access_key>
- region: <your_region>
- bucket: <your_bucket>
-```
-
-Save and exit the editor. Remember to commit the changes to your repository.
+To test them locally you can put them in the `.env` file.
### CORS Configuration
@@ -85,11 +71,11 @@ To use Cloudflare R2 as your storage service, you need to configure the storage
```yaml
cloudflare:
service: S3
- endpoint: <%= Rails.application.credentials.dig(:cloudflare, :endpoint) %>
- access_key_id: <%= Rails.application.credentials.dig(:cloudflare, :access_key_id) %>
- secret_access_key: <%= Rails.application.credentials.dig(:cloudflare, :secret_access_key) %>
+ endpoint: <%= ENV.fetch("CLOUDFLARE_ENDPOINT", "") %>
+ access_key_id: <%= ENV.fetch("CLOUDFLARE_ACCESS_KEY_ID", "") %>
+ secret_access_key: <%= ENV.fetch("CLOUDFLARE_SECRET_ACCESS_KEY", "") %>
region: auto
- bucket: <%= Rails.application.credentials.dig(:cloudflare, :bucket) %>
+ bucket: <%= ENV.fetch("CLOUDFLARE_BUCKET", "spree-#{Rails.env}") %>
```
You will also need to add the `aws-sdk-s3` gem to your Gemfile.
@@ -106,23 +92,8 @@ Now you need to switch the storage service in your `config/environments/producti
config.active_storage.service = :cloudflare
```
-Now you will need to grab the credentials from your Cloudflare R2 bucket and add them to rails credentials by running the following command:
-
-```bash
-EDITOR="code --wait" bin/rails credentials:edit
-```
-
-Add the following credentials:
-
-```yaml
-cloudflare:
- endpoint: <your_endpoint>
- access_key_id: <your_access_key_id>
- secret_access_key: <your_secret_access_key>
- bucket: <your_bucket>
-```
-
-Save and exit the editor. Remember to commit the changes to your repository.
+Now you will need to grab the credentials from your Cloudflare R2 bucket and set them as environment variables used in the `config/storage.yml` file on your hosting provider.
+To test them locally you can put them in the `.env` file.
### CORS Configuration
diff --git a/docs/developer/deployment/caching.mdx b/docs/developer/deployment/caching.mdx
index 639ddc2b32..5446823a08 100644
--- a/docs/developer/deployment/caching.mdx
+++ b/docs/developer/deployment/caching.mdx
@@ -8,9 +8,9 @@ icon: "database"
Caching is a great way to improve the performance of your Spree application. In all modern web applications, usually the most time consuming operations are database queries and rendering templates. Caching allows you to store the results of these operations in memory and serve them from there.
-We recommend using a distributed cache storage engine such as [Solid Cache](https://github.com/rails/solid_cache), Memcached or Redis. Spree Starter uses Solid Cache by default as it doesn't require any additional setup or services to be installed.
+We recommend using a distributed cache storage engine such as Memcached or Redis. Spree Starter uses Redis by default.
-## Setting up `solid_cache` as a cache storage engine
+## Setting up Redis as a cache storage engine
<Info>
If you're using Spree Starter, you don't need to do anything as it's already pre-configured for you.
@@ -19,13 +19,7 @@ If you're using Spree Starter, you don't need to do anything as it's already pre
Firstly add `solid_cache` to your project
```bash
-bundle add solid_cache
-```
-
-And run the installation script:
-
-```bash
-bin/rails solid_cache:install
+bundle add redis
```
Now, you will need to change the `config/environments/production.rb` from:
@@ -37,9 +31,11 @@ Now, you will need to change the `config/environments/production.rb` from:
to:
```ruby
-config.cache_store = :solid_cache_store
+config.cache_store = :redis_cache_store
```
+For more advanced configuration options, please refer to the [Spree Starter repository](https://github.com/spree/spree_starter/blob/main/config/environments/production.rb#L72).
+
## Testing locally
To enable caching in the development environment please type in your project directory:
diff --git a/docs/developer/deployment/render.mdx b/docs/developer/deployment/render.mdx
index 48b0fb91a0..7b6b1a435d 100644
--- a/docs/developer/deployment/render.mdx
+++ b/docs/developer/deployment/render.mdx
@@ -27,10 +27,6 @@ Supply the repository name and click on "Create repository from template" button
![Create repository from template](/images/developer/deployment/github_setup_private_repo.png)
-<Warning>
-Make sure to set your repository visibility to "Private" so no one can see your code. This is crucial for your application security.
-</Warning>
-
Now clone the repository to your local machine.
```bash
@@ -39,37 +35,12 @@ git clone https://github.com/your-username/my_spree_app.git
Now you can start working on your application. Make sure your environment is set up correctly (follow the [Getting Started](/developer/getting-started/quickstart) guide).
-Running the `bin/setup` script should set your credentials correctly.
-
-![Setup credentials](/images/developer/deployment/setup_credentials.png)
+Running the `bin/setup` script should set your `SECRET_KEY_BASE` environment variable correctly in the `.env` file.
<Warning>
-Don't loose your `config/master.key` file or share it with anyone. It's crucial for your application to work. We recommend to add it to 1password or other password manager.
+Don't share your `.env` file with anyone!
</Warning>
-Now add your `config/credentials.yml.enc` file to the repository.
-
-```bash
-git add config/credentials.yml.enc
-```
-
-Commit the changes.
-
-```bash
-git commit -m "Add credentials"
-git push
-```
-
-This file is encrypted and cannot be seen by anyone without the `master.key` file.
-
-<Warning>
-Don't commit your `master.key` file to the repository!
-</Warning>
-
-<Info>
-You can learn more about credentials in the [Ruby on Rails Security Guide](https://guides.rubyonrails.org/security.html#custom-credentials).
-</Info>
-
## Create Render account and connect your repository
Go to [render.com](https://render.com) and create an account. We recommend to use your GitHub account to sign up as it will automatically link your GitHub repositories to Render.
@@ -80,7 +51,7 @@ Go to [render.com](https://render.com) and create an account. We recommend to us
In the Render dashboard select "New blueprint" from the "+New" button.
-<img src="/images/developer/deployment/render_new_blueprint.png" width="200" />
+<img src="/images/developer/deployment/render_new_blueprint.png" />
Now select your repository from the list of repositories.
@@ -91,13 +62,13 @@ You should see the the new blueprint form.
![Render services](/images/developer/deployment/render_deploy_blueprint.png)
1. Set your blueprint name - eg. `Spree App`
-2. Copy your `config/master.key` file to the clipboard.
+2. Generate a new `SECRET_KEY_BASE` value.
```bash
- cat config/master.key | pbcopy
+ bin/rails secret
```
-3. Paste it to the `RAILS_MASTER_KEY` environment variable.
+3. Paste it to the `SECRET_KEY_BASE` environment variable for both `web` and `worker` services (it needs to be the same value for both).
After that is done click the "Deploy Blueprint" button. Now wait a few minutes for Render to setup your application.
diff --git a/docs/developer/getting-started/quickstart.mdx b/docs/developer/getting-started/quickstart.mdx
index 8298400044..11f38ac574 100644
--- a/docs/developer/getting-started/quickstart.mdx
+++ b/docs/developer/getting-started/quickstart.mdx
@@ -118,24 +118,38 @@ Welcome to the Spree Commerce [open-source eCommerce](https://spreecommerce.org)
Feel free to explore your store. You can do so because Spree comes with a default pre-built Storefront and Admin Panel.
<AccordionGroup>
+ <Accordion icon="palette" title="Browsing Storefront">
+ Spree comes with a default pre-built Storefront. You can access it by navigating to [http://localhost:3000](http://localhost:3000).
+
+ <Frame caption="Spree Storefront">
+ <img src="/images/spree_storefront.png" />
+ </Frame>
+
+ You can learn more about Storefront configuration in the [Storefront](/user/storefront/theme-editor) section.
+ </Accordion>
+
<Accordion icon="key" title="Logging into the Admin Dashboard">
Use your browser window to navigate to [http://localhost:3000/admin](http://localhost:3000/admin). You can log in with the default credentials:
- * login: `[email protected]`
+ login:
- * password: `spree123`
+ ```
+ ```
- Upon successful authentication, you should see the admin screen:
+ password:
- ![](https://vendo-production-res.cloudinary.com/image/upload/v1740668008/docs/admin_dashboard.png)
+ ```
+ spree123
+ ```
- Feel free to explore some of the Admin Panel features that Spree has to offer and to verify that your installation is working properly.
- </Accordion>
+ Upon successful authentication, you should see the admin screen:
- <Accordion icon="palette" title="Browsing Storefront">
- Spree comes with a default pre-built Storefront. You can access it by navigating to [http://localhost:3000](http://localhost:3000).
+ <Frame caption="Spree Admin Dashboard">
+ <img src="/images/spree_admin_dashboard.png" />
+ </Frame>
- You can learn more about Storefront configuration in the [Storefront](/user/storefront/theme-editor) section.
+ Feel free to explore some of the Admin Panel features that Spree has to offer and to verify that your installation is working properly.
</Accordion>
</AccordionGroup>
diff --git a/docs/images/developer/deployment/github_setup_private_repo.png b/docs/images/developer/deployment/github_setup_private_repo.png
index 107acaf3c4..74703a9bba 100644
Binary files a/docs/images/developer/deployment/github_setup_private_repo.png and b/docs/images/developer/deployment/github_setup_private_repo.png differ
diff --git a/docs/images/developer/deployment/render_created_services.png b/docs/images/developer/deployment/render_created_services.png
index f57196ff8b..28513c617e 100644
Binary files a/docs/images/developer/deployment/render_created_services.png and b/docs/images/developer/deployment/render_created_services.png differ
diff --git a/docs/images/developer/deployment/render_deploy_blueprint.png b/docs/images/developer/deployment/render_deploy_blueprint.png
index 1ffea1da78..25ba63f6e3 100644
Binary files a/docs/images/developer/deployment/render_deploy_blueprint.png and b/docs/images/developer/deployment/render_deploy_blueprint.png differ
diff --git a/docs/images/developer/deployment/render_new_blueprint.png b/docs/images/developer/deployment/render_new_blueprint.png
index e0760f6f44..961b71fbb4 100644
Binary files a/docs/images/developer/deployment/render_new_blueprint.png and b/docs/images/developer/deployment/render_new_blueprint.png differ
diff --git a/docs/images/developer/deployment/render_select_repo.png b/docs/images/developer/deployment/render_select_repo.png
index 1300106830..0449020be0 100644
Binary files a/docs/images/developer/deployment/render_select_repo.png and b/docs/images/developer/deployment/render_select_repo.png differ
diff --git a/docs/images/spree_admin_dashboard.png b/docs/images/spree_admin_dashboard.png
new file mode 100644
index 0000000000..06cec16e22
Binary files /dev/null and b/docs/images/spree_admin_dashboard.png differ
diff --git a/docs/images/spree_admin_store_settings.png b/docs/images/spree_admin_store_settings.png
index c232ac8f0d..a919060863 100644
Binary files a/docs/images/spree_admin_store_settings.png and b/docs/images/spree_admin_store_settings.png differ
diff --git a/docs/images/spree_storefront.png b/docs/images/spree_storefront.png
new file mode 100644
index 0000000000..01c7d46fdc
Binary files /dev/null and b/docs/images/spree_storefront.png differ