dockersamples / atsea-sample-shop-app Goto Github PK
View Code? Open in Web Editor NEWA 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
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
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_
}
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.
This can wait until after DockerCon but we should make the app server not crash when the database is down.
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.
[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.
Add in instructions for creating a secret, or the app won't deploy
The remove link in the list of cart items on checkout page does not work.
write an endpoint to return health check, e.g. get current time from database
e.g. in Docker file
HEALTHCHECK CMD curl --fail http://localhost:5000/health || exit 1
in compose fie:
HEALTHCHECK CMD curl --fail http://localhost:5000/health || exit 1
healthcheck:
interval: 10s
timeout: 2s
retries: 3
Checkout page should be styled to Josh's mockup
update create user to overlay landing page
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)
I get that orderId is the id number of the order. What is orderNum?
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":
Set the app to run as a non-root user.
Hey,
I would like to ask under which license it is available ? This is currently missing ;( .
Implement secrets for DB backend
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.
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.
This could be helpful:
https://github.com/docker/example-voting-app/blob/master/worker/Dockerfile.j
Instead of serving product's image as blob, give link to the image in static folder.
Add in HTTPS support for web front-end that can be optionally toggled on and off via environment variables
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.
That way when we want to visit the site we'd just go to atseashop.com
cc @ManoMarks @spara
When attempting to type in an inputfield, focus is lost after the first character.
Focus is kept after clicking again.
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
We want to avoid brand confusion, so we'll need something else. Maybe just "artshop"
URLs shouldn't be case sensitive, it just feels wrong. Might be helpful:
http://stackoverflow.com/questions/12684183/case-insensitive-mapping-for-spring-mvc-requestmapping-annotations
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}
Add in a simplified deployment without secrets
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
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.