Share
Embed
Symfony auf Platform.sh
Wie man Symfony auf Platform.sh deployed und einige Informationen zu der YellowCube Lösung inkl. Integration mit Drupal Commerce und Magento von PostLogistics und Liip.
lsmith
May 01, 2015
Transcript
28 slides
-
Agile Web Development Liip.ch – SYMFONY DEMO AUF Erste Schri
e und Erfahrungen .. und eine kleine Überraschung -
SYMFONY @ LIIP • Liip setzte als eine der ersten
Agenturen weltweit auf Symfony2 • Symfony ist dank der modularen Architektur sehr verbreitet • Grosse Stärke von Symfony ist die Flexibilität und Time-To-Market mit hochgradig individualisierten Applikationen -
HOSTING PAIN POINTS @ LIIP • Hosting wird durch kundeneigene
IT oder einen Partner realisiert • Verzögerungsrisiko bei fehlender Entwicklungsumgebung • Kein Preview von parallelen Entwicklungszweigen möglich • Unterschiede zwischen Development, Staging und Produktion -
ARBEITEN MIT ENTWICKLUNGSZWEIGEN Code • Programm-Code • Infrastruktur Produktion Staging
Development Daten • Datenbank • Files • Solr-Index • etc. -
KONFIGURATION DER INFRASTRUKTUR • Kompakte Konfigurationsdateien direkt in der Applikation
• Services können leicht aktiviert werden (MySQL, Solr, Redis, ..) • Read Only Filesystem erhöht die Sicherheit • Persistenter Speicher verfügbar (z.B. für Logfiles, Caches ..) • Dedizierte Dokumentation auf platform.sh und auf symfony.com -
SYMFONY KONFIGURATION # Symfony specific settings in the .platform.app.yaml #
The toolstack used to build the application. toolstack: "php:symfony" # The configuration of app when it is exposed to the web. web: document_root: "/web" passthru: "/app.php" # The mounts that will be performed when the package is deployed. mounts: "/app/cache": "shared:files/cache" "/app/logs": "shared:files/logs" # The hooks that will be performed when the package is deployed. hooks: build: | rm web/app_dev.php app/console --env=prod assetic:dump --no-debug # At this point the file system is read-only! deploy: | app/console --env=prod cache:clear -
SERVICES AKTIVIERUNG # Enable services in the .platform/services.yaml # host:
database.internal, port: 3306, username/password: [blank] mysql: type: mysql disk: 2048 # host: redis.internal, scheme: redis, port: 6379 redis: type: redis # host: solr.internal, scheme: solr, port: 8080 solr: type: solr disk: 1024 -
DATABANK KONFIGURATION # app/config/config.yml imports: - { resource: parameters.yml }
- { resource: parameters_platform.php } - { resource: security.yml } .. <?php // app/config/parameters_platform.php $relationships = getenv("PLATFORM_RELATIONSHIPS"); if (!$relationships) { return; } $relationships = json_decode(base64_decode($relationships), TRUE); foreach ($relationships['database'] as $endpoint) { if (empty($endpoint['query']['is_master'])) { continue; } $container->setParameter('database_driver', 'pdo_' . $endpoint['scheme']); $container->setParameter('database_host', $endpoint['host']); $container->setParameter('database_port', $endpoint['port']); $container->setParameter('database_name', $endpoint['path']); $container->setParameter('database_user', $endpoint['username']); $container->setParameter('database_password', $endpoint['password']); $container->setParameter('database_path', ''); } -
PHP KONFIGURATION # Configure PHP extensions in the .platform.app.yaml #
Enabled by default are: pdo, mysql, mysqli, pdo_mysql, sqlite3, gd, curl, intl, mcrypt and zendopcache runtime: extensions: - http - redis - ssh2 disabled_extensions: - sqlite3 # Configure other PHP settings inside php.ini ; Increase PHP memory limit memory_limit = 256M ; Store sessions in /tmp, alternatively mount a shared directory session.save_path = '/tmp/sessions' -
ROUTING KONFIGURATION # Manage routing in the .platform/routes.yaml "http://{default}/": type:
upstream upstream: "php:php" "http://www.{default}/": type: redirect to: "http://{default}/" -
INTEGRATION MIT GITHUB • Automatisches Deployment von Entwicklungszweigen und PRs
• Deployment-Status wird direkt im PR angezeigt platform integration:add --type=github --token=GITHUB-USER-TOKEN --repository=USER/REPOSITORY Details siehe -
INTEGRATION MIT BLACKFIRE.IO • Integrierte Geschwindigkeitsanalyse durch platform.sh runtime: extensions:
- name: blackfire configuration: server_id: "ce95eba9-2d90-48b7-ad75-fcad42e1bcab" server_token: "ca7e32ac2d466ecfdf30b8ac43bdfef1304fc3feeb66e8906c1192b435e206f0" -
MEHR ALS NUR SYMFONY • Jedes Platform.sh Projekt kann sogar
mehrere Applikationen enthalten -
ROBUSTE + MODERNE INFRASTRUKTUR Platform.sh Enterprise bietet weiter wichtige Funktionen
• Integriertes CDN (Content Delivery Network) • Hochverfügbarkeit durch Nutzung von mehreren Datacenter (99,99%) • Elastische Skalierung • Kompatibel mit verschiedenen Public Clouds (Amazon, Azure) • Private Cloud auf Anfrage möglich -
UND NUN KOMMEN WIR ZUR KLEINEN ÜBERRASCHUNG • Entwickler werden
täglich mit neuen Services bombardiert • Viele dieser Services halten dann aber nicht was sie versprechen • Oder alles was nicht versprochen wurde fehlt am Ende • Unsere Entwickler sind daher mi lerweile sehr skeptisch -
DAS IST ADRIAN .. UND ER IST SKEPTISCH Dennoch hat
er in 4 Stunden vor seinen Ferien noch schnell ohne platform.sh Vorwissen, folgende Demo realisiert .. -
YELLOWCUBE Umfassende Logistiklösung für E-Commerce von PostLogistics • automatisierte Bestell-
und Versandprozesse (picking, packing and shipping) • Versand national oder international • Lagerung von Kleinteilen (< 30 kg) • Pale en- und Blocklager für grosse Güter -
YELLOWCUBE Und noch mehr • Retourenmanagement • Kundenindividuelle Verpackung •
Beilegen von Prospekten, Flyern etc • Seriennummererfassung • Verfalldaten • Verzollung -
YELLOWCUBE CONNECTOREN Open Source YellowCube Connectoren von Liip • PHP
Client Library (SOAP) • Magento Extension • Drupal Commerce Module GitHub: h ps://github.com/swisspost-yellowcube Infos: h p://www.liip.ch/de/yellowcube -
WIESO YELLOWCUBE AUF PLATFORM.SH? • Einfacher und schneller Start mit
ein paar Klicks • Vorkonfiguriertes Drupal Commerce mit YellowCube (Magento coming soon) • voll automatisiertes Deployment spart Kosten • Testen von parallelen Entwicklungszweigen • International skalierbare Shop-Lösung inkl. CDN