Skip to main content

Deployment

note

Follow Deployment Best Practices Checklist to ensure you’ve implemented proper observability, performance optimizations, and security measures.

Prerequisite

Pre-deployment

Once you have completed the development and local testing of your extension, the next step is to deploy it to a cloud provider of your choice.

Key considerations for production deployment:

Configuration of Database System

You need to configure a database system before proceeding with deployment. While partners can choose any database solution that best fits their use case, we are configuring Redis because Redis is commonly used for caching, real-time data processing, and session management due to its high performance and in-memory data storage capabilities.

  • In the boilerplate codebase, open the server.js file and replace the default FDK setup configuration with Redis integration logic. This is required to enable Redis-based session or data storage within your extension.
const RedisStorage = require('@gofynd/fdk-extension-javascript/express/storage/redis_storage');
const redis = require('redis');

const redisClient = redis.createClient({
host: process.env.REDIS_HOST,
port: process.env.REDIS_PORT,
password: process.env.REDIS_PASSWORD,
});

const fdkExtension = setupFdk({
api_key: process.env.EXTENSION_API_KEY,
api_secret: process.env.EXTENSION_API_SECRET,
base_url: process.env.EXTENSION_BASE_URL,
cluster: process.env.FP_API_DOMAIN,
callbacks: {
auth: async (req) => {
if (req.query.application_id)
return `${req.extension.base_url}/company/${req.query['company_id']}/application/${req.query.application_id}`;
else
return `${req.extension.base_url}/company/${req.query['company_id']}`;
},
uninstall: async (req) => {
// Cleanup tasks
}
},
storage: new RedisStorage(redisClient, "example-fynd-platform-extension"), // add your prefix
access_mode: "offline",
webhook_config: {
api_path: "/api/webhook-events",
notification_email: "abc@gofynd.com",
event_map: {
'application/courier-partner/assign': {
handler: webhookHandler.courierPartnerAsign,
version: '1',
},
'application/courier-partner/cancel': {
handler: webhookHandler.courierPartnerCancel,
version: '1',
}
}
},
});

Configuration of Docker to Deploy Image to Registry

Docker allows you to containerize your application, making it easy to build, run, and deploy in any environment. Using the preconfigured Dockerfile in the boilerplate, you can quickly package your application and consistently deploy it across local, staging, or production environments.

Do the following steps to build, run, and push the Docker image to your selected container registry.

  1. Run the following command to build Docker image:
docker build -t your-app-name
  1. Run the following command to Docker Container Locally to verify the container runs correctly (Optional):
docker run -p 3000:3000 your-app-name
  1. Push the Docker image using the following command based on the cloud provider you have chosen in Pre-deployment:
aws ecr get-login-password --region your-region | docker login --username AWS --password-stdin your-account-id.dkr.ecr.your-region.amazonaws.com
docker tag your-app-name:latest your-account-id.dkr.ecr.your-region.amazonaws.com/your-app-name:latest
docker push your-account-id.dkr.ecr.your-region.amazonaws.com/your-app-name:latest

Deployment Methods

We recommend deploying your extension in a serverless manner for scalability and cost-effectiveness. Learn more about our Recommended Deployment Methods.


Was this section helpful?