Selaa lähdekoodia

Merge branch 'master' of https://bitbucket.org/ikflowdat/stats into FD3-208

Maximiliano Schvindt 7 vuotta sitten
vanhempi
commit
458ec2f50c

+ 5 - 12
.drone.yml

@@ -8,29 +8,22 @@ services:
   amqp:
     image: rabbitmq:3-management
 
-
 pipeline:
  build:
-  image: debian:9.0
+  image: docker.infra.flowdat.com/fd3/sf-php:latest
   commands:
+      - command -v mysqladmin >/dev/null 2>&1 || { echo "I require mysqladmin but it's not installed.  Aborting." >&2; exit 1; }
+      - while ! mysqladmin ping -h 127.0.0.1 --silent; do :; done
       - echo 'Acquire::http { Proxy "http://200.50.168.30:3142"; };' > /etc/apt/apt.conf.d/01proxy
-      - apt-get update && apt-get install -yq build-essential git php7.0-cli php7.0-mysql mysql-client php7.0-curl php7.0-xml php7.0-bcmath php7.0-mbstring php7.0-zip
 
       - yes | mysqladmin -h 127.0.0.1 create fd3_stats
       - yes | mysqladmin -h 127.0.0.1 create fd_session
       
-      - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
-      - php composer-setup.php --install-dir=/usr/local/bin/ --filename=composer
-      - php -r "unlink('composer-setup.php');"
       - echo 'client = Flowdat3-Stats-Drone-Test' | tee /etc/flowdat.conf
-      - mkdir -p /root/.ssh/
-      - ssh-keyscan bitbucket.org >> ~/.ssh/known_hosts
-      - ssh-keyscan -p222 200.50.168.30 >> ~/.ssh/known_hosts
-      - ssh-keyscan -p222 infra.flowdat.com >> ~/.ssh/known_hosts
-      - ssh-keyscan -p222 gogs.infra.flowdat.com >> ~/.ssh/known_hosts
+
       - chmod 0400 keys/bitbucket.id_rsa
       - eval $(ssh-agent); ssh-add keys/bitbucket.id_rsa
-      - composer install -n
+      - composer install -n --no-progress
       - chmod 0777 -R var/logs var/cache var/sessions
       - php bin/console doctrine:schema:update --force -vvv --env=test
       - vendor/phpunit/phpunit/phpunit --tap

+ 8 - 23
Dockerfile

@@ -1,35 +1,20 @@
-FROM debian:9
+FROM docker.infra.flowdat.com/fd3/sf-php:latest
 EXPOSE 8000
 
-#RUN echo "Acquire::http::Proxy \"http://172.17.0.5:3142\";" | tee /etc/apt/apt.conf.d/00aptproxy
-
-RUN apt-get update && apt-get install -yq build-essential git php7.0-cli php7.0-mysql mysql-client php7.0-curl php7.0-xml php7.0-bcmath php7.0-mbstring php7.0-zip
-
-RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
-RUN php -r "if (hash_file('SHA384', 'composer-setup.php') === '669656bab3166a7aff8a7506b8cb2d1c292f042046c5a994c43155c0be6190fa0355160742ab2e1c88d40d5be660b410') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
-RUN php composer-setup.php --install-dir=/usr/local/bin --filename=composer
-RUN php -r "unlink('composer-setup.php');"
-
 ADD . /opt/stats
 
 RUN rm /opt/stats/var/cache/* -rf
 
-RUN mkdir ~/.ssh
-RUN ssh-keyscan -H bitbucket.org >> ~/.ssh/known_hosts
-RUN ssh-keyscan -H -p 222 200.50.168.30 >> ~/.ssh/known_hosts
-RUN ssh-keyscan -H -p 222 infra.flowdat.com >> ~/.ssh/known_hosts
-RUN ssh-keyscan -H -p 222 gogs.infra.flowdat.com >> ~/.ssh/known_hosts
-
 WORKDIR /opt/stats
 
 RUN cp -r keys /opt/keys/
 RUN chmod 0600 /opt/keys/*
 
 CMD  eval $(ssh-agent) ; ssh-add /opt/keys/bitbucket.id_rsa ; composer install --no-scripts --no-interaction ;\
-	rm var/cache/* -rf ;\
- 	cp app/config/parameters.yml.docker app/config/parameters.yml ;\
- 	cp app/config/bundles/hwi/oauth-bundle/parameters.yml.docker app/config/bundles/hwi/oauth-bundle/parameters.yml ;\
-	cp app/config/bundles/ik/webservice-bundle/parameters.yml.docker app/config/bundles/ik/webservice-bundle/parameters.yml ;\
-	composer dump-autoload ;\
-        composer run-script symfony-scripts --no-interaction ;\
-        bin/console server:run 0.0.0.0
+     rm var/cache/* -rf ;\
+     cp app/config/parameters.yml.docker app/config/parameters.yml ;\
+     cp app/config/bundles/hwi/oauth-bundle/parameters.yml.docker app/config/bundles/hwi/oauth-bundle/parameters.yml ;\
+     cp app/config/bundles/ik/webservice-bundle/parameters.yml.docker app/config/bundles/ik/webservice-bundle/parameters.yml ;\
+     composer dump-autoload ;\
+     composer run-script symfony-scripts --no-interaction ;\
+     bin/console server:run 0.0.0.0

+ 3 - 1
app/AppKernel.php

@@ -43,7 +43,9 @@ class AppKernel extends Kernel
             new FiberhomeBundle\FiberhomeBundle(),
             new StatsDBundle\StatsDBundle(),
             new GeoserverBundle\GeoserverBundle(),
-            new LeafletBundle\LeafletBundle()
+            new LeafletBundle\LeafletBundle(),
+            new SimpleThings\EntityAudit\SimpleThingsEntityAuditBundle(),
+            new AuditBundle\AuditBundle()
         ];
 
         if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {

+ 3 - 0
app/config/bundles/ik/audit-bundle/parameters.yml

@@ -0,0 +1,3 @@
+# This file is auto-generated during the composer install
+parameters:
+    audit_show_menu: true

+ 3 - 0
app/config/bundles/ik/audit-bundle/parameters.yml.dist

@@ -0,0 +1,3 @@
+parameters:
+    # Muestra el menú Auditoría
+    audit_show_menu: false

+ 5 - 1
app/config/config.yml

@@ -18,11 +18,13 @@ imports:
     - { resource: "@StatsBundle/Resources/config/services.yml" }
     - { resource: '@BaseAdminBundle/Resources/config/services.yml' }
     - { resource: '@GeoserverBundle/Resources/config/services.yml' }
+    - { resource: "@AuditBundle/Resources/config/services.yml" }
 
 # Put parameters here that don't need to change on each machine where the app is deployed
 # http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
 parameters:
     locale: es
+    app_name: stats
 
 framework:
     #esi: ~
@@ -55,6 +57,8 @@ framework:
 twig:
     debug: '%kernel.debug%'
     strict_variables: '%kernel.debug%'
+    globals:
+        fd_alerts: '@base_admin.alert_service'
 
 # Doctrine Configuration
 doctrine:
@@ -95,4 +99,4 @@ sonata_block:
 sonata_admin:
     templates:
         layout: BaseAdminBundle::standard_layout.html.twig
-        user_block: BaseOAuthClientBundle:Core:oauth_user_block.html.twig
+        user_block: BaseOAuthClientBundle:Core:oauth_user_block.html.twig

+ 9 - 0
app/config/routing.yml

@@ -44,3 +44,12 @@ base_hwioauthbundle_oauth_client:
 admin_tenancy_change_tenancy_global_ajax:
     path: changeTenancyAjaxAction
     defaults: { _controller: BaseAdminBundle:RedirectionAjax:changeTenancyAjax }
+
+baseadmin_alert:
+    resource: "@BaseAdminBundle/Controller"
+    type:     annotation
+
+audit:
+    resource: "@AuditBundle/Controller/"
+    type:     annotation
+    prefix:   /

+ 1 - 1
bin/symfony_requirements

@@ -1,7 +1,7 @@
 #!/usr/bin/env php
 <?php
 
-require_once dirname(__FILE__).'/../var/SymfonyRequirements.php';
+require_once dirname(__FILE__).'/./SymfonyRequirements.php';
 
 $lineSize = 70;
 $symfonyRequirements = new SymfonyRequirements();

+ 12 - 1
composer.json

@@ -100,6 +100,13 @@
         {
             "type": "vcs",
             "url":  "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/LeafletBundle.git"
+        },
+        {
+            "type": "vcs",
+            "url": "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/AuditBundle.git",
+            "options": {
+                "local_pk": "./keys/bitbucket.id_rsa"
+            }
         }
     ],
     "require": {
@@ -135,7 +142,8 @@
         "symfony/swiftmailer-bundle": "^2.3.10",
         "symfony/symfony": "3.2.*",
         "twig/twig": "^1.0||^2.0",
-        "voryx/restgeneratorbundle": "dev-master"
+        "voryx/restgeneratorbundle": "dev-master",
+        "ik/audit-bundle": "dev-master"
     },
     "require-dev": {
         "sensio/generator-bundle": "^3.0",
@@ -188,6 +196,9 @@
             },
             {
                 "file": "app/config/bundles/hwi/oauth-bundle/parameters.yml"
+            },
+            {
+                "file": "app/config/bundles/ik/audit-bundle/parameters.yml"
             }
         ],
         "branch-alias": null

+ 82 - 6
composer.lock

@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
         "This file is @generated automatically"
     ],
-    "content-hash": "52a4fa87ec5a63187f0d15bff7a04850",
+    "content-hash": "3da4979cb87bdb948a34a18016ebb293",
     "packages": [
         {
             "name": "behat/transliterator",
@@ -1391,6 +1391,30 @@
             ],
             "time": "2017-01-08T14:13:58+00:00"
         },
+        {
+            "name": "ik/audit-bundle",
+            "version": "dev-master",
+            "source": {
+                "type": "git",
+                "url": "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/AuditBundle.git",
+                "reference": "deba8813246a14dd17b160e44a35bb4811c13452"
+            },
+            "require": {
+                "simplethings/entity-audit-bundle": "^1.0"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "AuditBundle\\": ""
+                }
+            },
+            "description": "The Flowdat3 Audit Bundle",
+            "keywords": [
+                "audit",
+                "bundle"
+            ],
+            "time": "2017-06-27 13:16:34"
+        },
         {
             "name": "ik/base-admin-bundle",
             "version": "dev-master",
@@ -1420,7 +1444,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@infra.flowdat.com:222/VendorSoftwareFlowdat3/DeviceBundle.git",
-                "reference": "f6b8fdcefdf517a0a28f4c8abd79940228e6ac7c"
+                "reference": "d6e4b53c759bdce8f03580e8783b1f40581f0d3f"
             },
             "type": "library",
             "autoload": {
@@ -1435,7 +1459,7 @@
                 "bundle",
                 "validators"
             ],
-            "time": "2017-08-15 13:45:08"
+            "time": "2017-09-15 14:14:26"
         },
         {
             "name": "ik/extra-data-bundle",
@@ -1647,7 +1671,7 @@
             "source": {
                 "type": "git",
                 "url": "ssh://git@infra.flowdat.com:222/VendorSoftwareFlowdat3/Webservice.git",
-                "reference": "464007b3df353eb346aefd1b3ddb8a1827dc8e69"
+                "reference": "9ca153996372b0e67788c32628b2fa49a43e3e13"
             },
             "require": {
                 "ext-curl": "*",
@@ -1660,7 +1684,7 @@
                 }
             },
             "description": "The Flowdat3 Webservice Rest",
-            "time": "2017-09-07 13:15:50"
+            "time": "2017-09-15 13:40:56"
         },
         {
             "name": "incenteev/composer-parameter-handler",
@@ -4267,6 +4291,57 @@
             "description": "A security checker for your composer.lock",
             "time": "2017-08-03T12:24:05+00:00"
         },
+        {
+            "name": "simplethings/entity-audit-bundle",
+            "version": "v1.0.6",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/simplethings/EntityAuditBundle.git",
+                "reference": "ee71ea62735797f5b6562590e15cd237edce6489"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/simplethings/EntityAuditBundle/zipball/ee71ea62735797f5b6562590e15cd237edce6489",
+                "reference": "ee71ea62735797f5b6562590e15cd237edce6489",
+                "shasum": ""
+            },
+            "require": {
+                "doctrine/dbal": "~2.5",
+                "doctrine/orm": "~2.4",
+                "php": "^5.3.9|~7.0"
+            },
+            "conflict": {
+                "doctrine/doctrine-bundle": "<1.4",
+                "gedmo/doctrine-extensions": "<2.3.1",
+                "symfony/framework-bundle": "<2.7"
+            },
+            "require-dev": {
+                "doctrine/doctrine-bundle": "~1.4",
+                "fabpot/php-cs-fixer": "^1.11",
+                "gedmo/doctrine-extensions": "^2.3.1",
+                "matthiasnoback/symfony-dependency-injection-test": "^1.0",
+                "phpunit/phpunit": "^4.8",
+                "symfony/framework-bundle": "~2.7|~3.0",
+                "symfony/var-dumper": "^2.7"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "SimpleThings\\EntityAudit\\": "src/SimpleThings/EntityAudit"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "LGPL-2.1"
+            ],
+            "description": "Audit for Doctrine Entities",
+            "keywords": [
+                "Audit",
+                "database",
+                "persistence"
+            ],
+            "time": "2017-07-24T15:38:35+00:00"
+        },
         {
             "name": "sonata-project/admin-bundle",
             "version": "3.20.1",
@@ -6064,7 +6139,8 @@
         "ik/statsd-bundle": 20,
         "ik/webservice-bundle": 20,
         "opensolutions/oss-snmp": 20,
-        "voryx/restgeneratorbundle": 20
+        "voryx/restgeneratorbundle": 20,
+        "ik/audit-bundle": 20
     },
     "prefer-stable": false,
     "prefer-lowest": false,

+ 1 - 1
web/config.php

@@ -22,7 +22,7 @@ if (!in_array(@$_SERVER['REMOTE_ADDR'], array(
     exit('This script is only accessible from localhost.');
 }
 
-require_once dirname(__FILE__).'/../var/SymfonyRequirements.php';
+require_once dirname(__FILE__).'/./SymfonyRequirements.php';
 
 $symfonyRequirements = new SymfonyRequirements();