{"id":18767647,"url":"https://github.com/accelero-cloud/tutorials","last_synced_at":"2025-12-09T19:30:17.032Z","repository":{"id":35706407,"uuid":"140902126","full_name":"accelero-cloud/tutorials","owner":"accelero-cloud","description":null,"archived":false,"fork":false,"pushed_at":"2022-12-08T02:53:10.000Z","size":206,"stargazers_count":2,"open_issues_count":13,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-29T06:45:55.931Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/accelero-cloud.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-13T23:51:58.000Z","updated_at":"2020-01-12T09:46:28.000Z","dependencies_parsed_at":"2023-01-16T03:32:01.051Z","dependency_job_id":null,"html_url":"https://github.com/accelero-cloud/tutorials","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/accelero-cloud%2Ftutorials","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/accelero-cloud%2Ftutorials/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/accelero-cloud%2Ftutorials/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/accelero-cloud%2Ftutorials/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/accelero-cloud","download_url":"https://codeload.github.com/accelero-cloud/tutorials/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239671281,"owners_count":19677870,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T19:08:06.667Z","updated_at":"2025-12-09T19:30:16.974Z","avatar_url":"https://github.com/accelero-cloud.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tutorial\n\nThe following tutorial contains 4 microservices implemented with the help of\n[appkernel](https://github.com/accelero-cloud/appkernel), which together serve as a product order-processing, \npayment and shipping solution.\n  \n\n![microservices](./doc/assets/tutorial.png)\n\nThe [Order Service](checkout/orders/order_service.py) is responsible for receiving the original request and orchestrate \nthe process with all the other services:\n1. reserve the products in the [Inventory Service](checkout/inventory/inventory_service.py);\n2. carry out the payment, using the [Payment Service](checkout/payments/payment_service.py);\n3. request the shipping of the goods at the [Shipping Service](checkout/shipping/shipping_service.py);\n4. the [Shipping Service](checkout/shipping/shipping_service.py) will finalise the reservation at the [Inventory Service](checkout/inventory/inventory_service.py);\n\nWith a minimal amount code we get logging, configuration, command line management, persistence, REST communication and much more.\nFor more details check out the [roadmap](https://github.com/accelero-cloud/appkernel/blob/master/docs/roadmap.md).\n\n## Run it in your development environment\n\n### Install requirements\n\n#### Docker image for Mongo DB\n```bash\ndocker create -v ~/data:/data/db -p 27017:27017 --name mongo mongo\ndocker start mongo\n```\n\n#### Virtual environment and required packages\n```bash\ngit clone git@github.com:accelero-cloud/tutorials.git\ncd tutorials\nvirtualenv -p python3 venv\nsource venv/bin/activate\npip install -U appkernel\npip install money\n```\n\n#### Start the services\n```bash\npython3 order_service_tutorial.py\n```\n\nAnd call the Order Service endpoint with CURL:\n```bash\ncurl -i -X POST -H \"Content-Type:application/json\" \\\n   -d '{\n    \"_type\": \"tutorials.order_service.Order\",\n    \"delivery_address\": {\n        \"_type\": \"tutorials.models.Address\",\n        \"city\": \"Big City\",\n        \"country\": \"Country\",\n        \"first_name\": \"John\",\n        \"last_name\": \"Doe\",\n        \"postal_code\": \"1234\",\n        \"street\": \"some address 8\"\n    },\n    \"id\": \"Oc2e5b438-8d12-4533-b085-c38add1e126d\",\n    \"order_date\": \"2018-09-04T18:51:18.547186\",\n    \"payment_method\": {\n        \"_type\": \"tutorials.models.Payment\",\n        \"customer_id\": \"1234567890123456789012\",\n        \"customer_secret\": \"120\",\n        \"method\": \"PAYPAL\"\n    },\n    \"products\": [\n        {\n            \"_type\": \"tests.test_util.Product\",\n            \"code\": \"BTX\",\n            \"name\": \"t-shirt\",\n            \"price\": {\n                \"_type\": \"money.money.Money\",\n                \"amount\": 10,\n                \"currency\": \"EUR\"\n            },\n            \"size\": \"M\"\n        },\n        {\n            \"_type\": \"tests.test_util.Product\",\n            \"code\": \"BTX\",\n            \"name\": \"t-shirt\",\n            \"price\": {\n                \"_type\": \"money.money.Money\",\n                \"amount\": 12,\n                \"currency\": \"EUR\"\n            },\n            \"size\": \"L\"\n        }\n    ]\n}\n' 'http://127.0.0.1:5000/orders/'\n```\n**You should see the following result**\n```bash\nHTTP/1.1 100 Continue\n\nHTTP/1.0 201 CREATED\nContent-Type: application/json\nContent-Length: 87\nServer: Werkzeug/0.14.1 Python/3.7.0\nDate: Tue, 11 Sep 2018 14:17:43 GMT\n\n{\n  \"_type\": \"OperationResult\",\n  \"result\": \"Oc2e5b438-8d12-4533-b085-c38add1e126d\"\n}\n```\n\n## Run it as a set of docker services\n\n[Check out the details here](https://github.com/accelero-cloud/tutorials/tree/master/containers)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faccelero-cloud%2Ftutorials","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faccelero-cloud%2Ftutorials","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faccelero-cloud%2Ftutorials/lists"}