From b9a6c4233375d4873e905db84f20bc8f76a90bcd Mon Sep 17 00:00:00 2001 From: "Chinmay D. Pai" Date: Mon, 2 Mar 2020 22:30:22 +0530 Subject: [PATCH] chore: cleanup redundant files Signed-off-by: Chinmay D. Pai --- .dockerignore | 5 +- Dockerfile | 50 --------------- conf/mariadb-conf.d/my.cnf | 38 ------------ conf/redis-conf.d/redis_cache.conf | 8 --- conf/redis-conf.d/redis_queue.conf | 3 - conf/redis-conf.d/redis_socketio.conf | 3 - dbench | 61 ------------------- frappe-bench/Procfile_docker | 8 --- .../sites/common_site_config_docker.json | 20 ------ test.sh | 21 ------- 10 files changed, 1 insertion(+), 216 deletions(-) delete mode 100644 Dockerfile delete mode 100644 conf/mariadb-conf.d/my.cnf delete mode 100644 conf/redis-conf.d/redis_cache.conf delete mode 100644 conf/redis-conf.d/redis_queue.conf delete mode 100644 conf/redis-conf.d/redis_socketio.conf delete mode 100755 dbench delete mode 100644 frappe-bench/Procfile_docker delete mode 100644 frappe-bench/sites/common_site_config_docker.json delete mode 100644 test.sh diff --git a/.dockerignore b/.dockerignore index 455769b0..0ed82517 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,10 +1,7 @@ # frappe_docker .dockerignore file -conf/* .travis.yml -test.sh README.md LICENSE.md .gitignore -dbench -docker-*.yml \ No newline at end of file +docker-*.yml diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 20d55871..00000000 --- a/Dockerfile +++ /dev/null @@ -1,50 +0,0 @@ -# Frappe Bench Dockerfile - -FROM debian:9.6-slim -LABEL author=frappé - -RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends locales \ - && sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \ - && dpkg-reconfigure --frontend=noninteractive locales \ - && apt-get clean && rm -rf /var/lib/apt/lists/* - -# Set locale en_us.UTF-8 for mariadb and general locale data -ENV PYTHONIOENCODING=utf-8 -ENV LANGUAGE=en_US.UTF-8 -ENV LANG=en_US.UTF-8 -ENV LC_ALL=en_US.UTF-8 - -# Install all neccesary packages -RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-suggests --no-install-recommends \ - build-essential cron curl git libffi-dev liblcms2-dev libldap2-dev libmariadbclient-dev libsasl2-dev libssl1.0-dev libtiff5-dev \ - libwebp-dev mariadb-client iputils-ping python-dev python-pip python-setuptools python-tk redis-tools rlwrap \ - software-properties-common sudo tk8.6-dev vim xfonts-75dpi xfonts-base wget wkhtmltopdf fonts-cantarell \ - && apt-get clean && rm -rf /var/lib/apt/lists/* \ - && curl https://deb.nodesource.com/node_10.x/pool/main/n/nodejs/nodejs_10.10.0-1nodesource1_amd64.deb > node.deb \ - && dpkg -i node.deb \ - && rm node.deb \ - && npm install -g yarn - -# Install wkhtmltox correctly -RUN wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.stretch_amd64.deb -RUN dpkg -i wkhtmltox_0.12.5-1.stretch_amd64.deb && rm wkhtmltox_0.12.5-1.stretch_amd64.deb - -# Add frappe user and setup sudo -RUN groupadd -g 500 frappe \ - && useradd -ms /bin/bash -u 500 -g 500 -G sudo frappe \ - && printf '# Sudo rules for frappe\nfrappe ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/frappe \ - && chown -R 500:500 /home/frappe - -# Install bench -RUN pip install -e git+https://github.com/frappe/bench.git#egg=bench --no-cache - -USER frappe - -# Add some bench files -COPY --chown=frappe:frappe ./frappe-bench /home/frappe/frappe-bench - -WORKDIR /home/frappe/frappe-bench - -EXPOSE 8000 9000 6787 - -VOLUME [ "/home/frappe/frappe-bench" ] diff --git a/conf/mariadb-conf.d/my.cnf b/conf/mariadb-conf.d/my.cnf deleted file mode 100644 index 67decf83..00000000 --- a/conf/mariadb-conf.d/my.cnf +++ /dev/null @@ -1,38 +0,0 @@ -# MariaDB-specific config file. -# Read by /etc/mysql/my.cnf - -[client] -# Default is Latin1, if you need UTF-8 set this (also in server section) -#default-character-set = utf8 - -[mysqld] -# -# * Character sets -# -# Default is Latin1, if you need UTF-8 set all this (also in client section) -# -#character-set-server = utf8 -#collation-server = utf8_general_ci -#character_set_server = utf8 -#collation_server = utf8_general_ci -bind-address = 0.0.0.0 -# Import all .cnf files from configuration directory -!includedir /etc/mysql/mariadb.conf.d/ - - -[mysqld] -character-set-client-handshake = FALSE -character-set-server = utf8mb4 -collation-server = utf8mb4_unicode_ci - -[mysql] -default-character-set = utf8mb4 - -[mysqld_safe] -skip_log_error -syslog - -[mysqldump] -quick -quote-names -max_allowed_packet = 16M diff --git a/conf/redis-conf.d/redis_cache.conf b/conf/redis-conf.d/redis_cache.conf deleted file mode 100644 index 7e1f9265..00000000 --- a/conf/redis-conf.d/redis_cache.conf +++ /dev/null @@ -1,8 +0,0 @@ -dbfilename redis_cache.rdb -bind 0.0.0.0 -port 13000 -maxmemory 292mb -maxmemory-policy allkeys-lru -appendonly no - -save "" diff --git a/conf/redis-conf.d/redis_queue.conf b/conf/redis-conf.d/redis_queue.conf deleted file mode 100644 index b4f96cb9..00000000 --- a/conf/redis-conf.d/redis_queue.conf +++ /dev/null @@ -1,3 +0,0 @@ -dbfilename redis_queue.rdb -bind 0.0.0.0 -port 11000 diff --git a/conf/redis-conf.d/redis_socketio.conf b/conf/redis-conf.d/redis_socketio.conf deleted file mode 100644 index 1fff87ef..00000000 --- a/conf/redis-conf.d/redis_socketio.conf +++ /dev/null @@ -1,3 +0,0 @@ -dbfilename redis_socketio.rdb -bind 0.0.0.0 -port 12000 diff --git a/dbench b/dbench deleted file mode 100755 index 49bbc625..00000000 --- a/dbench +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash - -function run () { - user=$1 - shift - docker exec -itu "${user}" frappe bash -c "$@" -} - -if [[ $# -eq 0 ]]; then - docker exec -it frappe bash -elif [[ "$1" == 'init' ]]; then - run root "chown -R frappe:frappe /home/frappe" - run frappe "cd .. && bench init frappe-bench --ignore-exist --skip-redis-config-generation && cd frappe-bench" - run frappe "mv Procfile_docker Procfile && mv sites/common_site_config_docker.json sites/common_site_config.json && bench set-mariadb-host mariadb" -elif [[ "$1" == 'setup' ]]; then - if [[ "$2" == 'docker' ]]; then - if [[ "$3" == '--swarm-mode' ]]; then - echo "Docker swarm mode is not currently supported" - elif [[ "$3" == 'down' ]]; then - docker-compose down - elif [[ "$3" == 'stop' ]]; then - docker-compose stop - else - docker-compose up -d - fi - elif [[ "$2" == 'hosts' ]]; then - a=$(run frappe "ls sites/*/site_config.json | grep -o '/.\+/'") - a="${a//$'\n'/ }" - a=$(echo "$a" | tr -d / ) - result="127.0.0.1 ${a}" - run root "echo ${result} | tee -a /etc/hosts" - else - IFS=" " - run frappe "bench $*" - fi -elif [[ "$1" == '-c' ]]; then - shift - user=$1 - shift - run "$user" "$@" -elif [[ "$1" == '-h' ]]; then - echo "$0 [-h] | [-c frappe|root command] | [setup hosts|docker [stop|down]] | [bench_command]" - echo "" - echo "$0 is a wrapper for the Frappe Bench tool, and is used like it. However, it extends the tool in a few places." - echo "Usage:" - echo " $0 -h" - echo " Shows this help message" - echo " $0" - echo " Launches you into an interactive shell in the container as user frappe" - echo " $0 " - echo " Runs the bench command , i.e. $0 new-site \"site1.local\" = bench new-site \"site1.local\"" - echo " $0 setup docker [ stop | down ]" - echo " Builds and starts the docker containers using \"docker-compose up -d\"" - echo " $0 setup hosts" - echo " Adds all site names to the containers hosts file" - echo " $0 -c frappe | root " - echo " Runs a command in the container, as the selected user" -else - IFS=" " - run frappe "bench $*" -fi diff --git a/frappe-bench/Procfile_docker b/frappe-bench/Procfile_docker deleted file mode 100644 index e2a5bd93..00000000 --- a/frappe-bench/Procfile_docker +++ /dev/null @@ -1,8 +0,0 @@ -web: bench serve --port 8000 - -socketio: /usr/bin/node apps/frappe/socketio.js -watch: bench watch -schedule: bench schedule -worker_short: bench worker --queue short -worker_long: bench worker --queue long -worker_default: bench worker --queue default diff --git a/frappe-bench/sites/common_site_config_docker.json b/frappe-bench/sites/common_site_config_docker.json deleted file mode 100644 index cdc9d198..00000000 --- a/frappe-bench/sites/common_site_config_docker.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "auto_update": false, - "background_workers": 1, - "db_host": "mariadb", - "file_watcher_port": 6787, - "frappe_user": "frappe", - "gunicorn_workers": 4, - "rebase_on_pull": false, - "redis_cache": "redis://redis-cache:13000", - "redis_queue": "redis://redis-queue:11000", - "redis_socketio": "redis://redis-socketio:12000", - "restart_supervisor_on_update": false, - "root_password": "123", - "serve_default_site": true, - "shallow_clone": true, - "socketio_port": 9000, - "update_bench_on_update": true, - "webserver_port": 8000, - "admin_password": "admin" -} \ No newline at end of file diff --git a/test.sh b/test.sh deleted file mode 100644 index 86b591e5..00000000 --- a/test.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -docker container ls | grep frappe -docker container ls | grep mariadb -docker container ls | grep redis-cache -docker container ls | grep redis-queue -docker container ls | grep redis-socketio - -cat <(./dbench start) & - -while ! [[ $i == 20 ]] -do - output=$( curl "http://localhost:8000" ) - { echo "Exit status of curl: $?" - } 1>&2 - sleep 2 - i=$((i + 1)) - echo "${output}" | grep ' Login ' && exit -done - -if ! [[ "$?" == 0 ]]; then exit 1; fi