Deploy on AWS
note
PayString was previously known as PayID.
You can set up a PayString server on AWS (Amazon Web Services) setting up your own virtual Linux server. Alternatively, you can set up a PayString server using [AWS Lambda][aws-lambda-deploy].
When you have deployed a PayString server, you can then set up NGINX Reverse Proxy and SSL for load bearing and security.
#
Requirements- An AWS account
- Your own domain, for which you can update the DNS
#
Deployment steps- Initialize a
t2.micro
instance on AWS running Ubuntu 18.04m with a minimum of 8 GB SSD. For the purposes of this demo, you can use AWS Free Tier. See Getting Started with Amazon EC2 Linux Instances for more information about setting up your instance. - Get an elastic IP address and associate it with your AWS
t2.micro
instance, as described in Step 1, part 10. - Update the DNS for your PayString domain as shown in the following table. Add any other subdomain you would like to use as a PayString as well.
Type | Name | Value | TTL |
---|---|---|---|
A | @ | your-ip-address | 600 seconds |
A | your-payString-domain | your-ip-address | 1/2 Hour |
Set your instance's firewall/security group.
- Port 80 (TCP) open for all address
- Port 8081 (Admin API access) open for your local IP address only, or closed generally, or only available inside your virtual private cloud. If port 8081 is exposed publicly it allows anybody to update your payment information, potentially leading to a loss of funds.
- Port 22 (SSH) open
SSH into your instance.
- Right-click on the instance.
- Click Connect.
- Copy the example command and run it in your local terminal. You must have local access to the private key file associated with your instance.
Install git on your instance.
sudo apt-get install git
Link the git on your instance to your GitHub account, as described in Connecting to GitHub with SSH. Follow the instructions for Generating a new SSH key and adding it to the ssh-agent.
Install docker on your instance.
Clone the Github repository:
git clone git@github.com:paystring/paystring.git
Set the docker port to 80 by modifying the
docker-compose.yml
:- Open the script editor:
nano paystring/docker-compose.yml
- Go to the
ports
property, and change:8080:8080
to80:8080
- Open the script editor:
Run this script to start PayString with a Postgres database:
npm run devEnvUp
- To bring this down, run
npm run devDown
- To bring this down, run
Check your IP address and the website in your browser to confirm the server is running. You should see a success page that looks like this.
Load up your desired PayString to the database using the Admin API. If you use a subdomain rather than a path, then you must set up a DNS record for the subdomain as described in step 3. Note: You can add PayStrings for each (pay_id, network, environment) tuple. Use this cURL command to set up a PayString.
From your local computer, run a cURL command to fetch your PayString. For example:
For other PayString API methods, see PayString API Reference.
To convert a PayString address to a URL endpoint, follow these patterns:
user$wallet.com
converts tohttps://wallet.com/user
user$subdomain.wallet.com/payid
converts tohttps://subdomain.wallet.com/payid/user
Note: Public API requests hit port 80 and Admin API requests hit port 8081 per the config in step 10. Make sure that 8081 is limited so that outsiders cannot modify your server’s database.
For additional network formats, see the API Reference.