These are chat archives for mirumee/saleor

18th
Mar 2019
JK Tan
@xlanor
Mar 18 04:13
Hi,
Im attempting to build the docker container by executing
Docker build -t storename .
I am always able to reach step 15/34, webpack compilation
image.png
Ray Besiga
@raybesiga
Mar 18 06:53
@maarcingebala discusses considerations for it here https://github.com/mirumee/saleor/pull/3515#issuecomment-450887081
JK Tan
@xlanor
Mar 18 07:20
I figured out my issue - my server didn’t have enough memory, causing webpack compilation to be terminated. Thanks!@
Pete Tinkler
@ptink
Mar 18 07:45
are documentation PRs welcome? I'm on a bit of a journey right now figuring out how to customise the CSS effectively, and I could write up the process if it would help others
it would also help to have people look at it and go "nope, there's a better way to do this" I'm not too familiar with up to date front end development
Ashish Patil
@ashishnitinpatil
Mar 18 08:50
@ptink yes of course documentation PRs are welcome! If you feel somethings might be off, the PR will always be reviewed & then revised accordingly before merging :)
@xlanor ah, exactly what I was going to suggest seeing that Killed line in the output :)
JK Tan
@xlanor
Mar 18 08:51
thanks a lot! Im still struggling with the setup, so I can predict that I’ll be back with more questions, haha
I’m currently setting it up with only saleor running in docker, everything else on local (due to existing infra) and its causing some problems
Ashish Patil
@ashishnitinpatil
Mar 18 08:52
sure, I have done it with docker, so can personally help too. Ping me here if needed.
JK Tan
@xlanor
Mar 18 08:52
currently I’m running docker with this command
docker run -d -e SECRET_KEY=$SECRET_KEY -e DATABASE_URL=$DATABASE_URL -e ALLOWED_HOSTS=['localhost','172.17.0.1'] -p 8000:8000 vmall
I’m still getting an invalid http host header
how else would I edit my ALLOWED_HOSTS?
Ashish Patil
@ashishnitinpatil
Mar 18 08:54
You can use docker-compose to start things, e.g. docker-compose up -d webwhich then picks up env from the common.env (see the .yml files for deeper info)
JK Tan
@xlanor
Mar 18 08:55
ah, based on the documentation it said docker-compose was for development only
Ashish Patil
@ashishnitinpatil
Mar 18 08:55
or, you can always edit the settings.py and have it pick-off the the other ip 172.17.0.1 via another env var.
@xlanor it's safe to use docker-compose in production as well
JK Tan
@xlanor
Mar 18 08:56
awesome, I would definetly prefer to use docker-compose
Ashish Patil
@ashishnitinpatil
Mar 18 08:56
The documentation for docker usage is a little lacking, I might make a PR for that in a few days
JK Tan
@xlanor
Mar 18 08:57
thanks alot! would love that, I’m currently stumbling in the dark here
Ashish Patil
@ashishnitinpatil
Mar 18 09:03
@akshaykay Off the top of my head, I would suggest creating a route e.g. /digital/<product-slug>_<product-id>/<unique-uuid4-access-key>/ and handle the security aspects (authorization for given user, etc.)
You can use order placed signal(s) to process the orders that have digital products in them (create unique access keys & then sending them to the user in a certain way)
You could also have a dedicated "My digital products" tab in the user's profile where you could list all the products he has access to with "view now" links with correct access keys.
Of course, this may also be done by not having any access keys in the first place & then simply checking if a user has purchased (without subsequent refunds) the given digital product, but I would suggest not going down that path because it may be trickier & less reliable (& clumsy).
JK Tan
@xlanor
Mar 18 09:08
@ashishnitinpatil , just to check
I see that for the preparation of database portion,
$ docker-compose run --rm web python3 manage.py migrate
$ docker-compose run --rm web python3 manage.py collectstatic
$ docker-compose run --rm web python3 manage.py populatedb --createsuperuser
I’m just wondering, apart for chaing the administrator account, would there be anything else that I am required to do?
Ashish Patil
@ashishnitinpatil
Mar 18 09:11
nope, just like any django project, simply migrate first, then collectstatic. Populatedb is a special command to put up dummy products & other demo data. You can skip that and just do docker-compose run --rm web python3 manage.py createsuperuser since you'd need an admin account for setting up things inside the /dashboard/ (taxes, site settings, products, categories, menus, etc.)
JK Tan
@xlanor
Mar 18 09:11
Awesome! let me try that out
JK Tan
@xlanor
Mar 18 09:25
@ashishnitinpatil apologies, do I have to run a creation of the saleor db through docker?
Ashish Patil
@ashishnitinpatil
Mar 18 09:29
@xlanor no, you can create your own db elsewhere (local or remote) as per existing setup, and then simply give appropriate db settings to django for connection
JK Tan
@xlanor
Mar 18 09:29
Yup, Im trying out the docker-compose
version
Ashish Patil
@ashishnitinpatil
Mar 18 09:29
if you want, you can use the docker one as well
JK Tan
@xlanor
Mar 18 09:29
whereby it pulls an image of postgres
however, when executing this
docker-compose run —rm web python manage.py migrate
it’s telling me that the database saleor doesnt exist - I’m trying to create it in the postgres container now
Ashish Patil
@ashishnitinpatil
Mar 18 09:31
you don't have to create it, the docker image should itself create it at runtime (initial build)
1 sec, let me confirm
JK Tan
@xlanor
Mar 18 09:33
let me remove all images and rebuild them just to confirm
Ashish Patil
@ashishnitinpatil
Mar 18 09:35
that's better. Also, can't confirm if I had to create the db manually, just follow the usage instructions from the docs & it should work out of the box - https://docs.getsaleor.com/en/latest/customization/docker.html
JK Tan
@xlanor
Mar 18 09:35
yea, I was following that
the very first step of prepare the database was throwing me an error that the saleor database didnt exist
JK Tan
@xlanor
Mar 18 16:01
@ashishnitinpatil , I figured it out. It was stupidly simple, just had to add this into docker-compose.yml
  • POSTGRES_DB=saleor
monkoose
@monkoose
Mar 18 20:43
Hello! I have a newbie question, why npm install installing so many node modules? And there is some warnings about security and outdated modules after install, should i ignore them or do something about it?