GithubHelp home page GithubHelp logo

mshahzeb / web-app-2023 Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 407 KB

Sample app for the demonstration of Docker Desktop & Grafana Cloud

Dockerfile 5.31% Go 17.22% HTML 7.81% CSS 4.22% JavaScript 65.44%

web-app-2023's Introduction

Compose sample application

Use with Docker Development Environments

You can open this sample in the Dev Environments feature of Docker Desktop version 4.12 or later.

Open in Docker Dev Environments Open in Docker Dev Environments

Go server with an Nginx proxy and a MySQL database with a React Frontend

A simple web application with a React frontend and a Go + MySQL backend. Nginx server handles web requests for both React and Go.

Enabling FARO

WIP

Env variables

Create an env.local file in frontend/ and set the following values

Name Value
REACT_APP_API_URL http://localhost:8080
REACT_APP_FARO_COLLECTOR_URL https://faro-collector-prod-us-east-0.grafana.net/collect/xyz
REACT_APP_FARO_COLLECTOR_NAME web-app-2023
REACT_APP_FARO_COLLECTOR_ENVIRONMENT production

Deploy with docker compose

$ docker compose up -d
...
[+] Running 6/6
 [+] Running 4/4
 ✔ Container web-app-2023-db-1        Healthy                                                0.5s 
 ✔ Container web-app-2023-backend-1   Running                                                0.0s 
 ✔ Container web-app-2023-frontend-1  Running                                                0.0s 
 ✔ Container web-app-2023-proxy-1     Running                                                0.0s 

Expected result

Listing containers must show three containers running and the port mapping as below:

$ docker compose ps
NAME                      IMAGE                   COMMAND                  SERVICE             CREATED             STATUS                    PORTS
web-app-2023-backend-1    web-app-2023-backend    "/code/bin/backend"      backend             About an hour ago   Up 59 minutes             
web-app-2023-db-1         mysql:8                 "docker-entrypoint.s…"   db                  31 minutes ago      Up 31 minutes (healthy)   0.0.0.0:3306->3306/tcp, 33060/tcp
web-app-2023-frontend-1   web-app-2023-frontend   "docker-entrypoint.s…"   frontend            About an hour ago   Up 59 minutes             3000/tcp
web-app-2023-proxy-1      nginx                   "/docker-entrypoint.…"   proxy               About an hour ago   Up 59 minutes             0.0.0.0:80->80/tcp, 0.0.0.0:8080->8080/tcp

After the application starts, navigate to http://localhost:80 in your web browser. web-app

Stop and remove the containers

$ docker compose down

Running k6

Set the appropriate environment variables in a .env file in the project root

K6_PROJECT_ID=<k6 project ID for testing>

Use the following command to run the test locally and send test report to k6 cloud

k6 run --out cloud k6-tests/test1.js

web-app-2023's People

Contributors

mshahzeb avatar

Stargazers

 avatar  avatar

Watchers

 avatar

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.