Skip to content

Commit

Permalink
Add quickstart development instructions (#2)
Browse files Browse the repository at this point in the history
* feat: add tutor devstack quickstart

* Remove tvm dependancy

---------

Co-authored-by: Salah Alomari <[email protected]>
  • Loading branch information
OmarIthawi and Salah Alomari authored Dec 20, 2023
1 parent fa98ec0 commit dc42625
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 3 deletions.
21 changes: 18 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ When the testing account is used,
Development and Testing
#######################

TBD: Add devstck and Tutor instructions.


To run tests locally in your machine, you need to install the following dependencies::

$ pip install tox
Expand All @@ -58,6 +55,24 @@ To run quality quality::
$ tox -e py38 -- tests/unit/test_payfort_utils.py


Tutor Devstack Installation Instructions
########################################

You need to have
`Tutor requirements such as Docker <https://docs.tutor.edly.io/install.html#requirements>`_.

Run the following commands::

cd ~/work/
sudo pip install tutor==13.3.2
mkdir payfort && cd payfort
git clone [email protected]:Zeit-Labs/ecommerce-payfort.git
git clone --branch=open-release/maple.nelp [email protected]:eduNEXT/ecommerce.git
git clone --branch=nelp/maple [email protected]:eduNEXT/tutor-discovery discovery
bash ecommerce-payfort/tutor_plugin/tutor_quickstart.sh



Installation and usage
######################

Expand Down
3 changes: 3 additions & 0 deletions tutor_plugin/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This is hacky plugin to install ecommerce-payfort into Tutor Maple v13.

Follow the ecommerce-payfort/README.rst instructions to install the plugin.
6 changes: 6 additions & 0 deletions tutor_plugin/docker-compose.override.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: "3.7"
services:
ecommerce:
volumes:
- PAYFORT_PACKAGE_DIR:/openedx/ecommerce-payfort
- ECOMMERCE_DIR:/openedx/ecommerce
15 changes: 15 additions & 0 deletions tutor_plugin/ecommerce-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
cybersource:
merchant_id: SET-ME-PLEASE
flex_shared_secret_key_id: SET-ME-PLEASE
flex_shared_secret_key: SET-ME-PLEASE
soap_api_url: https://ics2wstest.ic3.com/commerce/1.x/transactionProcessor/CyberSourceTransaction_1.140.wsdl
transaction_key: SET-ME-PLEASE
paypal:
cancel_checkout_path: /checkout/cancel-checkout/
client_id: SET-ME-PLEASE
client_secret: SET-ME-PLEASE
error_url: /checkout/error/
mode: sandbox
receipt_url: /checkout/receipt/
payfort:
some_configs: "Yes, payfort's working!"
2 changes: 2 additions & 0 deletions tutor_plugin/plugin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from tutor import hooks

49 changes: 49 additions & 0 deletions tutor_plugin/tutor_quickstart.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
set -e

SCRIPT_DIR="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
PAYFORT_PACKAGE_DIR="$(dirname "$SCRIPT_DIR")"
ECOMMERCE_DIR="$(dirname "$PAYFORT_PACKAGE_DIR")/ecommerce"

##if [ -z "$TVM_PROJECT_ENV" ]; then
## echo "Error: activate tvm project environment first: "
## echo
## echo " $ source .tvm/bin/activate"
## echo
## exit 1
##fi


set -x


tutor config save \
--set 'ECOMMERCE_EXTRA_PIP_REQUIREMENTS=["-e /openedx/ecommerce-payfort"]'

cat "$SCRIPT_DIR/docker-compose.override.yml" \
| sed -e "s|PAYFORT_PACKAGE_DIR|${PAYFORT_PACKAGE_DIR}|g" \
| sed -e "s|ECOMMERCE_DIR|${ECOMMERCE_DIR}|g" \
> "$(tutor config printroot)/env/dev/docker-compose.override.yml"

pip install \
tutor-mfe==13.0.6 \
tutor-ecommerce==13.0.1

pip install -e discovery

tutor plugins enable ecommerce
tutor plugins enable discovery
tutor plugins enable mfe
tutor config save --set "DISCOVERY_DB_PREVIOUS_PARTNERS=false" # NELC specific setting: https://github.com/eduNEXT/tutor-discovery/pull/1

tutor config save --set "ECOMMERCE_PAYMENT_PROCESSORS=$(cat "$SCRIPT_DIR/ecommerce-config.yml")"
tutor config save

tutor dev quickstart --non-interactive

tutor dev createuser --staff --superuser edx [email protected] --password edx

tutor dev importdemocourse

tutor dev run ecommerce npm install
tutor dev run ecommerce ./node_modules/.bin/bower install --allow-root
tutor dev run ecommerce python3 manage.py update_assets --skip-collect

0 comments on commit dc42625

Please sign in to comment.