diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..033bca2 --- /dev/null +++ b/Makefile @@ -0,0 +1,11 @@ +all: build_aarch64 + +build_aarch64: + docker build -t wifimap:aarch64 -f wifimap/Dockerfile --no-cache=true wifimap/ +upload_aarch64: + docker tag wifimap:aarch64 nulldevil/wifimap:aarch64 + docker push nulldevil/wifimap:aarch64 +up_aarch64: + COMPOSE_PROJECT_NAME=phpmyadmin COMPOSE_IGNORE_ORPHANS=True docker-compose -f docker-compose_aarch64_swarm.yml up -d +down_aarch64: + COMPOSE_PROJECT_NAME=phpmyadmin COMPOSE_IGNORE_ORPHANS=True docker-compose -f docker-compose_aarch64_swarm.yml down diff --git a/README.md b/README.md index 7f0e2ae..aaff704 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,14 @@ $ docker-compose up -d ```` Docker setup is explained in more [detail here](https://github.com/Znerox/wifimap/wiki/Running-in-Docker-(recommended)). If you want to run the system in a more traditional way, by install a web server and database yourself, that's [no problem](https://github.com/Znerox/wifimap/wiki/Installation-without-Docker). + +### Docker swarm support on ARM64 (aarch64) architecture + +``` +make up_aarch64 +``` + + ### How to use If your Docker host is on 192.168.1.10, the various webpages will now be available on these ports/addresses: * Map of WiFi networks: 192.168.1.10 diff --git a/docker-compose_aarch64_swarm.yml b/docker-compose_aarch64_swarm.yml new file mode 100644 index 0000000..c4d714c --- /dev/null +++ b/docker-compose_aarch64_swarm.yml @@ -0,0 +1,61 @@ +version: "3.2" + +services: + wifimap: + image: nulldevil/wifimap:aarch64 + hostname: wifimap + depends_on: + - wifimap-mysql + networks: + - traefik_public + - internal + deploy: + resources: + limits: + cpus: '1.75' # one cpu + memory: 380M + placement: + constraints: [node.labels.name == node3] + labels: + # traefik common + - traefik.enable=true + - traefik.docker.network=traefik_public + + # traefikv1 + - traefik.frontend.rule=Host:wifi.yourdomain.com + - traefik.port=80 + + # traefikv2 + - "traefik.http.routers.wifi.rule=Host(`wifi.yourdomain.com`)" + - "traefik.http.services.wifi.loadbalancer.server.port=80" + environment: + api_key: "api key from google" + server: "wifimap-mysql" + database: "wifimap" + username: "root" + password: "password" + environment: "release" + wifimap-mysql: + image: mysql + hostname: wifimap-mysql + networks: + - internal + volumes: + - ./wifimap_db_data:/var/lib/mysql + environment: + MYSQL_ROOT_PASSWORD: "password" + deploy: + resources: + limits: + cpus: '1.75' # one cpu + memory: 380M + placement: + constraints: [node.labels.name == node3] +networks: + traefik_public: + external: true + internal: + driver: overlay + ipam: + config: + - subnet: 172.16.20.0/24 diff --git a/wifimap/Dockerfile b/wifimap/Dockerfile index fb4c5ea..d24718d 100644 --- a/wifimap/Dockerfile +++ b/wifimap/Dockerfile @@ -1,4 +1,6 @@ FROM php:8.1-apache COPY . /var/www/html/ +COPY init.sh /init.sh RUN chmod -R 777 /var/www/html/tools/php/uploads RUN docker-php-ext-install mysqli +ENTRYPOINT ["/init.sh"] diff --git a/wifimap/bluetooth/php/dbinfo.php b/wifimap/bluetooth/php/dbinfo.php index 0d53107..4db01c6 100644 --- a/wifimap/bluetooth/php/dbinfo.php +++ b/wifimap/bluetooth/php/dbinfo.php @@ -1,6 +1,6 @@ \ No newline at end of file +$username=getenv('username') ?? "MYSQL_USERNAME"; +$password=getenv('password') ?? "MYSQL_PASSWORD"; +$server=getenv('server') ?? "localhost"; +$database=getenv('database') ?? "wifimap"; +?> diff --git a/wifimap/clients/php/dbinfo.php b/wifimap/clients/php/dbinfo.php index 0d53107..4db01c6 100644 --- a/wifimap/clients/php/dbinfo.php +++ b/wifimap/clients/php/dbinfo.php @@ -1,6 +1,6 @@ \ No newline at end of file +$username=getenv('username') ?? "MYSQL_USERNAME"; +$password=getenv('password') ?? "MYSQL_PASSWORD"; +$server=getenv('server') ?? "localhost"; +$database=getenv('database') ?? "wifimap"; +?> diff --git a/wifimap/init.sh b/wifimap/init.sh new file mode 100755 index 0000000..bba9a7c --- /dev/null +++ b/wifimap/init.sh @@ -0,0 +1,6 @@ +#!/bin/sh -e + +sed -i "s/YOUR_API_KEY/${api_key}/g" index.html +sed -i "s/YOUR_API_KEY/${api_key}/g" js/API_key.js + +docker-php-entrypoint apache2-foreground diff --git a/wifimap/location/php/dbinfo.php b/wifimap/location/php/dbinfo.php index 0d53107..4db01c6 100644 --- a/wifimap/location/php/dbinfo.php +++ b/wifimap/location/php/dbinfo.php @@ -1,6 +1,6 @@ \ No newline at end of file +$username=getenv('username') ?? "MYSQL_USERNAME"; +$password=getenv('password') ?? "MYSQL_PASSWORD"; +$server=getenv('server') ?? "localhost"; +$database=getenv('database') ?? "wifimap"; +?> diff --git a/wifimap/php/dbinfo.php b/wifimap/php/dbinfo.php index 0d53107..4db01c6 100644 --- a/wifimap/php/dbinfo.php +++ b/wifimap/php/dbinfo.php @@ -1,6 +1,6 @@ \ No newline at end of file +$username=getenv('username') ?? "MYSQL_USERNAME"; +$password=getenv('password') ?? "MYSQL_PASSWORD"; +$server=getenv('server') ?? "localhost"; +$database=getenv('database') ?? "wifimap"; +?> diff --git a/wifimap/tools/php/dbinfo.php b/wifimap/tools/php/dbinfo.php index 0d53107..4db01c6 100644 --- a/wifimap/tools/php/dbinfo.php +++ b/wifimap/tools/php/dbinfo.php @@ -1,6 +1,6 @@ \ No newline at end of file +$username=getenv('username') ?? "MYSQL_USERNAME"; +$password=getenv('password') ?? "MYSQL_PASSWORD"; +$server=getenv('server') ?? "localhost"; +$database=getenv('database') ?? "wifimap"; +?>