Skip to content

Latest commit

 

History

5,236 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Codebattle

Actions Status codecov

Codebattle - is an open source game being developed by the Hexlet community. The current version of the application is available at codebattle.hexlet.io.

This project exists thanks to all the people who contribute. Contribute guideline.

Alt

Requirements

Install

git clone git@github.com:hexlet-codebattle/codebattle.git
cd codebattle
make setup

make setup builds the pinned development image, installs Elixir and frontend dependencies inside it, starts PostgreSQL, and prepares the database. Host installations of Elixir, Erlang, Node.js, pnpm, and Go are not used.

To work from an editor, open the repository and choose Reopen in Container. The same Make commands work in a host terminal and in the container terminal.

Start Server

make server

Run Tests

make test
make test-fe

Lint

make lint
make credo
make check-js

# To run specific
make format
make lint-js-fix

Useful

make console
make dev-shell
make dev-exec CMD='mix upload_langs'

make db-migrate
make dev-rebuild
make dev-down
make clean # Removes the development containers and their persistent volumes

All application commands run in the non-root development container. The source tree is the only host directory mounted into it; dependency caches and database data use Docker-managed volumes. Host Docker/Podman sockets and host credential directories are intentionally not mounted.

The repository is writable inside the container, so keep only disposable development credentials in .env. Never put production or personal cloud credentials in the workspace. The host .env is masked in the container and only the variables explicitly allowlisted in compose.yml are passed through.

Runner image build and publish targets still execute through the host container engine because they orchestrate other containers. Treat those targets as privileged operations and use them only with trusted code.

Profile js bundle

Support

Troubleshooting

Port already in use

The dev container publishes Phoenix on 127.0.0.1:4000 and Vite on 127.0.0.1:8080. If another project holds one of them, docker compose up fails with failed to bind host port ... address already in use and the container never starts.

bin/dev and the devcontainer initializeCommand run .devcontainer/preflight first, which names the offending process. Either stop it, or move the dev container to free ports in .env:

CODEBATTLE_PORT=4010
CODEBATTLE_VITE_PORT=8090

Both variables are read by Compose and by vite.config.js, so the container and the dev server stay in sync.

macOS

  • Install Docker

Make sure you have installed Docker Desktop for macOS.

brew install --cask docker

Or download Docker Desktop directly from: https://www.docker.com/products/docker-desktop

  • Start Docker Desktop

Launch Docker Desktop from your Applications folder. The Docker icon will appear in your menu bar when it's running.

If you encounter issues, try restarting Docker Desktop from the menu bar icon or your Applications folder.

Docker Desktop will start automatically on boot by default. You can change this in Docker Desktop preferences if needed.

Linux

  • Install Docker

Make sure you have installed Docker Engine for your Linux distribution.

Follow the official installation guide: https://docs.docker.com/engine/install/

  • Start Docker service

Make sure Docker is running. You can start the Docker service manually by typing:

sudo systemctl start docker

or you can add it to startup by typing:

sudo systemctl enable docker
  • Add your user to the docker group

To run Docker without sudo, add your user to the docker group:

sudo usermod -aG docker $USER

Then log out and log back in for the changes to take effect, or run:

newgrp docker

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

Codebattle - Game for programmers, where you solved algorithmic problems with other players in real time. You can fight with other players in single player mode or join massive tournaments.

Topics

Resources

Code of conduct

Contributing

Stars

880 stars

Watchers

17 watching

Forks

Releases

Packages

Used by

Contributors

Languages