Skip to content

Installation_en_docker

jellllly420 edited this page Sep 11, 2022 · 11 revisions

Installation instructions for Linux w/ Podman

Because installing a specific version of python in Linux can be tricky, and conda can pollute your environment, this method uses Docker Podman to build a container for ALAS.

Podman is used in place of Docker due to mount permission/UID-GID, also with the perks of being daemon-less replacement, which means you can run containers without running as root/sudo. This will reduce attack surface in case of users wanting use remote control the ALAS deployment via SSH method or reverse proxy (e.g. Nginx).

Because Podman also runs on Mac OS and Windows, this method may also work in those platforms, although your mileage may vary (see Detailed usage).

Disclaimer

This method doesn't provide a one-click solution as the EasyInstaller with 1:1 feature parity, as this would require a larger codebase for a close-to-zero userbase. If you encounter any problems, file a GitHub issue and ping @viperML or @n0k0m3

Prerequisites

  • Some basic knowledge of the terminal and podman

  • Android emulator, such as:

    • Genymotion (recommended)

      Installation guide
      • Download and install Genymotion from here, or from AUR if you are using Arch Linux.
      • Create a new virtual device (red plus button on top right or Ctrl-N), and select "Custom Tablet", click Next. Config your device as follow
        • Display: Custom (1280x720 - 160 MDPI)
        • Android Version: 7.1 (must be 9 or lower, 5.1 doesn't work for me)
          • Pros: Android 5-9 supports ascreencap method to capture the screen, which is the fastest method at the moment
        • Processors: 4, Memory: 4096 (modify this as you need less or more)
        • Leave the rest as default
        • Hit Install
      • To install Azur Lane, you MUST install the ARM translation layer (libhoudini) from this repo: https://github.com/m9rco/Genymotion_ARM_Translation
        • Only supports up to Android 9
        • Read README.md for which file to download
        • For Android 7.1 download here
        • Drag the downloaded ZIP file to emulator, click "OK" when it asks you to flash.
        • Restart the emulator.
      • (Optional) If you have to install Google Play to install Azur Lane (or you can just sideload the apk and obb from APKPure), click on the down arrow on bottom right of the emulator control panel, select "Install Open GApps" and follow the instructions. The emulator will restart and you can install the game.
      • Enable debugging mode
      • To know the emulator name for alas, type in terminal adb devices, and the name will show up in the list.
      • Genymotion doesn't have netcat or nc installed by default, so you need to install busybox for it.
    • Android's studio AVD (not recommended due to less smooth and memory leak)

      Installation guide
      • Install Android Studio (through your distribution's package manager)
      • After the first launch and setup, select the "SDK Manager"
      • Now, to download an emulator for Android 11, you have to select "Show Package Details", and then select the "System Image Atom_64", "Google APIs Atom_64" and "Google Play Atom_64" packages, as shown in the image. Only Android >= 11 supports ARM translation layer (source), and Android 12 was recently released (may have bugs). Coming from the future, feel free to experiment with newer Android versions.
      • After that installation is done, go back to the AVD manager
      • Start creating a new Virtual Device, first by creating a Hardware Profile with 1280x720 screen resolution and enough RAM.
      • In the next section, select the system image that we downloaded earlier, under the tab x86 Images. Make sure to pick the one with "Google APIs'.
      • In the last configuration panel, make sure to enable enough storage to install Azur Lane, select the RAM and CPU cores and the device orientation to landscape.
      • Finally, before launching the emulator, we have to enable the Play Store to install the game. Edit the file under /home/<your user>/.android/avd/<AVD name>.avd/config.ini and change the values:
        • PlayStore.enable=false > PlayStore.enable=true
        • image.sysdir.1=system-images/android-<your version>/google_apis/x86_64/ > image.sysdir.1=system-images/android-<your version>/google_apis_playstore/x86/
      • Close Android Studio, start it again and launch your emulator.
      • (VERY IMPORTANT) AVD will lock adb auth to the first adb instance connected. To avoid this, go to emulator's Extended Control (3 dots) -> Settings -> (Turn off) Use detected ADB location and leave the field empty
      • To enable emulator's developer option when Build Number is disabled, enter adb shell and use settings put global development_settings_enabled 1
      • To know the emulator name for alas, type in a terminal adb devices, and the name show pup up in the list.
  • Podman.

  • Podman Compose. Don't install using pip.

  • Git

  • Bash

Installation and usage

First, clone this repository into any folder (e.g. at your home directory):

git clone https://github.com/LmeSzinc/AzurLaneAutoScript
cd AzurLaneAutoScript

Refer to config/deploy.template-docker.yaml to update config/deploy.yaml. Note for CN players deployment: edit docker-compose.yml to use Dockerfile.cn to build image, and use config/deploy.template-docker-cn.yaml instead.

Run the following command

podman-compose up

Shortly after, you should see the IP address to access the GUI in your web browser. Continue to the standard installation guide.

If you get any problem with podman regarding to Error: error creating build container: short-name "<mambaforge container>" did not resolve to an alias and no unqualified-search registries are defined in "/etc/containers/registries.conf", use this solution: https://github.com/containers/podman/issues/9390#issuecomment-970305169

Detailed usage

The Dockerfile included in deploy/docker pulls a base image with mamba (conda alternative), and installs the required dependencies into the image. Then, the ALAS folder is mounted into the container and the python entrypoint is run inside.

The network_mode: host flag in docker-compose.yml is important, it allows the bundled ADB in the container can access the emulator directly. Otherwise you would have to manually set up the port forwarding. It is also important to kill any adb servers running on the host machine (adb kill-server)

Equivalent podman run command:

podman build -t alas -f deploy/docker/Dockerfile deploy/docker
podman run --net=host -it -v '.:/app/AzurLaneAutoScript:rw' -v '/etc/localtime:/etc/localtime:ro' --name alas alas

Uninstall

$ podman rm alas
$ podman rmi alas

And remove the AzurLaneAutoScript folder.

Clone this wiki locally