1
0
mirror of https://github.com/ebosas/microservices.git synced 2024-11-24 08:02:24 +02:00
A microservices example in Go
Go to file
2021-06-03 11:54:22 +03:00
backend Comments 2021-06-03 11:54:22 +03:00
bootstrap Front end build 2021-06-02 19:11:36 +03:00
config Update readme, .env 2021-06-02 14:43:57 +03:00
database Comments 2021-06-03 11:54:22 +03:00
react Separate react components 2021-06-03 11:51:38 +03:00
server Comments 2021-06-03 11:54:22 +03:00
.dockerignore Initial commit 2021-06-01 14:26:02 +03:00
.env Update readme, .env 2021-06-02 14:43:57 +03:00
.gitignore Initial commit 2021-06-01 14:26:02 +03:00
backend.Dockerfile updates to readme, dockerfiles 2021-06-01 21:38:22 +03:00
database.Dockerfile updates to readme, dockerfiles 2021-06-01 21:38:22 +03:00
docker-compose-dev.yml Add docker-compose dev 2021-06-03 11:52:54 +03:00
docker-compose.yml Add docker-compose dev 2021-06-03 11:52:54 +03:00
LICENSE Initial commit 2021-06-01 09:03:48 +03:00
README.md Update readme, .env 2021-06-02 14:43:57 +03:00
server.Dockerfile updates to readme, dockerfiles 2021-06-01 21:38:22 +03:00

Microservices

A basic example of microservice architecture which demonstrates communication between a few loosely coupled services.

  • Written in Go
  • Uses RabbitMQ to communicate between services
  • Uses WebSocket to talk to the front end
  • Stores data in PostgreSQL
  • Uses React for front end development
  • Builds and runs the application with Docker

Running the code

To run the example, clone the Github repository and start the services with Docker Compose. Once Docker finishes downloading and building images, the front end is accessible by visiting localhost:8080 in a browser.

git clone https://github.com/ebosas/microservices
cd microservices
docker-compose up

Back end

To access the back end service, attach to its docker container from a separate terminal window. Messages from the front end will show up here. Also, standart input from this service is sent to the front end for two way communication.

docker attach microservices_backend

Database

To inspect the database, launch a new container that will connect to our Postgres database. Then enter the password demopsw (see the .env file).

docker run -it --rm --network microservices_network postgres:13-alpine psql -h postgres -U postgres

Select everything from the messages table:

\c microservices
select * from messages;

RabbitMQ management

Access the RabbitMQ management interface by visiting localhost:15672 with guest as both username and password.