- 
                Notifications
    
You must be signed in to change notification settings  - Fork 242
 
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.
- Install vscode https://code.visualstudio.com/
 - Optional (windows): Install wsl2 https://docs.microsoft.com/en-us/windows/wsl/install
 - Install Docker Desktop https://www.docker.com/products/docker-desktop/
 - Install remote containers extension in vscode https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers
 - Optional (windows): Install remote wsl extension in vscode https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl
 - Clone the server repo (and for now select this branch ofc)
 - In vscode select 'Open Folder in Container' either by (CTRL + SHIFT + P, type: Open Folder in Container) or press the green extension button in the left bottom and select the option, now select the folder where hashtopolis-server is
 - Optional: set a break point and press F5 (Run -> Start Debugging)
 - Open a browser and visit: http://localhost:8080/
 - Login in with: username: root, password: hashtopolis
 
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.
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`