Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate from Silex to Symfony4 #38

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/build/
/vendor/
/cache/*
/logs/*
silex.log
/config/parameters.yml
/.vagrant
node_modules/
web/css/*
web/img/*
web/js/*

/.phpunit.result.cache
/var/
!/var/.gitkeep
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# AmsterdamPHP - Meetup.com Raffler

This application enables us to raffle off stuff to our meetup attendees. It uses the Meetup.com API to get all check ins, and then uses the Random.org API to randomly select winners.
This application enables us to raffle off stuff to our meetup attendees. It uses the Meetup.com API to get all check ins, and then randomly selects winners.

## Installation

Expand All @@ -10,14 +10,18 @@ Ensure that [VirtualBox](https://www.virtualbox.org), [Vagrant](http://www.vagra

1. `git clone [email protected]:AmsterdamPHP/meetup-raffle-machine.git --recursive`
2. run `vagrant up`
3. create config/parameters.yml (get your API key from [meetup.com](https://secure.meetup.com/meetup_api/key/))
3. create `config/parameters.yml` (get your API key from [meetup.com](https://secure.meetup.com/meetup_api/key/))

```
meetup_group: amsterdamphp
meetup_api_key: YOUR_MEETUP_API_KEY
parameters:
meetup_group: amsterdamphp
meetup_api_key: YOUR_MEETUP_API_KEY
secret: SomeRandomSecretToSeedSymfony
redis_dsn: redis://locahost
rpkamp marked this conversation as resolved.
Show resolved Hide resolved
```
4. Add the following to your hosts file: `10.10.10.10 raffler.local`

All done! Now you can access the application at [http://app.local/](http://app.local/).
All done! Now you can access the application at [http://raffler.local/](http://raffler.local/).

### Install directly onto your host machine.

Expand Down Expand Up @@ -45,8 +49,11 @@ All done! Now you can access the application at [http://app.local/](http://app.l
5. Create config/parameters.yml

```
meetup_group: amsterdamphp
meetup_api_key: YOUR_MEETUP_API_KEY
parameters:
meetup_group: amsterdamphp
meetup_api_key: YOUR_MEETUP_API_KEY
secret: SomeRandomSecretToSeedSymfony
redis_dsn: redis://locahost
```

## How to use it
Expand Down
57 changes: 28 additions & 29 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,63 +1,62 @@
# vagrant init ubuntu/trusty64
# vagrant init ubuntu/xenial64

Vagrant.configure("2") do |config|
config.vm.box = "trusty64"
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
config.vm.box = "ubuntu/xenial64"

config.vm.network :private_network, ip: "10.10.10.10"
config.vm.hostname = "app.local"

config.vm.provider :virtualbox do |v|
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
v.customize ["modifyvm", :id, "--memory", 1024]
v.customize ["modifyvm", :id, "--name", "Meetup Raffle Machine"]
v.customize ["modifyvm", :id, "--name", "AmsterdamPHP Raffler"]
end

config.vm.provider :libvirt do |domain|
domain.memory = 1024
config.vm.provision "shell" do |s|
s.inline = "sudo apt-get update && sudo apt-get install -y python"
end

if (/linux/ =~ RUBY_PLATFORM) != nil
config.vm.synced_folder "./", "/vagrant", id: "vagrant-root", nfs: true, :linux__nfs_options => ['rw','no_subtree_check','all_squash','async']
else
config.vm.synced_folder "./", "/vagrant", id: "vagrant-root", :nfs => true
end

if not Vagrant.has_plugin?("vagrant-hostmanager")
if system "vagrant plugin install vagrant-hostmanager"
exec "vagrant #{ARGV.join(' ')}"
else
abort "Aborting due to plugin installation failure."
end
end

config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.include_offline = true

config.vm.provision "ansible" do |ansible|
ansible.playbook = "ansible/provision.yml"
ansible.extra_vars = {
hostname: "dev",
hostname: "raffler",
dbuser: "root",
dbpasswd: "password",
databases: ["development"],
sites: [
{
hostname: "app.local",
hostname: "raffler.local",
document_root: "/vagrant/web"
}
],
php_configs: [
],
install_postgresql: "no",
postgresql_version: "9.5",
postgresql_user: "root",
postgresql_passwd: "password",
postgresql_databases: ["development"],
install_gems: [],
install_db: "no",
install_ohmyzsh: "yes",
install_web: "yes",
install_mailcatcher: "no",
install_hhvm: "no",
install_beanstalkd: "no",
install_redis: "yes",
install_javascript_build_system: "yes"
install_javascript_build_system: "yes",
install_r: "no",
install_rabbit_mq: "no",
r_packages: [],
enable_swap: "yes",
swap_size_in_mb: "1024",
install_eventstore: "no",
eventstore_version: "3.0.1",
eventstore_bind_ip: "10.10.10.10",
eventstore_http_prefix: "http://app.local:2113/"
}
end

config.vm.provision "shell", path: "post-install.sh"
config.vm.provision "shell" do |s|
s.inline = "sh /vagrant/post-install.sh"
end
end
2 changes: 1 addition & 1 deletion ansible
42 changes: 42 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env php
<?php

use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;

if (false === in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.\PHP_SAPI.' SAPI'.\PHP_EOL;
}

set_time_limit(0);

require dirname(__DIR__).'/vendor/autoload.php';

if (!class_exists(Application::class)) {
throw new RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
}

$input = new ArgvInput();
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
}

if ($input->hasParameterOption('--no-debug', true)) {
putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
}

require dirname(__DIR__).'/config/bootstrap.php';

if ($_SERVER['APP_DEBUG']) {
umask(0000);

if (class_exists(Debug::class)) {
Debug::enable();
}
}

$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$application = new Application($kernel);
$application->run($input);
Empty file removed cache/.gitkeep
Empty file.
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
machine:
php:
version: 7.0.4
version: 7.2

dependencies:
override:
Expand Down
101 changes: 65 additions & 36 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,72 @@
{
"name": "amsterdamphp/meetup-raffle-machine",

"type": "project",
"license": "proprietary",
"require": {
"php": "^7.2",
"ext-ctype": "*",
"ext-iconv": "*",
"dms/meetup-api-client": "^2.3",
"ircmaxell/random-lib": "^1.2",
"predis/predis": "^1.1",
"sensio/framework-extra-bundle": "^5.3",
"snc/redis-bundle": "^2.1",
"symfony/console": "4.3.*",
"symfony/debug-pack": "^1.0",
"symfony/dotenv": "4.3.*",
"symfony/flex": "^1.1",
"symfony/framework-bundle": "4.3.*",
"symfony/monolog-bundle": "^3.4",
"symfony/twig-bundle": "4.3.*",
"symfony/yaml": "4.3.*"
},
"config": {
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"psr-0": { "": "src/" }
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"paragonie/random_compat": "2.*",
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php56": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "4.3.*"
},
"public-dir": "web/"
},

"require": {
"php": ">=5.3.3",

"silex/silex": "^1.0",
"twig/twig": ">=1.8.0,<2.0-dev",
"monolog/monolog": ">=1.0.0,<1.2-dev",

"symfony/browser-kit": "^2.1",
"symfony/class-loader": "^2.1",
"symfony/config": "^2.1",
"symfony/console": "^2.1",
"symfony/css-selector": "^2.1",
"symfony/finder": "^2.1",
"symfony/form": "^2.1",
"symfony/monolog-bridge": "^2.1",
"symfony/process": "^2.1",
"symfony/security": "^2.1",
"symfony/translation": "^2.1",
"symfony/twig-bridge": "^2.1",
"symfony/validator": "^2.1",
"symfony/yaml": "^2.1",

"dms/meetup-api-client": "~1.0@dev",
"predis/predis": "~0.8",
"ircmaxell/random-lib": "^1.1"

},

"repositories": [
],
"require-dev": {
"deployer/deployer": "^4@dev",
"symfony/var-dumper": "^3.1",
"phpunit/phpunit": "^5.4"
"phpunit/phpunit": "^8.2"
}
}
Loading