Giter Club home page Giter Club logo

appengine-symfony-starter-project's Introduction

status: inactive

This project is no longer actively developed or maintained.

Please check out Running Symfony on App Engine for PHP 7.2 instead.

This repository contains a Symfony app for Google App Engine, based off the Symfony Standard Edition.

See How to Run Symfony Hello World on App Engine Standard Environment for the full tutorial.

Installation

Install this via composer. Follow the installation instructions if you do not already have composer installed.

Once composer is installed, execute the following command to create this project:

composer create-project google/appengine-symfony-starter-project

Set Up

To run the starter app, be sure to authorize gcloud for your project.

gcloud auth login

Run Locally

composer run-script server --timeout=0

Now browse to http://localhost:8080 in your browser to view your running application. This builds the cache for the "dev" environment and runs the dev_appserver.py script, which will be available if you've installed the Google App Engine Launcher. The command for this is defined in scripts/deploy.php.

Deployment

Deploy to your App Engine instance by running the following command:

composer run-script deploy --timeout=0

This builds the cache for the "prod" environment and runs gcloud app deploy, which will be available if you've installed the Google Cloud SDK. The command for this is defined in scripts/deploy.php.

See also the Symfony Hello World tutorial

Using Twig

It should be noted this example application uses a subclass of Twig_Environment, defined in src/Twig/Environment.php and configured in app/config/services.yml. The reason for this subclass is to customize the getOptionsHash method. Without this, the cache cannot be warmed up outside of the PHP version being used in App Engine.

Troubleshooting

  1. If Composer fails to download the dependencies, make sure that your local PHP installation satisfies Composer's system requirements. Specifically, cURL support is required.

  2. If you see errors about missing the default Cloud Storage bucket, follow the cloud integration instructions to create a default bucket for your project.

Contributing

Have a patch that will benefit this project? Awesome! Follow these steps to have it accepted.

  1. Please sign our Contributor License Agreement.
  2. Fork this Git repository and make your changes.
  3. Create a Pull Request
  4. Incorporate review feedback to your changes.
  5. Accepted!

License

All files in this repository are under the MIT License unless noted otherwise.

appengine-symfony-starter-project's People

Contributors

bshaffer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

appengine-symfony-starter-project's Issues

Why?

This project keeps getting abandoned. I really want to use app-engine. :(

Slow performance

I think I must have missed something. Getting just the Hello World to load is taking around 5-10 seconds per page load locally and around 800-1000ms running on App Engine. Locally (running dev_appserver.py), I can see a bunch of requests for cache files. Each cache file request does a HEAD request and a GET request against the local cloud storage interface:

HEAD /_ah/gcs/[bucket-name]/symfony/cache-None/...
GET /_ah/gcs/[bucket-name]/symfony/cache-None/...

Obviously, this slow performance is not what everyone else is getting. What did I miss?

Twig Issues in Production

There appears to be something missing from the modified Twig\Environment object. When the csrf_token() function is used in a template, I'm getting an error from the baseclass' getRuntime() method indicating it was unable to load Symfony\Bridge\Twig\Form\TwigRenderer. I worked around it by passing the token in from the controller instead of using the function in the template. I tried digging in to see what I could figure out but I'm not following what's going on in that class so I'm not really able to provide any insight into the root cause. Sorry.

Unable to create the cache directory (Local)

I can't get symfony to work because of the following error:

Unable to create the cache directory (gs://testing/symfony/cache)

php.ini

google_app_engine.allow_include_gs_buckets="testing"

app.yaml

env_variables:
  GCS_BUCKET_NAME: "testing"
  CURRENT_VERSION_ID: "0.0.1"
  CACHE_DIR: "gs://#default#/symfony/cache"
  LOG_DIR: "gs://#default#/symfony/log"

Using the latest version of this repository and latest version of AppEngine on Linux. GAE is loaded, verified by calling get_loaded_extensions.
I'm running AppEngine locally with the following command:

/home/vagrant/google_appengine/dev_appserver.py --php_executable_path=/bin/php-cgi --php_gae_extension_path=/usr/lib64/php/modules/gae_runtime_module.so --admin_host=0.0.0.0 --host=0.0.0.0 /vagrant/www

Can someone please help?

Uncaught Exception: Memcached >= 2.2.0 is required

Running through these instructions and with the small modification discussed in #23, I am encountering a new issue that prevents me from seeing the "HelloWorld" page.

<br />
<b>Fatal error</b>:  Uncaught exception 'Symfony\Component\Cache\Exception\CacheException' with message 'Memcached &gt;= 2.2.0 is required' in /Users/yeargism/Sites/appengine-symfony-starter-project/vendor/symfony/symfony/src/Symfony/Component/Cache/Traits/MemcachedTrait.php:77
Stack trace:
#0 /Users/yeargism/Sites/appengine-symfony-starter-project/vendor/symfony/symfony/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php(120): Symfony\Component\Cache\Adapter\MemcachedAdapter::createConnection('memcached://loc...', Array)
#1 /Users/yeargism/Sites/appengine-symfony-starter-project/app/cache/dev/appDevProjectContainer.php(2484): Symfony\Component\Cache\Adapter\AbstractAdapter::createConnection('memcached://loc...')
#2 /Users/yeargism/Sites/appengine-symfony-starter-project/app/cache/dev/appDevProjectContainer.php(2627): appDevProjectContainer-&gt;get8464c6758298cf75d30c4f689fb7886dService()
#3 /Users/yeargism/Sites/appengine-symfony-starter-project/app/cache/dev/appDevProjectContainer.php(304): appDevProjectContainer-&gt;getCache_Annota in <b>/Users/yeargism/Sites/appengine-symfony-starter-project/vendor/symfony/symfony/src/Symfony/Component/Cache/Traits/MemcachedTrait.php</b> on line <b>77</b><br />

Additionally, my console output indicates that it cannot connect to the memcached instance.

$ composer run-script server --timeout=0
> php scripts/server.php

 // Clearing the cache for the dev environment with debug                       
 // false                                                                       

PHP Warning:  Memcached::setMulti(): failed to set key Y5QIpvKpWI:%5BSymfony%5CComponent%5CForm%5CForm%5D%5B1%5D in /Users/yeargism/Sites/appengine-symfony-starter-project/vendor/symfony/symfony/src/Symfony/Component/Cache/Traits/MemcachedTrait.php on line 189

Warning: Memcached::setMulti(): failed to set key Y5QIpvKpWI:%5BSymfony%5CComponent%5CForm%5CForm%5D%5B1%5D in /Users/yeargism/Sites/appengine-symfony-starter-project/vendor/symfony/symfony/src/Symfony/Component/Cache/Traits/MemcachedTrait.php on line 189
PHP Warning:  Memcached::setMulti(): failed to set key Y5QIpvKpWI:%5BSymfony%5CComponent%5CForm%5CForm%24config%5D%5B1%5D in /Users/yeargism/Sites/appengine-symfony-starter-project/vendor/symfony/symfony/src/Symfony/Component/Cache/Traits/MemcachedTrait.php on line 189

Warning: Memcached::setMulti(): failed to set key Y5QIpvKpWI:%5BSymfony%5CComponent%5CForm%5CForm%24config%5D%5B1%5D in /Users/yeargism/Sites/appengine-symfony-starter-project/vendor/symfony/symfony/src/Symfony/Component/Cache/Traits/MemcachedTrait.php on line 189
PHP Warning:  Memcached::setMulti(): failed to set key Y5QIpvKpWI:%5BSymfony%5CComponent%5CForm%5CForm%24parent%5D%5B1%5D in /Users/yeargism/Sites/appengine-symfony-starter-project/vendor/symfony/symfony/src/Symfony/Component/Cache/Traits/MemcachedTrait.php on line 189

Warning: Memcached::setMulti(): failed to set key Y5QIpvKpWI:%5BSymfony%5CComponent%5CForm%5CForm%24parent%5D%5B1%5D in /Users/yeargism/Sites/appengine-symfony-starter-project/vendor/symfony/symfony/src/Symfony/Component/Cache/Traits/MemcachedTrait.php on line 189
PHP Warning:  Memcached::setMulti(): failed to set key Y5QIpvKpWI:%5BSymfony%5CComponent%5CForm%5CForm%24children%5D%5B1%5D in /Users/yeargism/Sites/appengine-symfony-starter-project/vendor/symfony/symfony/src/Symfony/Component/Cache/Traits/MemcachedTrait.php on line 189

Warning: Memcached::setMulti(): failed to set key Y5QIpvKpWI:%5BSymfony%5CComponent%5CForm%5CForm%24children%5D%5B1%5D in /Users/yeargism/Sites/appengine-symfony-starter-project/vendor/symfony/symfony/src/Symfony/Component/Cache/Traits/MemcachedTrait.php on line 189
PHP Warning:  Memcached::setMulti(): failed to set key Y5QIpvKpWI:%5BSymfony%5CComponent%5CForm%5CForm%24errors%5D%5B1%5D in /Users/yeargism/Sites/appengine-symfony-starter-project/vendor/symfony/symfony/src/Symfony/Component/Cache/Traits/MemcachedTrait.php on line 189

Warning: Memcached::setMulti(): failed to set key Y5QIpvKpWI:%5BSymfony%5CComponent%5CForm%5CForm%24errors%5D%5B1%5D in /Users/yeargism/Sites/appengine-symfony-starter-project/vendor/symfony/symfony/src/Symfony/Component/Cache/Traits/MemcachedTrait.php on line 189
PHP Warning:  Memcached::setMulti(): failed to set key Y5QIpvKpWI:%5BSymfony%5CComponent%5CForm%5CForm%24submitted%5D%5B1%5D in /Users/yeargism/Sites/appengine-symfony-starter-project/vendor/symfony/symfony/src/Symfony/Component/Cache/Traits/MemcachedTrait.php on line 189

Warning: Memcached::setMulti(): failed to set key Y5QIpvKpWI:%5BSymfony%5CComponent%5CForm%5CForm%24submitted%5D%5B1%5D in /Users/yeargism/Sites/appengine-symfony-starter-project/vendor/symfony/symfony/src/Symfony/Component/Cache/Traits/MemcachedTrait.php on line 189
PHP Warning:  Memcached::setMulti(): failed to set key Y5QIpvKpWI:%5BSymfony%5CComponent%5CForm%5CForm%24clickedButton%5D%5B1%5D in /Users/yeargism/Sites/appengine-symfony-starter-project/vendor/symfony/symfony/src/Symfony/Component/Cache/Traits/MemcachedTrait.php on line 189

[...]

My local environment (realizing that most of this should be run within the AppEngine container, but figuring it may be related):

$ gcloud -v
Google Cloud SDK 179.0.0
app-engine-python 1.9.62
bq 2.0.27
core 2017.11.06
gcloud 
gsutil 4.28
$ php -v
PHP 7.1.11 (cli) (built: Oct 27 2017 11:00:03) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
$ memcached --version
memcached 1.5.3
$ php -i | grep "libmemcached version"
libmemcached version => 1.0.18

parameters.yml not created on install because of missing package

It appears at some point between the updates to this package and today, the behavior of the sensio/distribution-bundle seems to have changed to not include incenteev/composer-parameter-handler by default. Running through the instructions, I observe:

Generating autoload files
Class Incenteev\ParameterHandler\ScriptHandler is not autoloadable, can not call post-install-cmd script
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap

Continuing through the tutorial will not allow the local server to start (because parameters.yml is missing). I was able to get around this by explicitly including incenteev/composer-parameter-handler as instructed here

composer require incenteev/composer-parameter-handler

I would like somebody more familiar with the intricacies of that package to confirm this is the best path, or if I missed something in the documentation.

remove Log Dir on production

There is no reason to have a log directory on Google Cloud Storage, since all logs are sent to the cloud logger (via SysLog presumably).

We need to verify this is set up and logging correctly before removal, however.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.