Skip to content

Repository files navigation

DevOps example app

CI status Count docker images pulls

This is a simple node application that shows on the main page server on which it is running and report errors to Bugsink.

Зачем это нужно

Приложение-подопытный для курсов по DevOps. На главной странице показывает, на каком сервере оно запущено, и умеет намеренно падать, отправляя ошибку в Bugsink.

Обе особенности сделаны ради упражнений: по выводу имени сервера видно, куда именно приехал запрос за балансировщиком, а управляемая ошибка нужна, чтобы посмотреть на мониторинг в работе.

Опубликовано образом hexletcomponents/devops-example-app, поэтому в уроках его запускают, не собирая: этим занимается курс по докеру. Рядом лежит обвязка, которую в этих курсах и разбирают: ansible/, terraform/, docker-compose.yml.

Usage

docker run -p 3000:3000 -e SERVER_MESSAGE="Hexlet Awesome Server" -e SENTRY_DSN="<your dsn>" hexletcomponents/devops-example-app
# open http://0.0.0.0:3000 in browser

Requirements

  • Docker
  • Make
  • Node.js >= 20 (для локальной разработки без Docker)

Install

make setup

You may pass environment variable SERVER_MESSAGE, and its value shows on the main page.

Edit .env file to set up environment variables.

SERVER_MESSAGE="Hexlet Awesome Server"
SENTRY_DSN=<your bugsink dsn>

Getting Bugsink DSN

Bugsink runs as a local service via Docker Compose. To get the DSN:

  1. Start the services: make compose
  2. Open http://localhost:8000 and log in (admin@example.com / admin)
  3. Create a new project
  4. Copy the DSN from the project settings — it looks like: http://<key>@bugsink:8000/<project_id>
  5. Add it to your .env file:
    SENTRY_DSN=http://<key>@bugsink:8000/<project_id>
  6. Restart the app: docker compose restart app

Development

make test        # запустить тесты
make lint        # проверить код (Biome)
make lint-fix    # автоисправление (Biome)
make update-deps # обновить зависимости (ncu -u)

Start application

make start
# open http://0.0.0.0:3000 in browser

Screen of devops-example-app


Hexlet Ltd. logo

This repository is created and maintained by the team and the community of Hexlet, an educational project. Read more about Hexlet.

See most active contributors on hexlet-friends.

About

No description, website, or topics provided.

Resources

Stars

8 stars

Watchers

7 watching

Forks

Releases

Packages

Used by

Contributors

Languages