├── 3.5 ├── saleor_admin_3_5.txt ├── saleor_react_storefront.txt └── setup_saleor_core_3.5.txt ├── Apache connfig files ├── .env ├── apache_config ├── apache_config2 └── modify setting.py ├── README.md ├── nginx config files ├── nginx_config ├── nginx_config.txt └── nginx_pricemenu_steps ├── run_dashboard.sh ├── run_storefront.sh ├── saleor_bash_rc_updates.txt ├── saleor_core.sh ├── saleor_storefront_install.txt ├── setup_saleor_core.txt └── steps_t_install_mod_wsgi_for_python_3.7.txt /3.5/saleor_admin_3_5.txt: -------------------------------------------------------------------------------- 1 | * Install nvm 2 | * Install node 16 3 | * setup code 4 | 5 | 6 | 7 | 8 | * Install nvm 9 | how-to-install-nvm-on-ubuntu-20-04/ 10 | sudo apt install curl 11 | curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash 12 | source ~/.profile 13 | 14 | nvm install node 15 | node --version # 18.5 16 | 17 | # Install node 16 18 | nvm install 16 19 | nvm use 16 20 | 21 | * setup code 22 | Repo: https://github.com/saleor/saleor-dashboard 23 | git clone https://github.com/saleor/saleor-dashboard.git 24 | nvm use 16 25 | cd saleor-dashboard/ 26 | git fetch origin 3.5:3.5 && git checkout 3.5 27 | npm i 28 | 29 | # Create file .env 30 | touch .env 31 | 32 | # Add below configuration to .env file 33 | API_URI=http://ecomapi.thedsacademy.in:8080/graphql/ 34 | APP_MOUNT_URI=/dashboard/ 35 | 36 | npm start 37 | 38 | # Verify: 39 | http://ecomapi.thedsacademy.in:9000/ 40 | http://43.205.64.249:9000/ 41 | 42 | 43 | ## Installing apache 44 | 45 | sudo apt install apache2 46 | 47 | # sudo vim /etc/apache2/sites-available/000-default.conf 48 | 49 | ServerName ecomadmin.thedsacademy.in 50 | ServerAdmin webmaster@localhost 51 | DocumentRoot /var/www/html/dashboard 52 | 53 | 54 | # Setup Permission 55 | sudo cp -r /home/ubuntu/codes/saleor-dashboard/build/dashboard dashboard/ 56 | cd /var/www/html/ 57 | sudo chown -R ubuntu:ubuntu dashboard/ 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /3.5/saleor_react_storefront.txt: -------------------------------------------------------------------------------- 1 | * Install nvm 2 | * Install node 16 3 | * setup code 4 | * 5 | 6 | 7 | 8 | * Install nvm 9 | how-to-install-nvm-on-ubuntu-20-04/ 10 | sudo apt install curl 11 | curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash 12 | source ~/.profile 13 | 14 | nvm install node 15 | node --version # 18.5 16 | 17 | # Install node 16 18 | nvm install 16 19 | nvm use 16 20 | 21 | * setup code 22 | Repo: https://github.com/saleor/react-storefront 23 | 24 | git clone https://github.com/saleor/react-storefront 25 | nvm use 16 26 | npm install -g pnpm 27 | cd react-storefront/ 28 | pnpm i 29 | # Create file .env.local 30 | 31 | echo 'NEXT_PUBLIC_API_URI=http://ecomapi.thedsacademy.in:8080/graphql/' >> .env.local 32 | 33 | pnpm dev 34 | 35 | # Verify: 36 | http://ecomapi.thedsacademy.in:3001 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /3.5/setup_saleor_core_3.5.txt: -------------------------------------------------------------------------------- 1 | ### Steps to setup Saleor core 3.5 omn Ubuntu 20 with python 3.8.13 uysing pyenv 2 | 3 | * Update apt-get 4 | * Install Postgres 5 | * Install pyenv 6 | * Setup Virtualenv and Code 7 | * Lets setup Django Env and run the server 8 | 9 | 10 | 11 | ** Update apt-get 12 | sudo add-apt-repository ppa:deadsnakes/ppa 13 | sudo apt-get update 14 | sudo apt-get -y upgrade 15 | 16 | * Install Postgres 17 | sudo apt install postgresql 18 | 19 | # Setup postgres user. 20 | sudo su - postgres 21 | 22 | psql 23 | 24 | 25 | CREATE ROLE saleor WITH LOGIN PASSWORD 'saleor'; 26 | CREATE DATABASE saleor; 27 | ALTER USER saleor WITH SUPERUSER; 28 | 29 | GRANT ALL PRIVILEGES ON DATABASE saleor TO saleor; 30 | ALTER USER saleor CREATEDB; 31 | 32 | * Install pyenv 33 | sudo apt-get install git python3-pip make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev curl 34 | sudo pip install virtualenvwrapper 35 | 36 | git clone https://github.com/yyuu/pyenv.git ~/.pyenv 37 | git clone https://github.com/yyuu/pyenv-virtualenvwrapper.git ~/.pyenv/plugins/pyenv-virtualenvwrapper 38 | 39 | echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc 40 | echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc 41 | echo 'eval "$(pyenv init -)"' >> ~/.bashrc 42 | echo 'pyenv virtualenvwrapper' >> ~/.bashrc 43 | 44 | exec $SHELL 45 | 46 | * Download and use 3.8.13 47 | pyenv install 3.8.13 48 | 49 | If missing _ctype error, use 50 | https://stackoverflow.com/questions/67807596/pyenv-install-3-x-build-failed-ubuntu-20-04-using-python-build-20180424 51 | 52 | 53 | 54 | * Setup code 55 | mkdir -p codes/backend 56 | cd codes/backend 57 | echo '3.8.13' >> .python-version 58 | python -m venv venv 59 | source venv/bin/activate 60 | git clone https://github.com/mirumee/saleor.git 61 | cd saleor 62 | git fetch origin 3.5:3.5 && git checkout 3.5 63 | pip install -r requirements_dev.txt 64 | 65 | ** Package which starts giving error, can be install manually. 66 | # To solve psycopg2 error, 67 | sudo apt install libpq-dev 68 | 69 | * check by command 70 | python manage.py shell 71 | 72 | 73 | * All installation done. 74 | Lets setup Django Env and run the server 75 | 76 | Add ENV variables. 77 | # MyServer ip = 3.110.167.112 78 | export ALLOWED_HOSTS=ecom.thedsacademy.in,ecomapi.thedsacademy.in,ecomadmin.thedsacademy.in 79 | export ALLOWED_CLIENT_HOSTS=ecom.thedsacademy.in,ecomapi.thedsacademy.in,ecomadmin.thedsacademy.in' 80 | export DEBUG=True 81 | export SECRET_KEY='your_secret_key' 82 | export INTERNAL_IPS=127.0.0.1,ecom.thedsacademy.in,ecomapi.thedsacademy.in,ecomadmin.thedsacademy.in 83 | export DEFAULT_COUNTRY=IN 84 | export DEFAULT_CURRENCY=INR 85 | 86 | Apply Migrations 87 | python manage.py migrate 88 | Runserver: 89 | python manage.py runserver 0.0.0.0:8080 90 | 91 | 92 | Verify: 93 | 94 | browse 3.110.167.112:8080 95 | * Don't forget to add port 8080 to Ec2 inbound security rule. 96 | 97 | source ~/.bashrc 98 | source /home/ubuntu/codes/backend/venv/bin/activate 99 | 100 | python /home/ubuntu/codes/backend/saleor/manage.py runserver 0.0.0.0:8080 101 | 102 | # Populate the sample data 103 | python manage.py populatedb 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /Apache connfig files/.env: -------------------------------------------------------------------------------- 1 | ALLOWED_HOSTS=127.0.0.1,api.pricemenu.in 2 | ALLOWED_CLIENT_HOSTS=api.pricemenu.in 3 | DEBUG=False 4 | SECRET_KEY=123456789 5 | INTERNAL_IPS=127.0.0.1,api.pricemenu.in, 6 | API_URI=https://api.pricemenu.in/graphql/ 7 | APP_MOUNT_URI=/dashboard/ 8 | DEFAULT_COUNTRY=IN 9 | DEFAULT_CURRENCY=INR 10 | -------------------------------------------------------------------------------- /Apache connfig files/apache_config: -------------------------------------------------------------------------------- 1 | 2 | 3 | ServerName www.example.com 4 | ServerAdmin webmaster@localhost 5 | DocumentRoot /var/www/html/storefront 6 | ErrorLog ${APACHE_LOG_DIR}/error.log 7 | CustomLog ${APACHE_LOG_DIR}/access.log combined 8 | 9 | 10 | Options Indexes FollowSymLinks MultiViews 11 | AllowOverride All 12 | Require all granted 13 | 14 | 15 | 16 | 17 | ServerName admin.example.com 18 | ServerAdmin webmaster@localhost 19 | DocumentRoot /var/www/html/dashboard 20 | ErrorLog ${APACHE_LOG_DIR}/error.log 21 | CustomLog ${APACHE_LOG_DIR}/access.log combined 22 | 23 | 24 | Options Indexes FollowSymLinks MultiViews 25 | AllowOverride All 26 | Require all granted 27 | 28 | 29 | 30 | 31 | ServerName api.example.com 32 | 33 | Alias /static /path/to/static/ 34 | 35 | Require all granted 36 | 37 | 38 | 39 | 40 | Require all granted 41 | 42 | 43 | 44 | 45 | WSGIDaemonProcess ecomapp python-path=/path/to/manage.py python-home=/path/to/venv 46 | WSGIScriptAlias / /path/to/venv/wsgi.py 47 | WSGIProcessGroup ecomapp 48 | WSGIPassAuthorization On 49 | 50 | -------------------------------------------------------------------------------- /Apache connfig files/apache_config2: -------------------------------------------------------------------------------- 1 | 2 | 3 | ServerName www.pricemenu.in 4 | ServerAdmin webmaster@localhost 5 | DocumentRoot /var/www/html/storefront 6 | ErrorLog ${APACHE_LOG_DIR}/error.log 7 | CustomLog ${APACHE_LOG_DIR}/access.log combined 8 | 9 | 10 | Options Indexes FollowSymLinks MultiViews 11 | AllowOverride All 12 | Require all granted 13 | 14 | 15 | 16 | 17 | ServerName admin.pricemenu.in 18 | ServerAdmin webmaster@localhost 19 | DocumentRoot /var/www/html/dashboard 20 | ErrorLog ${APACHE_LOG_DIR}/error.log 21 | CustomLog ${APACHE_LOG_DIR}/access.log combined 22 | 23 | 24 | Options Indexes FollowSymLinks MultiViews 25 | AllowOverride All 26 | Require all granted 27 | 28 | 29 | 30 | 31 | ### Installl sudo apt-get install python3-pip apache2 libapache2-mod-wsgi-py3 32 | ## Enable sudo a2enmod wsgi 33 | 34 | ServerName api.pricemenu.in 35 | DocumentRoot /home/ubuntu/codes/backend/saleor 36 | ErrorLog ${APACHE_LOG_DIR}/error.log 37 | CustomLog ${APACHE_LOG_DIR}/access.log combined 38 | Alias /static /home/ubuntu/codes/backend/saleor/saleor/static 39 | Alias /media /home/ubuntu/codes/backend/saleor/media 40 | 41 | Require all granted 42 | 43 | 44 | Require all granted 45 | 46 | 47 | Require all granted 48 | 49 | WSGIDaemonProcess saleor python-path=/home/ubuntu/codes/backend/saleor python-home=/home/ubuntu/codes/backend/venv 50 | WSGIProcessGroup saleor 51 | WSGIScriptAlias / /home/ubuntu/codes/backend/saleor/saleor/wsgi/__init__.py 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /Apache connfig files/modify setting.py: -------------------------------------------------------------------------------- 1 | # saleor/setting.py 2 | 3 | ## Add these below just above def get_list(text): function 4 | try: 5 | from decouple import RepositoryEnv 6 | file_path = os.path.normpath(os.path.join(os.path.dirname(__file__), "..")) 7 | #print("{}/.env".format(file_path)) 8 | for k,v in RepositoryEnv("{}/.env".format(file_path)).data.items(): 9 | #print(k, v) 10 | os.environ[k] = v 11 | except Exception as e: 12 | # print(e) 13 | pass 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # saleor_course_resources 2 | This repo contains the small gist files which are required while installing and running Saleor Commerce 3 | -------------------------------------------------------------------------------- /nginx config files/nginx_config: -------------------------------------------------------------------------------- 1 | ### default 2 | 3 | server { 4 | listen 80 default_server; 5 | listen [::]:80 default_server; 6 | server_name www.pricemenu.in; 7 | root /var/www/html/storefront; 8 | index index.html; 9 | location / { 10 | try_files $uri $uri/ /index.html?$args; 11 | } 12 | } 13 | 14 | 15 | ### admin. 16 | ## sudo ln -s /etc/nginx/sites-available/admin /etc/nginx/sites-enabled/ 17 | server { 18 | listen 80 default_server; 19 | listen [::]:80 default_server; 20 | server_name admin.pricemenu.in; 21 | root /var/www/html/dashboard; 22 | index index.html; 23 | location / { 24 | try_files $uri $uri/ /index.html?$args; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /nginx config files/nginx_config.txt: -------------------------------------------------------------------------------- 1 | # https://uwsgi-docs.readthedocs.io/en/latest/tutorials/Django_and_nginx.html 2 | 3 | 4 | sudo apt-get install nginx 5 | sudo /etc/init.d/nginx start # start nginx 6 | 7 | ### create file /etc/nginx/sites-available/ 8 | 9 | # /etc/nginx/sites-available/pricemenu.conf 10 | 11 | # the upstream component nginx needs to connect to 12 | upstream django { 13 | # server unix:///path/to/your/mysite/mysite.sock; # for a file socket 14 | server 127.0.0.1:8080; # for a web port socket (we'll use this first) 15 | } 16 | 17 | # configuration of the server 18 | server { 19 | # the port your site will be served on 20 | listen 8080; 21 | # the domain name it will serve for 22 | server_name api.pricemenu.in; # substitute your machine's IP address or FQDN 23 | charset utf-8; 24 | 25 | # max upload size 26 | client_max_body_size 75M; # adjust to taste 27 | 28 | # Django media 29 | location /media { 30 | alias /home/ubuntu/codes/backend/saleor/media; # your Django project's media files - amend as required 31 | } 32 | 33 | location /static { 34 | alias /home/ubuntu/codes/backend/saleor/static; # your Django project's static files - amend as required 35 | } 36 | 37 | # Finally, send all non-media requests to the Django server. 38 | location / { 39 | uwsgi_pass django; 40 | include /home/ubuntu/codes/backend/saleor/uwsgi_params; # the uwsgi_params file you installed 41 | } 42 | } 43 | 44 | 45 | ### 46 | create /home/ubuntu/codes/backend/saleor/uwsgi_params file. 47 | 48 | uwsgi_param QUERY_STRING $query_string; 49 | uwsgi_param REQUEST_METHOD $request_method; 50 | uwsgi_param CONTENT_TYPE $content_type; 51 | uwsgi_param CONTENT_LENGTH $content_length; 52 | 53 | uwsgi_param REQUEST_URI $request_uri; 54 | uwsgi_param PATH_INFO $document_uri; 55 | uwsgi_param DOCUMENT_ROOT $document_root; 56 | uwsgi_param SERVER_PROTOCOL $server_protocol; 57 | uwsgi_param REQUEST_SCHEME $scheme; 58 | uwsgi_param HTTPS $https if_not_empty; 59 | 60 | uwsgi_param REMOTE_ADDR $remote_addr; 61 | uwsgi_param REMOTE_PORT $remote_port; 62 | uwsgi_param SERVER_PORT $server_port; 63 | uwsgi_param SERVER_NAME $server_name; 64 | 65 | 66 | 67 | 68 | uwsgi --socket mysite.sock --module saleor.wsgi --chmod-socket=666 69 | 70 | -------------------------------------------------------------------------------- /nginx config files/nginx_pricemenu_steps: -------------------------------------------------------------------------------- 1 | install uwsgi # # https://uwsgi-docs.readthedocs.io/en/latest/tutorials/Django_and_nginx.html 2 | Setup nginx config file. 3 | create mysite.sock 4 | 5 | setup pm2 service. -------------------------------------------------------------------------------- /run_dashboard.sh: -------------------------------------------------------------------------------- 1 | export APP_MOUNT_URI=/dashboard/ 2 | export API_URI=http://3.6.136.178:8000/graphql/ 3 | 4 | cd /home/ubuntu/codes/backend/saleor-dashboard && npm start -------------------------------------------------------------------------------- /run_storefront.sh: -------------------------------------------------------------------------------- 1 | export APP_MOUNT_URI=/dashboard/ 2 | export API_URI=http://3.6.136.178:8000/graphql/ 3 | cd /home/ubuntu/codes/backend/storefront && npm start -------------------------------------------------------------------------------- /saleor_bash_rc_updates.txt: -------------------------------------------------------------------------------- 1 | # Update below variables in ~/.bashrc file. 2 | # change below x.x.x.x to your server ip or 127.0.0.1 for localhost 3 | export ALLOWED_HOSTS=x.x.x.x 4 | export ALLOWED_CLIENT_HOSTS=x.x.x.x 5 | export DEBUG=True 6 | export SECRET_KEY=123456 7 | export INTERNAL_IPS=127.0.0.1,x.x.x.x, 8 | export DEFAULT_COUNTRY=IN 9 | export DEFAULT_CURRENCY=INR 10 | export APP_MOUNT_URI=/dashboard/ 11 | export API_URI=http://x.x.x.x:8000/graphql/ 12 | -------------------------------------------------------------------------------- /saleor_core.sh: -------------------------------------------------------------------------------- 1 | cd /home/ubuntu/codes/backend/saleor 2 | source /home/ubuntu/codes/backend/venv/bin/activate 3 | export ALLOWED_HOSTS=3.6.136.178 4 | export ALLOWED_CLIENT_HOSTS=3.6.136.178 5 | export DEBUG=True 6 | export SECRET_KEY=123456 7 | export INTERNAL_IPS=127.0.0.1,3.6.136.178, 8 | export API_URI=http://3.6.136.178:8000/graphql/ 9 | export APP_MOUNT_URI=/dashboard/ 10 | export DEFAULT_COUNTRY=IN 11 | export DEFAULT_CURRENCY=INR 12 | python manage.py runserver 0.0.0.0:8000 13 | -------------------------------------------------------------------------------- /saleor_storefront_install.txt: -------------------------------------------------------------------------------- 1 | # setup storefront 2 | git clone https://github.com/mirumee/saleor-storefront.git 3 | cd saleor-storefront 4 | git checkout 2.10.1 5 | npm i 6 | vim package.json : --host 0.0.0.0 7 | npm start 8 | -------------------------------------------------------------------------------- /setup_saleor_core.txt: -------------------------------------------------------------------------------- 1 | # Installing python and other essentials 2 | https://www.digitalocean.com/community/tutorials/how-to-install-python-3-and-set-up-a-programming-environment-on-an-ubuntu-18-04-server 3 | 4 | sudo add-apt-repository ppa:deadsnakes/ppa 5 | sudo apt-get update 6 | sudo apt-get -y upgrade 7 | 8 | sudo apt-get install python3.7 libpython3.7-dev python3-all-dev 9 | 10 | 11 | sudo apt install virtualenv 12 | sudo apt install postgresql 13 | sudo apt install uwsgi 14 | sudo apt-get install build-essential python3-dev 15 | 16 | # Required for 2.11 and above. 17 | sudo apt-get install libpangocairo-1.0-0 18 | 19 | 20 | ### Setup Node 21 | ### insatalling node. 22 | sudo apt install npm 23 | 24 | ## installing NVM 25 | curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash 26 | 27 | source ~/.profile 28 | source ~/.bashrc 29 | nvm install v12 30 | 31 | 32 | 33 | 34 | 35 | ### Setup Code 36 | mkdir -p codes/backend 37 | cd codes/backend 38 | virtualenv -p python3.7 venv 39 | source venv/bin/activate 40 | git clone https://github.com/mirumee/saleor.git 41 | cd saleor 42 | git fetch origin 2.10:2.10 && git checkout 2.10 43 | pip install -r requirements.txt 44 | 45 | ### settiing up postgres user. 46 | 47 | sudo su - postgres 48 | psql 49 | 50 | 51 | CREATE ROLE saleor WITH LOGIN PASSWORD 'saleor'; 52 | CREATE DATABASE saleor; 53 | ALTER USER saleor WITH SUPERUSER; 54 | 55 | GRANT ALL PRIVILEGES ON DATABASE saleor TO saleor; 56 | ALTER USER saleor CREATEDB; 57 | 58 | ## Export these variables to os. 59 | 60 | export ALLOWED_HOSTS=13.127.7.177 61 | export ALLOWED_CLIENT_HOSTS=13.127.7.177 62 | export DEBUG=True 63 | export SECRET_KEY='your_secret_key' 64 | export INTERNAL_IPS=127.0.0.1,13.127.7.177, 65 | export DEFAULT_COUNTRY=IN 66 | export DEFAULT_CURRENCY=INR 67 | 68 | 69 | ### Applying migrations 70 | python manage.py migrate 71 | 72 | ## create dummy data 73 | python manage.py populatedb 74 | 75 | ## Create superuser 76 | python manage.py createsuperuser 77 | 78 | ## runserver 79 | python manage.py runserver 0.0.0.0:8000 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /steps_t_install_mod_wsgi_for_python_3.7.txt: -------------------------------------------------------------------------------- 1 | 1. cd ~ 2 | 2. wget https://github.com/GrahamDumpleton/mod_wsgi/archive/4.7.1.tar.gz. # get latest version from github releases. 3 | 3. tar xvfz 4.7.1.tar.gz 4 | 4. cd mod_wsgi-4.7.1 5 | 6 | # check python3 version 7 | 5. which python3 or which python 3.7. # output -> /usr/bin/python3.7 8 | 6. ./configure --with-python=/usr/bin/python3.7 9 | 7. sudo make 10 | 8. sudo make install 11 | 12 | ## Tada..Mod_wsgi installed for python3.7 --------------------------------------------------------------------------------