From d3a9a94c22486f5bc1b2d83859be186503957aea Mon Sep 17 00:00:00 2001 From: Haroun EL ALAMI Date: Tue, 22 Apr 2025 15:50:32 +0200 Subject: [PATCH 1/3] feat: improve docker logs --- supervisord.conf | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/supervisord.conf b/supervisord.conf index 0cdca24..ed76740 100644 --- a/supervisord.conf +++ b/supervisord.conf @@ -7,8 +7,10 @@ serverurl=unix:///var/run/supervisor.sock [program:emulator] command=/bin/bash /root/start-emulator.sh -stdout_logfile=/var/log/supervisor/emulator.out.log -stderr_logfile=/var/log/supervisor/emulator.err.log +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 autorestart=true startretries=3 retry_interval=10 @@ -16,7 +18,9 @@ priority=20 [program:first-boot] command=/root/first-boot.sh -stdout_logfile=/var/log/supervisor/first-boot.out.log -stderr_logfile=/var/log/supervisor/first-boot.err.log +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 autorestart=false priority=10 \ No newline at end of file From 8f4281dc835545f01855ca3f38a8c369a7dea85b Mon Sep 17 00:00:00 2001 From: Haroun EL ALAMI Date: Tue, 22 Apr 2025 23:29:50 +0200 Subject: [PATCH 2/3] update readme --- README.md | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 61 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b8a3cb4..89769c9 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,8 @@ Access and control the Android emulator directly in your web browser with the in - [Using Web Interface](#use-the-web-interface-to-access-the-emulator) - [Using ADB](#connect-via-adb) - [Using Desktop scrcpy](#use-scrcpy-to-mirror-the-emulator-screen) +- [First Boot Process](#-first-boot-process) +- [Container Logs](#-container-logs) - [Roadmap](#-roadmap) - [Troubleshooting](#-troubleshooting) - [Contributing](#-contributing) @@ -53,6 +55,7 @@ Access and control the Android emulator directly in your web browser with the in - **Docker Integration:** Easily deploy the Android emulator within a Docker container. - **Easy Setup:** Simple Docker commands to build and run the emulator. - **Supervisor Management:** Manages emulator processes with Supervisor for reliability. +- **Unified Container Logs:** All emulator and boot logs are redirected to Docker's standard log system. ## 🛠️ **Prerequisites** @@ -131,6 +134,53 @@ scrcpy -s localhost:5555 > **Note:** Ensure `scrcpy` is installed on your host machine. [Installation Guide](https://github.com/Genymobile/scrcpy#installation) +## 🔄 **First Boot Process** + +The first time you start the container, it will perform a comprehensive setup process that includes: + +1. **AVD Creation:** Creates a new Android Virtual Device running Android 30 (Android 11) +2. **Installing PICO GAPPS:** Adds essential Google services to the emulator +3. **Rooting the Device:** Performs multiple reboots to: + - Disable AVB verification + - Remount system as writable + - Install root access via the rootAVD script + - Install PICO GAPPS components + - Configure optimal device settings + +> **Important:** The first boot can take 10-15 minutes to complete. You'll know the process is finished when you see the following log output: +> ``` +> Broadcast completed: result=0 +> Sucess !! +> 2025-04-22 13:45:18,724 INFO exited: first-boot (exit status 0; expected) +> ``` + +> **Note:** If the Android emulator has restarted for any reason, it's recommended to restart the Docker container to reapply optimizations: +> ```bash +> docker compose restart +> ``` +> This ensures the following optimizations are applied: +> - Disabled animations for better performance +> - Screen timeout set to 15 seconds +> - Disabled rotation +> - Custom DNS settings +> - Airplane mode enabled (with WiFi still active) +> - Data connection disabled + +After the first boot completes, a file marker is created to prevent running the initialization again on subsequent starts. + +## 📋 **Container Logs** + +All logs from the emulator and boot processes are redirected to Docker's standard log system. To view all container logs: + +```bash +docker logs dockerify-android +``` + +This includes: +- Supervisor logs +- Android emulator stdout/stderr +- First-boot process logs + ## 🚧 **Roadmap** - [ ] Support for additional Android versions @@ -139,6 +189,7 @@ scrcpy -s localhost:5555 - [x] Preinstall PICO GAPPS - [x] Support Magisk - [x] Adding web interface of [scrcpy](https://github.com/Shmayro/ws-scrcpy-docker) +- [x] Redirect all logs to container stdout/stderr ## 🐞 **Troubleshooting** @@ -154,13 +205,19 @@ scrcpy -s localhost:5555 docker logs dockerify-android ``` +- **First Boot Taking Too Long:** + - This is normal, as the first boot process needs to perform several operations including: + - Installing GAPPS + - Rooting the device + - Configuring system settings + - The process can take 10-15 minutes depending on your system performance + - You can monitor progress with `docker logs -f dockerify-android` + - **Emulator Not Starting:** - - **Check Supervisor Logs:** + - **Check Container Logs:** ```bash - docker exec -it dockerify-android bash - cat /var/log/supervisor/emulator.out.log - cat /var/log/supervisor/emulator.err.log + docker logs dockerify-android ``` - **KVM Not Accessible:** From 8898536ee9d3c4e198ed10c2d9f3cc85e8ce05de Mon Sep 17 00:00:00 2001 From: Haroun EL ALAMI Date: Tue, 22 Apr 2025 23:32:26 +0200 Subject: [PATCH 3/3] fix: update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 89769c9..d5c1dde 100644 --- a/README.md +++ b/README.md @@ -173,7 +173,7 @@ After the first boot completes, a file marker is created to prevent running the All logs from the emulator and boot processes are redirected to Docker's standard log system. To view all container logs: ```bash -docker logs dockerify-android +docker logs -f dockerify-android ``` This includes: