diff --git a/other_installers/docker/Dockerfile b/other_installers/docker/Dockerfile index 3f63372b..1467f4b5 100644 --- a/other_installers/docker/Dockerfile +++ b/other_installers/docker/Dockerfile @@ -13,14 +13,13 @@ RUN apt-get install git python3-dev build-essential \ # Adding sudo command RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo + RUN echo "root ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers # Installing AIL dependencies -RUN mkdir /opt/AIL -ADD . /opt/AIL WORKDIR /opt/AIL +COPY . . RUN ./installing_deps.sh -WORKDIR /opt/AIL # Default to UTF-8 file.encoding ENV LANG C.UTF-8 @@ -34,7 +33,7 @@ ENV AIL_VENV ${AIL_HOME}/AILENV ENV PATH ${AIL_VENV}/bin:${AIL_HOME}:${AIL_REDIS}:${AIL_ARDB}:${AIL_BIN}:${AIL_FLASK}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin RUN ./pystemon/install.sh + RUN pip install -r /opt/pystemon/requirements.txt -COPY docker_start.sh /docker_start.sh ENTRYPOINT ["/bin/bash", "docker_start.sh"] diff --git a/other_installers/docker/README.md b/other_installers/docker/README.md index 018ba146..0a0de59f 100644 --- a/other_installers/docker/README.md +++ b/other_installers/docker/README.md @@ -6,28 +6,54 @@ This Docker is not maintained at the moment. If you are interested to contribute, please submit a Pull Request -1. Install Docker -```bash -sudo su -apt-get install -y curl -curl https://get.docker.com | /bin/bash -``` +# Have docker Installed + +## Linux Installation + +Here is the [link](https://docs.docker.com/engine/install/) with the installation +steps for all the diferent linux Platforms. + +If your distro is not mentioned you probably need to install it through the +package manager of the distro that you are using (Ex.: ArchLinux, NixOS). + +## Windows Installation + +To be able to run docker on a Windows device you will have to check the documentation +on how to install it on windows. + +If I'm not mistaken you have 2 ways of installing docker on windows: + - Only using the WSL with an Ubuntu image, in this case you follow the + same [installation steps](https://docs.docker.com/engine/install/ubuntu/) as + you would in an Ubuntu distro. + - Using the [Docker Desktop](https://docs.docker.com/desktop/setup/install/windows-install/) + +## Mac Installation + +For mac users follow the [documentation](https://docs.docker.com/desktop/setup/install/mac-install/) + +# Build the docker image + +Type these commands to build the Docker image: -2. Type these commands to build the Docker image: ```bash git clone https://github.com/ail-project/ail-framework.git -cd AIL-framework +cd ail-framework cp -r ./other_installers/docker/Dockerfile ./other_installers/docker/docker_start.sh ./other_installers/docker/pystemon ./ cp ./configs/update.cfg.sample ./configs/update.cfg vim/nano ./configs/update.cfg (set auto_update to False) docker build --build-arg tz_buildtime=YOUR_GEO_AREA/YOUR_CITY -t ail-framework . ``` -3. To start AIL on port 7000, type the following command below: +# Start AIL + +To start AIL on port 7000, type the following command below: ``` docker run -p 7000:7000 ail-framework ``` -4. To debug the running container, type the following command and note the container name or identifier: +# Debug Container + +To debug the running container, type the following command and note the container name or identifier: + ```bash docker ps ``` diff --git a/other_installers/docker/improvments.md b/other_installers/docker/improvments.md new file mode 100644 index 00000000..e5da5cf9 --- /dev/null +++ b/other_installers/docker/improvments.md @@ -0,0 +1,55 @@ +# Improvments Docker Installation + +Here I will put all the improvments so that the docker installation is optimized. +Of course all the help is welcome and this document was written with little +knowledge of how the project works, every comment and critic is well accepted. + +Also this document was though of after a brief analysis of the installation process, +the installation process was almost concluded with success, but the way that the +docker installation was setup was really tedious to debug. The image had to be +rebuild more than 5 times, and each time took around 8 to 10 minutes (not sure) +and sometimes it was to solve a something that took 10 seconds to solve. + +## List of Improvments + +- [ ] Improve Dockerfile cache, the steps for building the image should be +separated. Because of the way the project is structured, it will not be possible +to use the `installing_deps.sh` script, there's to much processes being executed +in this file. The problem that this causes is long building times and it's harder +to debug. + +- [ ] Also in the `installing_deps.sh` script there are at least 2 services that +are installed that I think should be build as separate services and not in the +image. This services are the following, Redis and kvrocks database. If more +services are identified than should be added to this list: + - [ ] Redis + - [ ] kvrocks + +- [ ] Of course if we remove the services from the image we need to implement them +in the docker-compose.yaml file. Right now the docker-compose.yaml file could be +improved. But it can be so, after all these other improvments are made. + +- [ ] After separating the services we should look at the python environment and +the packages that it uses. Some packages are being called in the requiremtents.txt +but they are also being build in the `installing_deps.sh`. Is this really needed? +Can we just have the packages being called in the requirements.txt? Why are we +building the packages using apt? +Here are some packages that are buing built using apt: + - [ ] faup + - [ ] tlsh + +- [ ] If all of these points are correct and are implemented, then it will be +needed to create a different way of building the project and the installation +process will not be centralized anymore (Aka: More things to maintain). So maybe +should be a good idea to rethink the way the project is built, so that is compatible +for docker and for bare metal installation. + + +- [ ] Since we are implementing docker, other tools should be explored like +devcontainers so that we can really isolate the developing process. (If there's +more tools that could be implemented, fell free to add to the list) + - [ ] Devcontainers + +- [ ] Undestand what each service of installing_deps.sh does. So that it can be +understood how the docker-compose.yaml file will be built. +