diff --git a/.env b/.env new file mode 100644 index 000000000..b38d4816a --- /dev/null +++ b/.env @@ -0,0 +1,2 @@ +RADIUSDESK_VOLUME=./data/radiusdesk +RADIUSDESK_NETWORK=radiusdesk-bridge diff --git a/docker/Dockerfile-build-radiusdesk b/Dockerfile similarity index 91% rename from docker/Dockerfile-build-radiusdesk rename to Dockerfile index 163b41f15..97c53efe4 100644 --- a/docker/Dockerfile-build-radiusdesk +++ b/Dockerfile @@ -22,9 +22,14 @@ FROM jtreminio/php:8.1 RUN apt-get install -y subversion # Prepare all directories - COPY ./default /etc/nginx/sites-enabled/ - COPY ./disable_strict_mode.cnf /etc/mysql/conf.d/ - COPY ./rdcore /var/www/rdcore + COPY ./docker/default /etc/nginx/sites-enabled/ + COPY ./docker/disable_strict_mode.cnf /etc/mysql/conf.d/ + + # Copy all files from the host to the container + COPY ./AmpConf /var/www/rdcore/AmpConf + COPY ./cake4 /var/www/rdcore/cake4 + COPY ./login /var/www/rdcore/login + COPY ./rd /var/www/rdcore/rd RUN mkdir -p /var/www/html RUN ln -s /var/www/rdcore/rd /var/www/html/rd @@ -84,16 +89,16 @@ FROM jtreminio/php:8.1 RUN mkdir -p /var/run/freeradius RUN chown freerad. /var/run/freeradius - COPY ./freeradius.service /lib/systemd/system/ + COPY ./docker/freeradius.service /lib/systemd/system/ ## cleanup RUN rm -rf /var/lib/apt/lists/* # supervisord allows multiple processes to be started with a single process - COPY ./supervisord.conf /etc/supervisor/conf.d/supervisord.conf + COPY ./docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf # Copy php settings - COPY ./php.ini /etc/php/php.ini + COPY ./docker/php.ini /etc/php/php.ini # Fix the configs to point to external database RUN sed -i "s/'host' => 'localhost'/'host' => 'rdmariadb'/g" /var/www/html/cake4/rd_cake/config/app_local.php diff --git a/README.md b/README.md index d68f44e78..527b8c964 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,12 @@ The recommended **Operating System** to develop and run RdCore on is **Ubuntu** ### Installing RdCore on Ubuntu 20.04 * This guide assumes you have an **Ubuntu 20.04** machine with ssh access. * [Ubuntu 20.04 Installation Guide](https://github.com/RADIUSdesk/rdcore/wiki/Prepare-RdCore-on-Ubuntu-20.04) + +### Installing RdCore with Docker +You can also install RdCore with Docker. This is the easiest way to get started with RdCore. + +- Run the following command to install RdCore with Docker: + ```bash + ./docker_build.sh + ``` +- After the installation is complete, you can access RdCore at http://localhost:80 \ No newline at end of file diff --git a/docker/docker-compose.yml b/docker-compose.yml similarity index 95% rename from docker/docker-compose.yml rename to docker-compose.yml index b2e12d920..d4c624aaf 100755 --- a/docker/docker-compose.yml +++ b/docker-compose.yml @@ -4,7 +4,6 @@ services: radiusdesk: build: context: ./ - dockerfile: Dockerfile-build-radiusdesk args: radiusdesk_volume: ${RADIUSDESK_VOLUME} container_name: radiusdesk diff --git a/docker/.env b/docker/.env deleted file mode 100644 index de0746b01..000000000 --- a/docker/.env +++ /dev/null @@ -1,2 +0,0 @@ -RADIUSDESK_VOLUME=/mnt/data/radiusdesk -RADIUSDESK_NETWORK=radiusdesk-bridge diff --git a/docker/README.md b/docker/README.md index 5b1b18aff..d3965910e 100644 --- a/docker/README.md +++ b/docker/README.md @@ -5,9 +5,4 @@ Dockerised new radiusdesk from https://github.com/RADIUSdesk based on - NGINX for the web server. - MariaDB to store the data. - CakePHP 4.x to create an API. - - ExtJs 7.0 to present a modern GUI that interacts with the API. - -## To install just run the build script -``` -./local_build.sh -``` \ No newline at end of file + - ExtJs 7.0 to present a modern GUI that interacts with the API. \ No newline at end of file diff --git a/docker/local_build.sh b/docker_build.sh similarity index 64% rename from docker/local_build.sh rename to docker_build.sh index 30c0ded22..1e6447b04 100755 --- a/docker/local_build.sh +++ b/docker_build.sh @@ -2,6 +2,9 @@ set -xu +# Set default platform to linux/amd64 (for M1 Macs) +export DOCKER_DEFAULT_PLATFORM=linux/amd64 + docker network create --attachable -d bridge radiusdesk-bridge source ./.env @@ -17,24 +20,17 @@ echo echo Starting Build .... echo echo Copying database files to volume mounts for MariaDB ... -mkdir -p /mnt/data/radiusdesk -mkdir -p /mnt/data/radiusdesk/db_startup -mkdir -p /mnt/data/radiusdesk/db_conf -chmod -R 777 /mnt/data/radiusdesk -chmod -R 777 /mnt/data/radiusdesk/db_startup -chmod -R 777 /mnt/data/radiusdesk/db_conf - -if [ -d "rdcore" ] -then - echo "Directory rdcore exists." -else - git clone https://github.com/RADIUSdesk/rdcore -fi - -cp rdcore/cake4/rd_cake/setup/db/rd.sql $RADIUSDESK_VOLUME/db_startup -cp db_priveleges.sql $RADIUSDESK_VOLUME/db_startup -cp startup.sh $RADIUSDESK_VOLUME/db_startup -cp my_custom.cnf $RADIUSDESK_VOLUME/db_conf +mkdir -p $RADIUSDESK_VOLUME +mkdir -p $RADIUSDESK_VOLUME/db_startup +mkdir -p $RADIUSDESK_VOLUME/db_conf +chmod -R 777 $RADIUSDESK_VOLUME +chmod -R 777 $RADIUSDESK_VOLUME/db_startup +chmod -R 777 $RADIUSDESK_VOLUME/db_conf + +cp ./cake4/rd_cake/setup/db/rd.sql $RADIUSDESK_VOLUME/db_startup +cp ./docker/db_priveleges.sql $RADIUSDESK_VOLUME/db_startup +cp ./docker/startup.sh $RADIUSDESK_VOLUME/db_startup +cp ./docker/my_custom.cnf $RADIUSDESK_VOLUME/db_conf echo echo Building docker database container ...