These are chat archives for mirumee/saleor

12th
Oct 2018
Filip Kucharczyk
@Pacu2
Oct 12 2018 06:40

To fetch protected data like orders or users, you need to authorize your access. Saleor API uses a JWT token <https://jwt.io/>_ authentication mechanism. Once you create a token, you have to include it as a header with each GraphQL request.

Or if you've logged in as a super user, and want to play with the graphql playground, the hacky way is to comment out the jwt middleware out of settings.

M Abdullah Abid
@wulaaf
Oct 12 2018 09:54

ubuntu@ip-172-31-21-234:~/atc-ecom/saleor$ node -v
v10.12.0
ubuntu@ip-172-31-21-234:~/atc-ecom/saleor$ npm -v
6.4.1
ubuntu@i

HOWEVER, npm run build-assets gives me error code 137

Filip Kucharczyk
@Pacu2
Oct 12 2018 10:00
It's hard to say what went wrong without seeing the complete stacktrace, do you mind opening a github issue with that?
M Abdullah Abid
@wulaaf
Oct 12 2018 10:02
Roger that.
Is a t2.micro instance on AWS powerful enough to host a SALEOR website? It has 1 vCPU and 1 GB RAM.
Filip Kucharczyk
@Pacu2
Oct 12 2018 10:06
Okey, that might be RAM related as current build-assets might stretch up to 1.5 GB of RAM
M Abdullah Abid
@wulaaf
Oct 12 2018 10:09
Okay, I'll scale up the instance and try again.
As for running the docker-compose, are there any recommended specifications that the system should have to get optimal performance from the app?
Considering there are 5 containers.
Filip Kucharczyk
@Pacu2
Oct 12 2018 10:37
Cannot say much in terms of docker-related optimizations as that's not my thing
M Abdullah Abid
@wulaaf
Oct 12 2018 10:42
Alright. Thanks anyways bud :).
What about using swap space? Having 1 GB of RAM and having twice as much SWAP SPACE. Will that be sufficient for build-assets?
It worked like a charm! (Y)
M Abdullah Abid
@wulaaf
Oct 12 2018 13:02
I've been following #3091 and the issues that occur around static and media folder permissions. My issue is that everything runs fine when I am running collectstatic locally. It creates the static folder successfullyI'm moving
However
However,
However, when I try to move to production on an AWS EC2 instance running UBUNTU 18.04. The collectstatic command returns a permissions error. I've read through all the issues and the current workarounds but I still don't understand how I'm supposed get collectstatic to work.
Yash Agarwal
@YashAgarwal
Oct 12 2018 14:08
Hey, Can I use Saleor to make a multi vendor ecommerce platform?
@wulaaf you need to give proper permissions
M Abdullah Abid
@wulaaf
Oct 12 2018 14:11
@YashAgarwal, I’m using docker-compose. When I docker exec into container saleor_web, it is already logged in as user saleor. I can’t really do anything.
Yash Agarwal
@YashAgarwal
Oct 12 2018 14:15
sorry I haven't used that
this suggests using the priveleged option in the docker-compose config file
M Abdullah Abid
@wulaaf
Oct 12 2018 14:17

Hmm. I get that. But this is a different issue.

When I build it. It shows

Step 28/35 : RUN SECRET_KEY=changeme STATIC_URL=${STATIC_URL} python3 manage.py collectstatic --no-input
---> Running in 3dbd39a75cf1

523 static files copied to '/app/static'.
Removing intermediate container 3dbd39a75cf1

PermissionError: [Errno 13] Permission denied: '/app/static'
M Abdullah Abid
@wulaaf
Oct 12 2018 15:02
Aw man. This is so annoying. How do I fix this?
AJ
@ajostergaard
Oct 12 2018 16:53
@wulaaf> What about using swap space? Having 1 GB of RAM and having twice as much SWAP SPACE. Will that be sufficient for build-assets? : Yes in my experience.
M Abdullah Abid
@wulaaf
Oct 12 2018 16:55
Thanks @ajostergaard, I tried it already and it worked!
AJ
@ajostergaard
Oct 12 2018 16:56
:)
M Abdullah Abid
@wulaaf
Oct 12 2018 16:56
Also, for the permissions issue. I removed the following from the Dockerfile: useradd saleor cmd along with chown and USER saleor lines from Dockerfile
AJ
@ajostergaard
Oct 12 2018 16:57
So I guess that means your saleor is running as root - if so that's not wise for production.
M Abdullah Abid
@wulaaf
Oct 12 2018 16:57
With that config, the web container runs with root access. I'm not sure if that's recommended or not but they gets the job done
Exactly
I haven't found a workaround yet. I've been at it for over 18 hours
AJ
@ajostergaard
Oct 12 2018 16:58
Depends what the job is... If the job is to get it done for production then that is not a solution.
M Abdullah Abid
@wulaaf
Oct 12 2018 17:00
Fair enough. Are you using saleor for a production app?
In production for an app*
AJ
@ajostergaard
Oct 12 2018 17:02
Not in production yet but will be in the next few weeks. On Linux because that's what I know best.
M Abdullah Abid
@wulaaf
Oct 12 2018 17:05
Alright. Good to know. I'm just confused cause with the EXACT SAME CONFIG on my mac, everything works perfectly, the container created has a user saleor with correct permissions where as on AWS EC2 the use saleor is created but permissions are not correct. I even checked the docker and docker-compose versions and builds. They're exactly the same.
Does the host OS affect Docker configurations? I'm still new to Docker
AJ
@ajostergaard
Oct 12 2018 17:16
I wouldn't have thought it should as that's kinda the point of docker but I am neither AWS nor Docker expert - thankfully never had to use either in anger. (Sorry.)
M Abdullah Abid
@wulaaf
Oct 12 2018 17:17
Haha okay
I hope someone from the dev team might see this and help a fellow dev out
AJ
@ajostergaard
Oct 12 2018 17:35
No guarantee they use Docker much themselves but fingers crossed for you.