How to Build and Run the AtSea Shop Demonstration Application

Mar 11, 2024 | Programming

Welcome to the world of e-commerce applications! The AtSea Shop is a fantastic demonstration platform showcasing various technologies such as Java REST applications, React, NGINX, and Docker. In this blog, we will explore how to bring the AtSea Shop to life and troubleshoot common issues that might arise along the way. Let’s dive in!

What You Will Need

  • Docker 17.05 CE Edge installed
  • A basic understanding of Docker and its components
  • Access to a terminal or command line interface

Setting Up the AtSea Shop

The AtSea Shop consists of multiple components working together seamlessly. Think of it like setting up a restaurant where:

  • The Java REST application is the chef cooking up delicious meals (data).
  • The database acts as the pantry, storing all the ingredients (product inventory, customer data, and orders).
  • The React shopping cart is the attentive waiter taking orders.
  • The NGINX reverse proxy serves as the restaurant’s entrance, ensuring guests enter safely (implementing HTTPS).
  • The payment gateway is the cash register, processing transactions.

Building and Running the AtSea Shop

Before you can get the restaurant up and running, you need to prepare everything. Here’s how you can do it:

1. Create Docker Secrets

For security, we need to create Docker secrets to protect sensitive information.

mkdir certs
openssl req -newkey rsa:4096 -nodes -sha256 -keyout certsdomain.key -x509 -days 365 -out certsdomain.crt
docker secret create revprox_cert certsdomain.crt
docker secret create revprox_key certsdomain.key
docker secret create postgres_password certsdomain.key
echo staging | docker secret create staging_token -

This set of commands will securely generate and store your SSL certificates and necessary passwords.

2. Run the Application

Now that you have set up your secrets, it’s time to open the restaurant:

docker-compose up --build

This command builds and starts the AtSea Shop application. You can now access it at http://localhost:8080.

3. Deploy to a Swarm

If you plan to scale your application, deploying it to a Docker Swarm is essential. To initialize a swarm, run:

docker swarm init
docker stack deploy -c docker-stack.yml atsea

Congratulations! Your AtSea Shop is now live and operating in a more resilient manner.

Setting Up a Simplified Development Environment

If you prefer a more streamlined setup for development, you can use the following command:

docker-compose --file docker-compose-dev.yml up --build

This launches only the application server with the database, making it perfect for testing and development.

API Documentation

For more details on how to interact with the AtSea Shop, check out the documentation for REST calls: REST API.

Troubleshooting

Sometimes things don’t go as planned. If you run into issues:

  • Ensure Docker is running and properly installed.
  • Double-check the commands used to create secrets and ensure paths are correct.
  • Make sure that ports are not being blocked by firewalls.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox