Giter VIP home page Giter VIP logo

dockersamples / atsea-sample-shop-app Goto Github PK

View Code? Open in Web Editor NEW
685.0 53.0 678.0 7.23 MB

A sample app that uses a Java Spring Boot backend connected to a database to display a fictitious art shop with a React front-end.

License: Apache License 2.0

Java 40.82% CSS 5.55% HTML 0.67% JavaScript 8.19% Shell 0.33% PowerShell 2.91% Ruby 1.11% C# 38.02% ASP 0.09% Dockerfile 2.32%
java spring-boot react docker swarm-mode

atsea-sample-shop-app's Introduction

AtSea Shop Demonstration Application

The AtSea Shop is a demonstration application comprised of:

  • Java REST application written using Spring-Boot,
  • a database for product inventory, customer data, and orders,
  • a React shopping cart,
  • a NGINX reverse proxy implementing https,
  • a payment gateway to simulate certificate management

Requirements

This example uses features in Docker 17.05 CE Edge. Install this version to run the example.

Building and Running the AtSea Shop

Secrets

This application uses Docker secrets to secure the application components. The reverse proxy requires creating a certificate that is stored as a secret and the payment also requires a password stored as a secret. To create a certificate and add as a secret:

mkdir certs

openssl req -newkey rsa:4096 -nodes -sha256 -keyout certs/domain.key -x509 -days 365 -out certs/domain.crt

docker secret create revprox_cert certs/domain.crt

docker secret create revprox_key certs/domain.key

docker secret create postgres_password certs/domain.key

To create a secret for staging the payment gateway:

echo staging | docker secret create staging_token - 

Run as an application

To run the AtSea shop as an application:

docker-compose up --build

Deploy to a swarm

#If you need to create a Swarm
docker swarm init
docker stack deploy -c docker-stack.yml atsea

A simplified development environment

This compose file creates a simplified development environment consisting of only the application server and the database.

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

The AtSea Shop

The URL for the content is http://localhost:8080/

REST API

Documentation for REST calls: REST API

atsea-sample-shop-app's People

Contributors

alicanakkus avatar jessvalarezo avatar leenamba avatar manomarks avatar spara avatar yosifkit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

atsea-sample-shop-app's Issues

wrong "compose" caption for artwork

This drawing does not represent compose, but the entire docker toolset we had back in 2014.
It's kind of a detail but I am mentioning it.

screen shot 2017-04-16 at 3 12 10 pm

Create Order endpoint and save to DB

I do not want to implement any of the Reverse Proxy / Payment features but just want the React Front End OMS coupled to the REST-Spring backend with the orders saved to the DB.

Through API the Create Order and all services are working perfectly but through the React Front End unable to store the orders in the DB.

In the CheckoutContainer.js I am seeing the comments in the Handlesubmit function :

// This data will be used for create order endpoint
// TODO: CreateOrder

Does this indicate that these functionality are yet to be implemented ?

However, on clicking on "Complete Order" I am receiving the Order Placed successfully message but the items and the orders do not appear to be getting stored on the PSQL DB. Tried incrementing the Order ID other than '0' value also.

Can anybody help me in figuring out the implementation of the Order Endpoint and how I can store it in a external DB since I am totally novice to JS and need this as a part of a Cloud project.

reverse_proxy does is misconfigured

error:

2017/07/13 20:07:30 [warn] 1#1: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1
nginx: [warn] the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1
2017/07/13 20:07:30 [emerg] 1#1: host not found in upstream "appserver" in /etc/nginx/nginx.conf:46
nginx: [emerg] host not found in upstream "appserver" in /etc/nginx/nginx.conf:46

Unable to deploy stack on a single node swarm

Following the steps described here will not lead to a running stack. Indeed, some of the services are constrained to run on worker nodes, which is not the case while running a single node swarm locally.

ERROR: Version in "./docker-compose.yml" is unsupported.

Hello,

I followed the instructions for "Docker Community Edition for Ubuntu" at https://store.docker.com/editions/community/docker-ce-server-ubuntu to install Docker on Ubuntu 16.04 LTS

I did do: $ git clone https://github.com/dockersamples/atsea-sample-shop-app.git

I followed the instructions on README.md

First issue:
$ docker secret create revprox_cert certs/domain.crt
Error response from daemon: This node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again.

So I did do: $ docker swarm init

Second issue:
$ docker-compose up --build
O programa 'docker-compose' não está instalado no momento. Você pode instalá-lo digitando:
sudo apt install docker-compose

So I did do: $ sudo apt install docker-compose

Third issue:
$ docker-compose up --build
ERROR: Version in "./docker-compose.yml" is unsupported. You might be seeing this error because you're using the wrong Compose file version. Either specify a version of "2" (or "2.0") and place your service definitions under the services key, or omit the version key and place your service definitions at the root of the file to use version 1.
For more on the Compose file format versions, see https://docs.docker.com/compose/compose-file/

How to solve this last issue, please? I think I am using the wrong docker-compose

HTTPS Support

Add in HTTPS support for web front-end that can be optionally toggled on and off via environment variables

ArrayIndexOutOfBoundsException

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.281 s
[INFO] Finished at: 2021-04-05T14:16:22Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.6:jar (default-jar) on project AtSea: Execution default-jar of goal org.apache.maven.plugins:maven-jar-plugin:2.6:jar failed: An API incompatibility was encountered while executing org.apache.maven.plugins:maven-jar-plugin:2.6:jar: java.lang.ExceptionInInitializerError: null
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.apache.maven.plugins:maven-jar-plugin:2.6
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/usr/share/maven/ref/repository/org/apache/maven/plugins/maven-jar-plugin/2.6/maven-jar-plugin-2.6.jar
[ERROR] urls[1] = file:/usr/share/maven/ref/repository/org/slf4j/slf4j-jdk14/1.5.6/slf4j-jdk14-1.5.6.jar
[ERROR] urls[2] = file:/usr/share/maven/ref/repository/org/slf4j/jcl-over-slf4j/1.5.6/jcl-over-slf4j-1.5.6.jar
[ERROR] urls[3] = file:/usr/share/maven/ref/repository/org/apache/maven/reporting/maven-reporting-api/2.2.1/maven-reporting-api-2.2.1.jar
[ERROR] urls[4] = file:/usr/share/maven/ref/repository/org/apache/maven/doxia/doxia-sink-api/1.1/doxia-sink-api-1.1.jar
[ERROR] urls[5] = file:/usr/share/maven/ref/repository/org/apache/maven/doxia/doxia-logging-api/1.1/doxia-logging-api-1.1.jar
[ERROR] urls[6] = file:/usr/share/maven/ref/repository/junit/junit/3.8.1/junit-3.8.1.jar
[ERROR] urls[7] = file:/usr/share/maven/ref/repository/commons-cli/commons-cli/1.2/commons-cli-1.2.jar
[ERROR] urls[8] = file:/usr/share/maven/ref/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar
[ERROR] urls[9] = file:/usr/share/maven/ref/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar
[ERROR] urls[10] = file:/usr/share/maven/ref/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[ERROR] urls[11] = file:/usr/share/maven/ref/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[12] = file:/usr/share/maven/ref/repository/org/codehaus/plexus/plexus-interpolation/1.11/plexus-interpolation-1.11.jar
[ERROR] urls[13] = file:/usr/share/maven/ref/repository/org/apache/maven/maven-archiver/2.6/maven-archiver-2.6.jar
[ERROR] urls[14] = file:/usr/share/maven/ref/repository/org/apache/maven/shared/maven-shared-utils/0.7/maven-shared-utils-0.7.jar
[ERROR] urls[15] = file:/usr/share/maven/ref/repository/com/google/code/findbugs/jsr305/2.0.1/jsr305-2.0.1.jar
[ERROR] urls[16] = file:/usr/share/maven/ref/repository/org/codehaus/plexus/plexus-utils/3.0.20/plexus-utils-3.0.20.jar
[ERROR] urls[17] = file:/usr/share/maven/ref/repository/org/codehaus/plexus/plexus-archiver/2.9/plexus-archiver-2.9.jar
[ERROR] urls[18] = file:/usr/share/maven/ref/repository/org/codehaus/plexus/plexus-io/2.4/plexus-io-2.4.jar
[ERROR] urls[19] = file:/usr/share/maven/ref/repository/commons-io/commons-io/2.2/commons-io-2.2.jar
[ERROR] urls[20] = file:/usr/share/maven/ref/repository/org/apache/commons/commons-compress/1.9/commons-compress-1.9.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------: Index 1 out of bounds for length 1
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.

LICENSE ?

Hey,
I would like to ask under which license it is available ? This is currently missing ;( .

Database is uninitialized

atabase_1 | Error: Database is uninitialized and superuser password is not specified.
database_1 | You must specify POSTGRES_PASSWORD to a non-empty value for the
database_1 | superuser. For example, "-e POSTGRES_PASSWORD=password" on "docker run".
database_1 |
database_1 | You may also use "POSTGRES_HOST_AUTH_METHOD=trust" to allow all
database_1 | connections without a password. This is not recommended.
database_1 |
database_1 | See PostgreSQL documentation about "trust":

curl: (7) Failed to connect to localhost port 8080: Connection refused

I deployed the atsea-sample-shop-app using the instructions provided but when I try to connect to localhost:8080 I get an error. How can I get past this error?

siddjain@goldenrwr-ca0:~/atsea-sample-shop-app$ curl http://localhost:8080
curl: (7) Failed to connect to localhost port 8080: Connection refused
siddjain@goldenrwr-ca0:~/atsea-sample-shop-app$ curl http://goldenrwr-peer1:8080
curl: (7) Failed to connect to goldenrwr-peer1 port 8080: Connection refused
siddjain@goldenrwr-ca0:~/atsea-sample-shop-app$ docker stack ps atsea
ID                  NAME                      IMAGE                                                     NODE                 DESIRED STATE       CURRENT STATE            ERROR                       PORTS
lvsocchhg467        atsea_reverse_proxy.1     dockersamples/atseasampleshopapp_reverse_proxy:latest     goldenrwr-peer1      Running             Running 20 minutes ago                               
fq6pl30hs2yh        atsea_payment_gateway.1   dockersamples/atseasampleshopapp_payment_gateway:latest   goldenrwr-orderer0   Running             Running 20 minutes ago                               
1v77pf8y56i2        atsea_visualizer.1        dockersamples/visualizer:stable                           goldenrwr-ca0        Running             Running 20 minutes ago                               
56eghx4ss6cb        atsea_appserver.1         dockersamples/atsea_app:latest                            goldenrwr-peer1      Running             Running 20 minutes ago                               
jn10asse4m82        atsea_database.1          dockersamples/atsea_db:latest                             goldenrwr-orderer0   Running             Running 20 minutes ago                               
r5fzswkbbghz        atsea_reverse_proxy.1     dockersamples/atseasampleshopapp_reverse_proxy:latest     goldenrwr-ca0        Shutdown            Failed 20 minutes ago    "task: non-zero exit (1)"   
idrg0djwuy5x        atsea_appserver.2         dockersamples/atsea_app:latest                            goldenrwr-peer0      Running             Running 20 minutes ago             

in the logs I can see

atsea_appserver.1.56eghx4ss6cb@goldenrwr-peer1    | 2019-01-15 00:51:28.379  INFO 1 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
atsea_appserver.1.56eghx4ss6cb@goldenrwr-peer1    | 2019-01-15 00:51:28.390  INFO 1 --- [           main] com.docker.atsea.AtSeaApp                : Started AtSeaApp in 14.796 seconds (JVM running for 15.926)

Stopped Working at Noon on November 4th

docker-compose up --build run in the app directory results in the following error messages. This started happening today.

atsea_appserver_1 exited with code 1
atsea_payment_gateway_1 exited with code 126
reverse_proxy_1 | 2019/11/04 18:56:22 [emerg] 1#1: host not found in upstream "appserver" in /etc/nginx/nginx.conf:46
reverse_proxy_1 | nginx: [emerg] host not found in upstream "appserver" in /e tc/nginx/nginx.conf:46
atsea_reverse_proxy_1 exited with code 1

create mechanism for creating an order

Let's have an order flow of:


POST /api/order/
Host: localhost:8080
Auth: basic username:password
Content-type: application/json
Accept: application/json

{
    "orderId" : 12345, // if 0 create new order
    "orderDate : {current date},
    "customerId" : "54321",
}

Returns

{
  "orderId": neworderid_
}

And for adding items we can have:


POST /api/order/
Host: localhost:8080
Auth: basic username:password
Content-type: application/json
Accept: application/json

{
    "orderId" : 12345,
    products: [
      {
        "productId" : "2",
        "quantity": _N_
}

Ahead of formal releases with sample apps?

Hi, was trying this app on docker for mac where I have the very newest version:

Client:
 Version:      17.03.1-ce
 API version:  1.27
 Go version:   go1.7.5
 Git commit:   c6d412e
 Built:        Tue Mar 28 00:40:02 2017
 OS/Arch:      darwin/amd64

Unfortunately, the new stuff has multi-build "from node:latest AS story..." format, which blows up in the released and installed version of the produce. Methinks you're going a bit too fast for a sample app. :-) I'll regress back to a commit at that time, but just wanted you to know that the advertised version of your product can't run the sample app.

Remove password in unauthorized GET customer request.

Update the api response to only show password if the user is authorized (an admin).

The following endpoints will be updated:

  • Get Customer by Name
    /api/customer/name={name}

  • Get Customer by Username
    /api/customer/username={username}

  • Get Customer
    /api/customer/{id}

Suggestion to change the PostgreSQL tcp port.

Hello,

I did do: $ docker-compose up --build

But I get the error below:

Creating atseasampleshopapp_database_1 ... error

ERROR: for atseasampleshopapp_database_1  Cannot start service database: driver failed programming external connectivity on endpoint atseasampleshopapp_database_1 (9ec759904654deab9253f3fba6684c64a3e38fe69f5ebdf022e32edf46fb12f0): Error staCreating atseasampleshopapp_payment_gateway_1 ... done

ERROR: for database  Cannot start service database: driver failed programming external connectivity on endpoint atseasampleshopapp_database_1 (9ec759904654deab9253f3fba6684c64a3e38fe69f5ebdf022e32edf46fb12f0): Error starting userland proxy: listen tcp 0.0.0.0:5432: bind: address already in use
ERROR: Encountered errors while bringing up the project.

I already have PostgreSQL installed and using tcp port 5432.

I suggest to use non default ports for PostgreSQL, and app server too.

dockerize build & run instructions

I know the readme says "(this will be improved)" but I want to make sure we're tracking this.

Shouldn't need npm installed locally to build/run this app.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.