Skip to main content

Marketplace Backend Deployment

Method 1 - Manual deployment (docker-compose)

Step 1 - Run the Migrations

3- run the queries in server/db/migrations folder on the indexer db.

Step 2 - Install the Nginx

1 -

apt update
apt install
apt install nginx

Note: you can verify the installation of the nginx by going to the server IP in the browser.

2 - install the UFW (Uncomplicated Firewall)

apt install ufw

3 - to verify if it’s install:

ufw status

4 - to allow port 22 for users to login to the server:

ufw allow 22

5 - to enable the ufw:

ufw enable

6 - to allow Nginx ports:

ufw allow 'Nginx Full'

Step 3 - Install the Docker Engine

if the docker engine is not installed on the server, see this link to see how to install the docker engine.

Step 4 - Clone the Repo

Marketplace Backend repo

Step 5 - Fill out the .env variables

  1. Open the server/.env.example file, then copy and fill out all the variables into the server/.env file.

Step 6 - Manage DNS

  1. go to the Cloudflare or wherever you can manage your domain’s DNS to add a A record points to your backend server IP.

Step 7 - Run the Backend Container

  1. Run the docker compose up --no-deps --build -d command in the root of the project.

  2. go to the backend domain pointing to your server on the port that the backend is running to see the server is running. but we need to have a reverse proxy so that if we enter the backend domain, it shows the app which is running.

Step 8 - Set up the Reverse Proxy

1 -

cd /etc/nginx
unlink sites-enabled/default
systemctl restart nginx
cd sites-available
nano poplymarketplaceapi
server {
listen 80;

server_name api.poply.xyz;

location / {
proxy_pass http://localhost:6001;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; # to get the real ip of the user
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # to get the real ip of the user
}
}

2 - create a softlink in the sites-enabled/poplymarketplaceapi pointing to sites-available/poplymarketplaceapi file.

ln -s /etc/nginx/sites-available/poplymarketplaceapi /etc/nginx/sites-enabled/poplymarketplaceapi
systemctl restart nginx

3 - run the backend and then visit the backend domain to see server is running.

Step 9 - Secure Nginx with Let’s encrypt

1 -

apt install certbot python3-certbot-nginx

certbot --nginx -d api.poply.xyz

2 - Run the backend again to see if the SSL is working for the backend domain.