We have created this PubSub project for you to get the feel for our platform and to get you started with the PubSub pattern.
A PubSub (Publish-Subscribe) is a messaging architecture that enables communication between multiple systems or components in a distributed system. In this type of project, publishers send messages to a central topic or channel, while subscribers receive and process those messages.
Follow the instructions below to get started.
Visit us at www.altostra.com
Happy Clouding!
Before you dive into creating cool applications with Altostra, we need to set you up first. Follow these steps:
To create an account, simply login to the Altostra Web Console.
You will use the Altostra CLI for many of the management operations.
Install it from NPM (make sure you have Node.js installed):
# make sure you have Node.js 10 or above installed
$ npm i -g @altostra/cli
Altostra Tools for Visual Studio Code integrates Altostra's visual designer and utilities into Visual Studio Code, which enables you to work on your application infrastructure side-by-side with your code.
Install it from the terminal:
$ code --install-extension Altostra.altostra
or, search for Altostra Tools
in the Visual Studio Code extensions view.
or, directly from the marketplace.
Run the following command to login:
$ alto login
Many of the commands below require you to login first.
Open the project directory in Visual Studio Code, the Altostra Designer will load automatically.
For the this part, you must first connect a cloud account in the Web Console.
When you connect your first cloud account, Altostra creates a new Production
environment for you – when you deploy to this environment resources are created on your connected account.
Create an image and a deployment.
# create a new image "v1.0" for the project
$ alto push v1.0
# deploy the image "v1.0" to a new deployment in the "Production" environment
$ alto deploy prod:v1.0 --new Production
You can now open the Altostra Web Console to browse your project and its deployments:
# open the current project in the Altostra Web Console
$ alto console
Click on the deployment name prod
in the list to open the deplyment profile page.
Under "Deployments History" you should see a single entry with the details of your deployment and the current status. The deployment might take a while to complete.
Click on the action link on the right side of the history entry to open the cloud provider's console where you can see the deployed resources and their details.
If you decide to change the design or the code of the project, you will need to upload a new version.
To do that, push a new image and update the deployment:
# create a new image "v1.1" for the project
$ alto push v1.1
# update the existing "prod" deployment with the new "v1.1" image
$ alto deploy prod:v1.1
You don't need to specify the
--new
option and the environment name when you update deployments.
You can run the project locally to try it out and play around with the code. It's a good way to debug, test and quickly iterate during development—make sure to also properly test your projects in the cloud.
To run the project locally, make sure you have these tools installed:
To start a local instance of the API, run:
# builds the project and saves the resulting SAM template to a file
$ alto build
# start an instance of API Gateway on the localhost
$ sam local start-api -t sam-template.json
If you change the project design, re-run these commands.
Run the following command to get the welcome message:
$ curl -X POST http://localhost:3000/ -d "Hello world"
Go to the DynamoDB table that were created by this project and examine that events records were created by subscribers