Skip to content

akinwilson/dcbay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dcbay

Overview

dcbay, standing for remotely deployed crypto-currencies bay, is a repository containing the infrastructure as code and application code to host a e-commerece platform with an integrated crypto-currency payment gateway - Bitcoin so far - remotely on the AWS infrastructure. To achieve this, Terraform is used as the infrastructure as code language, python for the application code - particularly utilising the library django; the full-stack development library, and docker and docker-compose. Legacy payment systems serve the interest of archaic banking systems. Whilst the trading of crypto-currencies has expontentially increased since the inception of bitcoin, their use as a means of exchange of value in business transactions as lagged behind. This could mainly be attributed two source: regulations and a lack of technical expertise. This repository aims to illuminate this required technical expertise, hopefully accelerating the adoption of cryto-currencies as a payment system.

Usage

The repository has been set up to allow contiunal development upon the platform. I.e. configuration for both a development and production environment can be found. The iac/ folder contains logic related to the infrastructure, and web/ related to the application code itself. To ensure you have all the required CLI tools, please run the script:

./check_cli_tools.sh

Development

For local development, first clone the repository and run a script that will spin up a server locally, which automatically updates to any changes made to the repository

./web/cbay/development.sh

Potentially, we may have adopted a containerised workflow for development and hence you may be able to develop upon the application code with hot-reloading enable.

cd web && docker-compose -f dc.dev.yaml up 

Deployment

Again, clone the repository. To deploy the application to AWS, you will need to provision the required resources to host the site. You will also need AWS credentials to an AWS account. First and foremost, create a state-store for terraform to use in order to remotely track the infrastructure deployed.

./iac/utils/create-s3-tf-backend-bucket.sh 

Note: this bucket has been created without terraform. Hence, you must manage and track it on your own. Deleting it when you stop hosting the site. For this, a script is provide.

Next you will next to init, plan and apply the infra deployment to AWS. You can do this by running:

terraform init
terraform plan

check the output such that you are happy with the resources that are about to be provisioned. If so, run

terraform apply

It will take some time ~5-10 minutes to provision the required AWS resources. Once it has been completely, we need to use the ssh protocol to securely connect to our EC2 instance in order to transfer over our application code. This workflow does not follow gitOps design principals but still, it allows for the deployment. The command for this will look something like:

ssh -i "~/ssh/aws-dev-key" ubuntu@ec2-3-146-3.eu-west-2.compute.amazonaws.com 

After this, we can use the scp (secure copy protocol) in order to transfer our application code to our EC2 instance.

scp -r ./web/ ubuntu@webserver:~/

and then deploy our application using the docker-compose production environment file

ubuntu@webserver: docker-compose -f dc.prod.yaml up

You can removed the deployment with

terraform destroy 

and remove the state-store bucket with:

./iac/utils/delete-s3-tf-backend-bucket.sh

Further improvements

  1. Currently, end-users of the site can only choose bitcoin as a payment option. An improvment would be to also integrate more accepted crypto-currenies like for example monero.
  2. Git synchronizer. Currently, any application code changes made to platform need to be manually update via using ssh and scp. It would be benefical to automatically synchronize with a remote git repository instead of following this manual workflow.
  3. Currently, the storage available locally to the EC2 instance is used to store the database. It would be benefical to use something like aurora to off-load the responsibility of persistence to an external service.
  4. Multi-tenancy platform. Instead of the platform allowing for a single e-commerce site to be generated, it would be benefical if user of the platform could prop-up their own store fronts, under subdomains, on the platform. Similar to shopify's business model.

TODO 21 Jan 2025:

  • Set up containerised development environment.
  • Generated script to deploy infrastructure
  • Generate script to remove infrastructure
  • write more tests for platform.
  • Integrate monero as payment option
  • Integrate multi-tenancy.

About

a repository to deploy a e-commerce site using a crypto-currency payment gateway remotely deployed to AWS.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors