From 02e8c231b26cfade9d5d8d1668e6fe4c565031ea Mon Sep 17 00:00:00 2001 From: lucas cardoso Date: Wed, 6 Jul 2022 14:15:33 -0400 Subject: [PATCH] Config slim com o docker --- Dockerfile | 50 +++++----- docker-compose.yml | 18 ++-- .../aplicativo/{Dockerfile => Dockerfile-old} | 0 docker/aplicativo/supervisord.conf | 13 --- docker/proxy/httpd.conf | 91 ++++++++++--------- supervisord.conf | 6 +- 6 files changed, 80 insertions(+), 98 deletions(-) rename docker/aplicativo/{Dockerfile => Dockerfile-old} (100%) delete mode 100644 docker/aplicativo/supervisord.conf diff --git a/Dockerfile b/Dockerfile index 61a355e..36851f3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,29 +1,25 @@ -FROM php:8.0-apache -RUN apt-get update && apt-get install -y \ - vim git -ADD https://raw.githubusercontent.com/mlocati/docker-php-extension-installer/master/install-php-extensions /usr/local/bin/ +FROM php:8.1.7-apache -RUN chmod uga+x /usr/local/bin/install-php-extensions && sync && \ - install-php-extensions pdo_pgsql +### Install surpervisor ### +RUN apt-get update -y +RUN apt-get install -y supervisor unzip git vim +RUN apt-get update && apt-get install -y libpq-dev && docker-php-ext-install pdo pdo_pgsql +RUN curl -sS https://getcomposer.org/installer -o composer-setup.php +RUN HASH=`curl -sS https://composer.github.io/installer.sig` +RUN php composer-setup.php --install-dir=/usr/local/bin --filename=composer +RUN mkdir -p /var/www/html/ /var/log/supervisor +COPY supervisord.conf /etc/supervisor/supervisord.conf +COPY apache2.conf /etc/apache2/apache2.conf +COPY .htaccess /var/www/ +RUN a2enmod rewrite +RUN a2enmod actions +## CONFIGURANDO AMBIENTE WEB ## +WORKDIR /var/www/public +RUN git config --global user.email "desenvolvimento@simplesip.com.br" +RUN git config --global user.name "Desenvolvimento" +COPY . /var/www/public +RUN composer install +EXPOSE 80 -RUN echo "ServerName 192.168.115.65" >> /etc/apache2/apache2.conf &&\ - a2enmod rewrite &&\ - a2dissite 000-default - -COPY apache2.conf /etc/apache2/ -COPY ports.conf /etc/apache2/ -COPY . . -RUN a2enmod headers -RUN service apache2 restart - -WORKDIR /var/www/html - -COPY index.php index.php - -RUN chmod -R 777 /var/www/html/ -RUN chmod -R 777 /tmp -RUN chown -R www-data:www-data /var/www/html -EXPOSE 8081 -EXPOSE 8090 -EXPOSE 5432 -ENTRYPOINT ["./inicia.sh"] \ No newline at end of file +#CMD supervisord -n -c /etc/supervisor/supervisord.conf +#CMD [ "/usr/sbin/httpd", "-D", "FOREGROUND" ] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index d287802..ca77837 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,8 +3,8 @@ networks: working: driver: bridge services: - postgresql: - build: docker/postgresql + db: + image: postgres restart: always #container_name: postgresql environment: @@ -18,28 +18,26 @@ services: volumes: - db:/var/lib/postgresql/data aplicativo: - build: docker/aplicativo - #container_name: aplicativo - working_dir: /var/www/html/aplicativo + build: . ports: - 8080:80 privileged: true environment: - container=docker - DB_PORT=5433 - - DB_HOST=192.168.115. + - DB_HOST=192.168.115.244 - DB_BASE=pbx - DB_USER=contacte - DB_PASSWD=ctepgSQL - - WHATSAPP_TOKEN= - - WHATSAPP_NUMBER= + - WHATSAPP_TOKEN=eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIxIiwianRpIjoiMjZmNWQ5OGZhOGMzMWEwMzc1Yzg2NzlhOWEwZGUxZGEzNzYzMDRiNzY0NDYxY2Q0YjBiOWZjOWUxZmM3ZDc4N2ZmNmYzMTZmYTc2OGQ3OGYiLCJpYXQiOjE2NTYzNTcxODQuNTU2MjI3LCJuYmYiOjE2NTYzNTcxODQuNTU2MjMsImV4cCI6MTY4Nzg5MzE4NC41NTQzNDksInN1YiI6IjQxMTgiLCJzY29wZXMiOltdfQ.S3D4kVgJprt3Ez_GzWdTgWf8zlm6dy9C4Fvcb_eHzZnRfyIffCQLcLsH2RqZ8oJOdNk2vB58SRBZ-iIg7wa2diIObbEi0UWtDEUPa1Z7kw3rD8z3fvxCy8MF4dOmGarQKxA3qm2rdu-zYOcKMPKS6YY2aCx6iy8jEp_7hEdS1sUhU8LvZ2TzfZ7EOJ3VaauF1qxQa6cBSxLR9zIdce9u6SQmRhQQlYivUxdwWP2KL3lFl6LjQoIL6yvZX63X1xaq8btjaWK1TkxfRlL7JdCrQH5daQD5K5eI6bJxl4-4EqpJMpXTctaye5jBjEvcyPxBcYCY-N4LAjgMUGkz88hNKb-7lWUC5-GryB3DxvV9VGbTR7T4bHEwuvo_YlMK1Wo06hOMq2T60-7S4fJr2CHYNaR-PLRC7LOTFfPqGt_8ssIcXFbdRnNGyhcgoxC_oFbPjY9oaFEYaUx3EXgUAYNHNFSj7-k2IRdeW9nnV2t2AX_uDFAmgSq6wBSE1O1MoXPAVULMR5pSonY199ylSkYVYwEqURuRdgNPKi_TnMl2JOllBWcU0ivp4fNCqTH1tAEJ1Rcz24MyVErWiwmmZRoaV3zg_N4hcp5LiPPB0NQY3SveFTxu1dtek3tF90jxCHweI2gnug7aVJHRyHgxzXgM5c9fIXDEYowIovhE8A-gTk0 + - WHATSAPP_NUMBER=ea4c9088-e34e-49ce-ba02-8ea55e6fdaa4 - WHATSAPP_PROVIDER=positus #(positus, twilio) -> NOME DO PROVEDOR A SER USADO depends_on: - - postgresql + - db networks: - working volumes: - - storage:/var/www/html/aplicativo/integracao/media/storage + - storage:/var/www/storage volumes: storage: db: diff --git a/docker/aplicativo/Dockerfile b/docker/aplicativo/Dockerfile-old similarity index 100% rename from docker/aplicativo/Dockerfile rename to docker/aplicativo/Dockerfile-old diff --git a/docker/aplicativo/supervisord.conf b/docker/aplicativo/supervisord.conf deleted file mode 100644 index e55196f..0000000 --- a/docker/aplicativo/supervisord.conf +++ /dev/null @@ -1,13 +0,0 @@ -[supervisord] -nodaemon=true -user=root - -[program:apache2] -command=/usr/bin/pidproxy /var/run/httpd.pid /bin/bash -c "/usr/sbin/httpd -DFOREGROUND -k start" -redirect_stderr=true - -[program:test_services] -command=php /var/www/html/aplicativo/integracao/media/tests/test_services.php - -[program:websocket] -command=php /var/www/html/aplicativo/integracao/media/websocket/websocket.php \ No newline at end of file diff --git a/docker/proxy/httpd.conf b/docker/proxy/httpd.conf index b42a47d..9f29400 100644 --- a/docker/proxy/httpd.conf +++ b/docker/proxy/httpd.conf @@ -107,7 +107,7 @@ LoadModule proxy_http_module modules/mod_proxy_http.so #LoadModule dialup_module modules/mod_dialup.so #LoadModule http2_module modules/mod_http2.so #LoadModule proxy_http2_module modules/mod_proxy_http2.so -#LoadModule md_module modules/mod_md.so +#LoadModule module modules/mod_md.so #LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so #LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so #LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so @@ -122,10 +122,10 @@ LoadModule autoindex_module modules/mod_autoindex.so #LoadModule info_module modules/mod_info.so #LoadModule suexec_module modules/mod_suexec.so - #LoadModule cgid_module modules/mod_cgid.so +#LoadModule cgid_module modules/mod_cgid.so - #LoadModule cgi_module modules/mod_cgi.so +#LoadModule cgi_module modules/mod_cgi.so #LoadModule dav_fs_module modules/mod_dav_fs.so #LoadModule dav_lock_module modules/mod_dav_lock.so @@ -148,24 +148,24 @@ Group www-data ServerAdmin you@example.com - AllowOverride none - Require all granted +AllowOverride none +Require all granted DocumentRoot "/usr/local/apache2/htdocs" - Options Indexes FollowSymLinks +Options Indexes FollowSymLinks - AllowOverride None - Require all granted +AllowOverride None +Require all granted - DirectoryIndex index.html +DirectoryIndex index.html - Require all denied +Require all denied ErrorLog /proc/self/fd/2 @@ -173,19 +173,31 @@ ErrorLog /proc/self/fd/2 LogLevel warn - LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined - LogFormat "%h %l %u %t \"%r\" %>s %b" common - - - # You need to enable mod_logio.c to use %I and %O - LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio - +LogFormat "%h %l %u %t \"%r\" %>s %b \"% { + Refere +} +i\" \"% { + User-Agen +} +i\"" combined +LogFormat "%h %l %u %t \"%r\" %>s %b" common + + +# You need to enable mod_logio.c to use %I and %O +LogFormat "%h %l %u %t \"%r\" %>s %b \"% { + Refere +} +i\" \"% { + User-Agen +} +i\" %I %O" combinedio + - CustomLog /proc/self/fd/1 common +CustomLog /proc/self/fd/1 common - ScriptAlias /cgi-bin/ "/usr/local/apache2/cgi-bin/" +ScriptAlias /cgi-bin/ "/usr/local/apache2/cgi-bin/" @@ -193,19 +205,19 @@ LogLevel warn - AllowOverride None - Options None - Require all granted +AllowOverride None +Options None +Require all granted - RequestHeader unset Proxy early +RequestHeader unset Proxy early - TypesConfig conf/mime.types - AddType application/x-compress .Z - AddType application/x-gzip .gz .tgz +TypesConfig conf/mime.types +AddType application/x-compress .Z +AddType application/x-gzip .gz .tgz @@ -218,25 +230,14 @@ SSLRandomSeed connect builtin - ProxyRequests On - - - Order deny,allow - Allow from all - - - ProxyVia On - - - CacheEnable disk / - CacheRoot "/var/cache/mod_proxy" - - - - -# example +ProxyRequests On -#ProxyPass /what1 http://192.168.115.244:8081/integracao/media/whatsapp -#ProxyPassReverse /what1 http://192.168.115.244:8081/integracao/media/whatsapp + +Order deny,allow +Allow from all + +ProxyVia On + +CacheEnable disk / \ No newline at end of file diff --git a/supervisord.conf b/supervisord.conf index e55196f..5b8add6 100644 --- a/supervisord.conf +++ b/supervisord.conf @@ -3,11 +3,11 @@ nodaemon=true user=root [program:apache2] -command=/usr/bin/pidproxy /var/run/httpd.pid /bin/bash -c "/usr/sbin/httpd -DFOREGROUND -k start" +command=service apache2 start redirect_stderr=true [program:test_services] -command=php /var/www/html/aplicativo/integracao/media/tests/test_services.php +command=php /var/www/tests/test_services.php [program:websocket] -command=php /var/www/html/aplicativo/integracao/media/websocket/websocket.php \ No newline at end of file +command=php /var/www/websocket/websocket.php \ No newline at end of file