Skip to content

Development environment

Romke van Dijk edited this page May 20, 2022 · 10 revisions

Development environment

The easiest way to develop for hashtopolis is to use the VSCode development that ships with Hashtopolis. For more details on development containers see: https://code.visualstudio.com/docs/remote/containers

Other methods for developing is just to setup hashtopolis locally and run it directly from the git repo.

Setup

Details

How does the vscode dev container work? First off when opening the project from Visual Studio Code using the remote container plugin will scan for the .devcontainer folder inside the project. Next it will check the contents of devcontainer.json inside this folder. This file contains settings like how to mount the project directory inside the container.

Once it has loaded the file it checks what it needs to start. In our case it sees that there is a docker-compose file and it needs to start two services: hashtopolis and db. This will spawn two containers, hashtopolis and db. Hashtopolis container is created using the Dockerfile inside the .devcontainer folder. This basically installs apache2 + php with xdebug and configure hashtopolis. When the hashtopolis container starts it will run the docker-entrypoint.sh script inside the .devcontainer folder. This script does some tricks with setting up the database, an user and creates a voucher for connecting an agent.

Credentials

Hashtopolis passsword: hashtopolis
Database user: hashtopolis
Database password: hashtopolis
Database root password: hashtopolis```

Connect to the application using: http://127.0.0.1:8080/

To connect to the database spawn a shell inside the development container:

```docker exec -it hashtopolis /bin/bash
mysql -phashtopolis -uroot -hdb```

To connect an agent to the development container:
`python3 hashtopolis.zip --url  http://127.0.0.1:8080/api/server.php --voucher devagent --debug`
Clone this wiki locally