vendure-ecommerce / storefront-remix-starter

A storefront starter kit for Vendure built with Remix
https://remix-storefront.vendure.io
176 stars 93 forks source link

Run in production mode in docker #35

Closed robtec closed 1 year ago

robtec commented 1 year ago

Hi,

I'm trying to run this storefront in a docker container but I'm nor sure what npm goal I should be running to pickup the .env variables are run as production

Any help would be great

robtec commented 1 year ago

side-note, I'm using stripe as a payment backend

kyunal commented 1 year ago

Hi!

If you want to run the storefront inside a docker container you can use the build & start targets to get a production express server started. There are some projects that demonstrate how you can achieve this with a dockerfile, e.g. https://github.com/garand/remix-azure-docker

As for Stripe payments: You should just follow the instructions mentioned in the Readme and use your live public key instead of the test public key. Be sure to do the same in the backend with your secret key.

If you come across some other issues I'm happy to assist!

robtec commented 1 year ago

So when I click

Screenshot 2023-04-09 at 14 14 38

I get

Screenshot 2023-04-09 at 14 14 27

Guessing I'm missing something in the config?

kyunal commented 1 year ago

This sounds like the storefront is not using the createStripePaymentIntent mutation. How did you configure the stripe plugin and payment method in your backend? Does the payment method contain the word stripe in the payment method code?

robtec commented 1 year ago

I used the default storefront code, I didn't make any changes to the remix-storefront, the remix-storefront comes default with stripe working correct? or so I need to add some custom code to the storefront

kyunal commented 1 year ago

That is correct, on the frontend part you must just configure the publishable key as mentioned in the Readme. But the backend you use must enable the Stripe Plugin and you must create a payment method that uses said Stripe Plugin. This isn't the case on a fresh vendure installation nor on the demo instance that the Remix Storefront will access on default.

robtec commented 1 year ago

So I have the backend configured

Screenshot 2023-04-12 at 21 26 47

Also here is the vendure-config.ts

https://github.com/robtec/vendure-docker-deploy/blob/main/src/vendure-config.ts

Guessing I screwed up the config above

kyunal commented 1 year ago

Change the code in your screenshot from standard-payment to stripe and it should work. The storefront uses the payment code to determine which payment flow should be used

robtec commented 1 year ago

You are a legend! That worked, can't believe I never spotted that. Thank you 👍

kyunal commented 1 year ago

Hi, just because it came into my mind: For production use be sure to change the cookie secret in app/sessions.ts

I'll add that to the README file shortly.