diff --git a/docker-compose.yml b/docker-compose.yml index 7f01720..d287802 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,10 +1,45 @@ -version: '3' +version: '3.7' +networks: + working: + driver: bridge services: - mid: - container_name: mid - build: . + postgresql: + build: docker/postgresql + restart: always + #container_name: postgresql + environment: + - POSTGRES_USER=contacte + - POSTGRES_PASSWORD=ctepgSQL + - POSTGRES_DB=pbx + ports: + - 5433:5432 + networks: + - working volumes: - - $PWD/data:/var/www/html/aplicativo/integracao/media/storage/files + - db:/var/lib/postgresql/data + aplicativo: + build: docker/aplicativo + #container_name: aplicativo + working_dir: /var/www/html/aplicativo ports: - - 8090:8090 - - 8081:8081 + - 8080:80 + privileged: true + environment: + - container=docker + - DB_PORT=5433 + - DB_HOST=192.168.115. + - DB_BASE=pbx + - DB_USER=contacte + - DB_PASSWD=ctepgSQL + - WHATSAPP_TOKEN= + - WHATSAPP_NUMBER= + - WHATSAPP_PROVIDER=positus #(positus, twilio) -> NOME DO PROVEDOR A SER USADO + depends_on: + - postgresql + networks: + - working + volumes: + - storage:/var/www/html/aplicativo/integracao/media/storage +volumes: + storage: + db: diff --git a/docker/aplicativo/Dockerfile b/docker/aplicativo/Dockerfile index d9a1dff..2ad17a8 100644 --- a/docker/aplicativo/Dockerfile +++ b/docker/aplicativo/Dockerfile @@ -1,7 +1,9 @@ FROM simplesip ### DOWNLOAD PROJECT ### -RUN mkdir -p /var/www/html/ +RUN yum install -y supervisor +RUN mkdir -p /var/www/html/ /var/log/supervisor +COPY supervisord.conf /etc/supervisor/supervisord.conf WORKDIR /var/www/html/ RUN git clone http://desenvolvimento:SimpleS_G1t34@192.168.115.83:3000/awade/aplicativo.git @@ -26,7 +28,5 @@ RUN sh scriptdb/install/docker/simplesip/sip_install.sh EXPOSE 80 -ENTRYPOINT ["scriptdb/install/docker/simplesip/init.sh"] - - -CMD [ "/usr/sbin/httpd", "-D", "FOREGROUND" ] \ 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/aplicativo/supervisord.conf b/docker/aplicativo/supervisord.conf new file mode 100644 index 0000000..e55196f --- /dev/null +++ b/docker/aplicativo/supervisord.conf @@ -0,0 +1,13 @@ +[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/supervisord.conf b/supervisord.conf new file mode 100644 index 0000000..e55196f --- /dev/null +++ b/supervisord.conf @@ -0,0 +1,13 @@ +[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/wpp b/wpp deleted file mode 100644 index 4ae91bc..0000000 --- a/wpp +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash -# -# chkconfig: 35 90 12 -# description: Foo server -# - -# Get function from functions library -. /etc/init.d/functions - -# Start the service FOO -script="./websocket.php" -script2="./test_services.php" -name="wpp" -start() { - if [ "$(ps aux | grep $script | grep -v grep)" != "" ] && [ "$(ps aux | grep $script2 | grep -v grep)" != "" ]; then - echo "$name em execucao." - exit 1 - else - php /var/www/html/aplicativo/integracao/media/websocket/$script & - php /var/www/html/aplicativo/integracao/media/tests/$script2 & - echo "iniciado $name" - fi -} -stop() { - kill $(ps aux | grep $script | grep -v "grep" | awk '{print $2}') - kill $(ps aux | grep $script2 | grep -v "grep" | awk '{print $2}') - echo "Desligando $name" -} -status() { - if [ "$(ps aux | grep $script | grep -v "grep")" != "" ] && [ "$(ps aux | grep $script2 | grep -v "grep")" != "" ]; then - echo "$name Iniciado." - else - echo "$name Parado." - fi -} - -case "$1" in -start) - start - ;; -stop) - stop - ;; -restart) - stop - sleep 2 - start - ;; -status) - status - ;; -*) - echo $"usa assim vagabundo: $name {start|stop|restart|reload|status}" - exit 1 - ;; -esac - -exit 0