diff --git a/README.md b/README.md
index 6978f675c9b6..68de0242be25 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,7 @@ This isn't actually ready for anyone to use yet, as I'm still working out some o
## Requirements
-- PHP 5.3.7 or later
+- PHP 5.4 or later
- MCrypt PHP Extension
-----
@@ -43,41 +43,63 @@ Forgetting to do this can mean your DB might end up out of sync with the new fil
-----
-### 2) Install the Dependencies via Composer
-##### 2.1) If you don't have composer installed globally
+### 2) Setup Database and Mail Settings
- cd your-folder
- curl -s http://getcomposer.org/installer | php
- php composer.phar install
+#### 2.1) Setup Your Database
-##### 2.2) For globally composer installations
+Copy the example database config `app/config/local/database.example.php` to `database.php`.
+Update the file `app/config/local/database.php` with your database name and credentials.
- cd your-folder
- composer install
+ vi app/config/local/database.php
------
+#### 2.2) Setup Mail Settings
+
+Copy the example mail config `app/config/local/database.example.php` to `database.php`.
+Update the file `app/config/local/mail.php` with your mail settings.
+
+ vi app/config/local/mail.php
+
+This will be used to send emails to your users, when they register and they request a password reset.
+
+#### 2.3) Adjust the application settings.
+
+Copy the example app config `app/config/local/app.example.php` to `app.php`.
+
+Update the file `app/config/local/app.php` with your setting URL settings.
+
+ vi app/config/local/app.php
-### 3) Setup Database
+You should also change your secret key here -- if you prefer to have your key randomly generated, run the artisan key:generate command from the application root.
-Copy the file `app/config/database.php` to `database.php`, and update `database.php` with your database name and credentials
+ php artisan key:generate --env=local
- cp app/config/database.example.php app/config/database.php
- vi app/config/database.example.php
+#### 2.4) Adjust Environments
+
+Update the file `boostrap/start.php' under the section `Detect The Application Environment`.
+
+ vi bootstrap/start.php
+
+#### 2.5) Additional Adjustments
+
+The app is configured to automatically detect if your in a local, staging, or production environment. Before deploying to a staging or production environment, follow sets 2.1, 2.2, and 2.3 above to tweak each environment as nescessary. Configuration files for each environment can be found in app/config/{environment} (local, staging, and production).
-----
-### 4) Setup Mail Settings
+### 3) Install the Dependencies via Composer
+##### 3.1) If you don't have composer installed globally
-Now, copy the file `app/config/mail.php` to `mail.php`, and update `mail.php` with your mail settings
+ cd your-folder
+ curl -s http://getcomposer.org/installer | php
+ php composer.phar install
- cp app/config/mail.example.php app/config/mail.php
- vi app/config/mail.example.php
+##### 3.2) For global composer installations
-This will be used to send emails to your users, when they register and they request a password reset.
+ cd your-folder
+ composer install
-----
-### 5) Use custom CLI Installer Command
+### 4) Use custom CLI Installer Command
Now, you need to create yourself a user and finish the installation.
@@ -101,7 +123,7 @@ If you still run into a permissions error, you may need to increase the permissi
### 7) Set the correct document root for your server
-The document root for the app should be set to the public directory. In a standard Apache virtualhost setup, that might look something like this:
+The document root for the app should be set to the public directory. In a standard Apache virtualhost setup, that might look something like this on a standard linux LAMP stack:
DocumentRoot /var/www/html/public
@@ -110,6 +132,19 @@ The document root for the app should be set to the public directory. In a standa
# Other directives here
+An OS X virtualhost setup could look more like:
+
+ Directory "/Users/flashingcursor/Sites/snipe-it/public/">
+ Allow From All
+ AllowOverride All
+ Options +Indexes
+
+
+ ServerName "snipe-it.dev"
+ DocumentRoot "/Users/flashingcursor/Sites/snipe-it/public"
+ SetEnv LARAVEL_ENV development
+
+
-----
### 8) Seed the Database
diff --git a/app/config/app.php b/app/config/app.php
index 17c04bec5c97..1f8c5a509109 100755
--- a/app/config/app.php
+++ b/app/config/app.php
@@ -2,32 +2,6 @@
return array(
- /*
- |--------------------------------------------------------------------------
- | Application Debug Mode
- |--------------------------------------------------------------------------
- |
- | When your application is in debug mode, detailed error messages with
- | stack traces will be shown on every error that occurs within your
- | application. If disabled, a simple generic error page is shown.
- |
- */
-
- 'debug' => true,
-
- /*
- |--------------------------------------------------------------------------
- | Application URL
- |--------------------------------------------------------------------------
- |
- | This URL is used by the console to properly generate URLs when using
- | the Artisan command line tool. You should set this to the root of
- | your application so that it is used when running Artisan tasks.
- |
- */
-
- 'url' => 'http://localhost',
-
/*
|--------------------------------------------------------------------------
| Application Timezone
@@ -43,29 +17,16 @@
/*
|--------------------------------------------------------------------------
- | Application Locale Configuration
- |--------------------------------------------------------------------------
- |
- | The application locale determines the default locale that will be used
- | by the translation service provider. You are free to set this value
- | to any of the locales which will be supported by the application.
- |
- */
-
- 'locale' => 'en',
-
- /*
- |--------------------------------------------------------------------------
- | Encryption Key
+ | Application Debug Mode
|--------------------------------------------------------------------------
|
- | This key is used by the Illuminate encrypter service and should be set
- | to a random, 32 character string, otherwise these encrypted strings
- | will not be safe. Please do this before deploying an application!
+ | When your application is in debug mode, detailed error messages with
+ | stack traces will be shown on every error that occurs within your
+ | application. If disabled, a simple generic error page is shown.
|
*/
- 'key' => 'YourSecretKey!!!',
+ 'debug' => false,
/*
|--------------------------------------------------------------------------
diff --git a/app/config/local/.gitignore b/app/config/local/.gitignore
new file mode 100644
index 000000000000..3fbd46353dac
--- /dev/null
+++ b/app/config/local/.gitignore
@@ -0,0 +1,3 @@
+app.php
+mail.php
+database.php
diff --git a/app/config/local/app.example.php b/app/config/local/app.example.php
new file mode 100644
index 000000000000..e9b06cdd0f4b
--- /dev/null
+++ b/app/config/local/app.example.php
@@ -0,0 +1,45 @@
+ true,
+
+ /*
+ |--------------------------------------------------------------------------
+ | Application URL
+ |--------------------------------------------------------------------------
+ |
+ | This URL is used by the console to properly generate URLs when using
+ | the Artisan command line tool. You should set this to the root of
+ | your application so that it is used when running Artisan tasks.
+ |
+ */
+
+ 'url' => 'http://snipeit.dev',
+
+ /*
+ |--------------------------------------------------------------------------
+ | Encryption Key
+ |--------------------------------------------------------------------------
+ |
+ | This key is used by the Illuminate encrypter service and should be set
+ | to a random, 32 character string, otherwise these encrypted strings
+ | will not be safe. Please do this before deploying an application!
+ |
+ | Run a php artisand key:generate --env=staging to create a random one
+ */
+
+ 'key' => 'Change_this_key_or_snipe_will_get_ya',
+
+);
diff --git a/app/config/database.example.php b/app/config/local/database.example.php
similarity index 100%
rename from app/config/database.example.php
rename to app/config/local/database.example.php
diff --git a/app/config/mail.example.php b/app/config/local/mail.example.php
similarity index 100%
rename from app/config/mail.example.php
rename to app/config/local/mail.example.php
diff --git a/app/config/production/.gitignore b/app/config/production/.gitignore
new file mode 100644
index 000000000000..3fbd46353dac
--- /dev/null
+++ b/app/config/production/.gitignore
@@ -0,0 +1,3 @@
+app.php
+mail.php
+database.php
diff --git a/app/config/production/app.example.php b/app/config/production/app.example.php
new file mode 100644
index 000000000000..598b272ed3d3
--- /dev/null
+++ b/app/config/production/app.example.php
@@ -0,0 +1,45 @@
+ false,
+
+ /*
+ |--------------------------------------------------------------------------
+ | Application URL
+ |--------------------------------------------------------------------------
+ |
+ | This URL is used by the console to properly generate URLs when using
+ | the Artisan command line tool. You should set this to the root of
+ | your application so that it is used when running Artisan tasks.
+ |
+ */
+
+ 'url' => 'http://www.yourserver.com',
+
+ /*
+ |--------------------------------------------------------------------------
+ | Encryption Key
+ |--------------------------------------------------------------------------
+ |
+ | This key is used by the Illuminate encrypter service and should be set
+ | to a random, 32 character string, otherwise these encrypted strings
+ | will not be safe. Please do this before deploying an application!
+ |
+ | Run a php artisand key:generate --env=staging to create a random one
+ */
+
+ 'key' => 'Change_this_key_or_snipe_will_get_ya',
+
+);
diff --git a/app/config/production/database.example.php b/app/config/production/database.example.php
new file mode 100755
index 000000000000..31db93b9de27
--- /dev/null
+++ b/app/config/production/database.example.php
@@ -0,0 +1,124 @@
+ PDO::FETCH_CLASS,
+
+ /*
+ |--------------------------------------------------------------------------
+ | Default Database Connection Name
+ |--------------------------------------------------------------------------
+ |
+ | Here you may specify which of the database connections below you wish
+ | to use as your default connection for all database work. Of course
+ | you may use many connections at once using the Database library.
+ |
+ */
+
+ 'default' => 'mysql',
+
+ /*
+ |--------------------------------------------------------------------------
+ | Database Connections
+ |--------------------------------------------------------------------------
+ |
+ | Here are each of the database connections setup for your application.
+ | Of course, examples of configuring each database platform that is
+ | supported by Laravel is shown below to make development simple.
+ |
+ |
+ | All database work in Laravel is done through the PHP PDO facilities
+ | so make sure you have the driver for your particular database of
+ | choice installed on your machine before you begin development.
+ |
+ */
+
+ 'connections' => array(
+
+ 'sqlite' => array(
+ 'driver' => 'sqlite',
+ 'database' => __DIR__.'/../database/production.sqlite',
+ 'prefix' => '',
+ ),
+
+ 'mysql' => array(
+ 'driver' => 'mysql',
+ 'host' => 'localhost',
+ 'database' => 'snipeit_laravel',
+ 'username' => 'snipeit_laravel',
+ 'password' => '',
+ 'charset' => 'utf8',
+ 'collation' => 'utf8_unicode_ci',
+ 'prefix' => '',
+ ),
+
+ 'pgsql' => array(
+ 'driver' => 'pgsql',
+ 'host' => 'localhost',
+ 'database' => 'database',
+ 'username' => 'root',
+ 'password' => '',
+ 'charset' => 'utf8',
+ 'prefix' => '',
+ 'schema' => 'public',
+ ),
+
+ 'sqlsrv' => array(
+ 'driver' => 'sqlsrv',
+ 'host' => 'localhost',
+ 'database' => 'database',
+ 'username' => 'root',
+ 'password' => '',
+ 'prefix' => '',
+ ),
+
+ ),
+
+ /*
+ |--------------------------------------------------------------------------
+ | Migration Repository Table
+ |--------------------------------------------------------------------------
+ |
+ | This table keeps track of all the migrations that have already run for
+ | your application. Using this information, we can determine which of
+ | the migrations on disk have not actually be run in the databases.
+ |
+ */
+
+ 'migrations' => 'migrations',
+
+ /*
+ |--------------------------------------------------------------------------
+ | Redis Databases
+ |--------------------------------------------------------------------------
+ |
+ | Redis is an open source, fast, and advanced key-value store that also
+ | provides a richer set of commands than a typical key-value systems
+ | such as APC or Memcached. Laravel makes it easy to dig right in.
+ |
+ */
+
+ 'redis' => array(
+
+ 'cluster' => true,
+
+ 'default' => array(
+ 'host' => '127.0.0.1',
+ 'port' => 6379,
+ 'database' => 0,
+ ),
+
+ ),
+
+);
diff --git a/app/config/production/mail.example.php b/app/config/production/mail.example.php
new file mode 100755
index 000000000000..a7151a067406
--- /dev/null
+++ b/app/config/production/mail.example.php
@@ -0,0 +1,124 @@
+ 'smtp',
+
+ /*
+ |--------------------------------------------------------------------------
+ | SMTP Host Address
+ |--------------------------------------------------------------------------
+ |
+ | Here you may provide the host address of the SMTP server used by your
+ | applications. A default option is provided that is compatible with
+ | the Postmark mail service, which will provide reliable delivery.
+ |
+ */
+
+ 'host' => 'smtp.mailgun.org',
+
+ /*
+ |--------------------------------------------------------------------------
+ | SMTP Host Port
+ |--------------------------------------------------------------------------
+ |
+ | This is the SMTP port used by your application to delivery e-mails to
+ | users of your application. Like the host we have set this value to
+ | stay compatible with the Postmark e-mail application by default.
+ |
+ */
+
+ 'port' => 587,
+
+ /*
+ |--------------------------------------------------------------------------
+ | Global "From" Address
+ |--------------------------------------------------------------------------
+ |
+ | You may wish for all e-mails sent by your application to be sent from
+ | the same address. Here, you may specify a name and address that is
+ | used globally for all e-mails that are sent by your application.
+ |
+ */
+
+ 'from' => array('address' => null, 'name' => null),
+
+ /*
+ |--------------------------------------------------------------------------
+ | E-Mail Encryption Protocol
+ |--------------------------------------------------------------------------
+ |
+ | Here you may specify the encryption protocol that should be used when
+ | the application send e-mail messages. A sensible default using the
+ | transport layer security protocol should provide great security.
+ |
+ */
+
+ 'encryption' => 'tls',
+
+ /*
+ |--------------------------------------------------------------------------
+ | SMTP Server Username
+ |--------------------------------------------------------------------------
+ |
+ | If your SMTP server requires a username for authentication, you should
+ | set it here. This will get used to authenticate with your server on
+ | connection. You may also set the "password" value below this one.
+ |
+ */
+
+ 'username' => null,
+
+ /*
+ |--------------------------------------------------------------------------
+ | SMTP Server Password
+ |--------------------------------------------------------------------------
+ |
+ | Here you may set the password required by your SMTP server to send out
+ | messages from your application. This will be given to the server on
+ | connection so that the application will be able to send messages.
+ |
+ */
+
+ 'password' => null,
+
+ /*
+ |--------------------------------------------------------------------------
+ | Sendmail System Path
+ |--------------------------------------------------------------------------
+ |
+ | When using the "sendmail" driver to send e-mails, we will need to know
+ | the path to where Sendmail lives on this server. A default path has
+ | been provided here, which will work well on most of your systems.
+ |
+ */
+
+ 'sendmail' => '/usr/sbin/sendmail -bs',
+
+ /*
+ |--------------------------------------------------------------------------
+ | Mail "Pretend"
+ |--------------------------------------------------------------------------
+ |
+ | When this option is enabled, e-mail will not actually be sent over the
+ | web and will instead be written to your application's logs files so
+ | you may inspect the message. This is great for local development.
+ |
+ */
+
+ 'pretend' => false,
+
+);
\ No newline at end of file
diff --git a/app/config/staging/.gitignore b/app/config/staging/.gitignore
new file mode 100644
index 000000000000..3fbd46353dac
--- /dev/null
+++ b/app/config/staging/.gitignore
@@ -0,0 +1,3 @@
+app.php
+mail.php
+database.php
diff --git a/app/config/staging/app.example.php b/app/config/staging/app.example.php
new file mode 100644
index 000000000000..44544721d0ec
--- /dev/null
+++ b/app/config/staging/app.example.php
@@ -0,0 +1,45 @@
+ true,
+
+ /*
+ |--------------------------------------------------------------------------
+ | Application URL
+ |--------------------------------------------------------------------------
+ |
+ | This URL is used by the console to properly generate URLs when using
+ | the Artisan command line tool. You should set this to the root of
+ | your application so that it is used when running Artisan tasks.
+ |
+ */
+
+ 'url' => 'http://staging.yourserver.com',
+
+ /*
+ |--------------------------------------------------------------------------
+ | Encryption Key
+ |--------------------------------------------------------------------------
+ |
+ | This key is used by the Illuminate encrypter service and should be set
+ | to a random, 32 character string, otherwise these encrypted strings
+ | will not be safe. Please do this before deploying an application!
+ |
+ | Run a php artisand key:generate --env=staging to create a random one
+ */
+
+ 'key' => 'Change_this_key_or_snipe_will_get_ya',
+
+);
diff --git a/app/config/staging/database.example.php b/app/config/staging/database.example.php
new file mode 100755
index 000000000000..31db93b9de27
--- /dev/null
+++ b/app/config/staging/database.example.php
@@ -0,0 +1,124 @@
+ PDO::FETCH_CLASS,
+
+ /*
+ |--------------------------------------------------------------------------
+ | Default Database Connection Name
+ |--------------------------------------------------------------------------
+ |
+ | Here you may specify which of the database connections below you wish
+ | to use as your default connection for all database work. Of course
+ | you may use many connections at once using the Database library.
+ |
+ */
+
+ 'default' => 'mysql',
+
+ /*
+ |--------------------------------------------------------------------------
+ | Database Connections
+ |--------------------------------------------------------------------------
+ |
+ | Here are each of the database connections setup for your application.
+ | Of course, examples of configuring each database platform that is
+ | supported by Laravel is shown below to make development simple.
+ |
+ |
+ | All database work in Laravel is done through the PHP PDO facilities
+ | so make sure you have the driver for your particular database of
+ | choice installed on your machine before you begin development.
+ |
+ */
+
+ 'connections' => array(
+
+ 'sqlite' => array(
+ 'driver' => 'sqlite',
+ 'database' => __DIR__.'/../database/production.sqlite',
+ 'prefix' => '',
+ ),
+
+ 'mysql' => array(
+ 'driver' => 'mysql',
+ 'host' => 'localhost',
+ 'database' => 'snipeit_laravel',
+ 'username' => 'snipeit_laravel',
+ 'password' => '',
+ 'charset' => 'utf8',
+ 'collation' => 'utf8_unicode_ci',
+ 'prefix' => '',
+ ),
+
+ 'pgsql' => array(
+ 'driver' => 'pgsql',
+ 'host' => 'localhost',
+ 'database' => 'database',
+ 'username' => 'root',
+ 'password' => '',
+ 'charset' => 'utf8',
+ 'prefix' => '',
+ 'schema' => 'public',
+ ),
+
+ 'sqlsrv' => array(
+ 'driver' => 'sqlsrv',
+ 'host' => 'localhost',
+ 'database' => 'database',
+ 'username' => 'root',
+ 'password' => '',
+ 'prefix' => '',
+ ),
+
+ ),
+
+ /*
+ |--------------------------------------------------------------------------
+ | Migration Repository Table
+ |--------------------------------------------------------------------------
+ |
+ | This table keeps track of all the migrations that have already run for
+ | your application. Using this information, we can determine which of
+ | the migrations on disk have not actually be run in the databases.
+ |
+ */
+
+ 'migrations' => 'migrations',
+
+ /*
+ |--------------------------------------------------------------------------
+ | Redis Databases
+ |--------------------------------------------------------------------------
+ |
+ | Redis is an open source, fast, and advanced key-value store that also
+ | provides a richer set of commands than a typical key-value systems
+ | such as APC or Memcached. Laravel makes it easy to dig right in.
+ |
+ */
+
+ 'redis' => array(
+
+ 'cluster' => true,
+
+ 'default' => array(
+ 'host' => '127.0.0.1',
+ 'port' => 6379,
+ 'database' => 0,
+ ),
+
+ ),
+
+);
diff --git a/app/config/staging/mail.example.php b/app/config/staging/mail.example.php
new file mode 100755
index 000000000000..a7151a067406
--- /dev/null
+++ b/app/config/staging/mail.example.php
@@ -0,0 +1,124 @@
+ 'smtp',
+
+ /*
+ |--------------------------------------------------------------------------
+ | SMTP Host Address
+ |--------------------------------------------------------------------------
+ |
+ | Here you may provide the host address of the SMTP server used by your
+ | applications. A default option is provided that is compatible with
+ | the Postmark mail service, which will provide reliable delivery.
+ |
+ */
+
+ 'host' => 'smtp.mailgun.org',
+
+ /*
+ |--------------------------------------------------------------------------
+ | SMTP Host Port
+ |--------------------------------------------------------------------------
+ |
+ | This is the SMTP port used by your application to delivery e-mails to
+ | users of your application. Like the host we have set this value to
+ | stay compatible with the Postmark e-mail application by default.
+ |
+ */
+
+ 'port' => 587,
+
+ /*
+ |--------------------------------------------------------------------------
+ | Global "From" Address
+ |--------------------------------------------------------------------------
+ |
+ | You may wish for all e-mails sent by your application to be sent from
+ | the same address. Here, you may specify a name and address that is
+ | used globally for all e-mails that are sent by your application.
+ |
+ */
+
+ 'from' => array('address' => null, 'name' => null),
+
+ /*
+ |--------------------------------------------------------------------------
+ | E-Mail Encryption Protocol
+ |--------------------------------------------------------------------------
+ |
+ | Here you may specify the encryption protocol that should be used when
+ | the application send e-mail messages. A sensible default using the
+ | transport layer security protocol should provide great security.
+ |
+ */
+
+ 'encryption' => 'tls',
+
+ /*
+ |--------------------------------------------------------------------------
+ | SMTP Server Username
+ |--------------------------------------------------------------------------
+ |
+ | If your SMTP server requires a username for authentication, you should
+ | set it here. This will get used to authenticate with your server on
+ | connection. You may also set the "password" value below this one.
+ |
+ */
+
+ 'username' => null,
+
+ /*
+ |--------------------------------------------------------------------------
+ | SMTP Server Password
+ |--------------------------------------------------------------------------
+ |
+ | Here you may set the password required by your SMTP server to send out
+ | messages from your application. This will be given to the server on
+ | connection so that the application will be able to send messages.
+ |
+ */
+
+ 'password' => null,
+
+ /*
+ |--------------------------------------------------------------------------
+ | Sendmail System Path
+ |--------------------------------------------------------------------------
+ |
+ | When using the "sendmail" driver to send e-mails, we will need to know
+ | the path to where Sendmail lives on this server. A default path has
+ | been provided here, which will work well on most of your systems.
+ |
+ */
+
+ 'sendmail' => '/usr/sbin/sendmail -bs',
+
+ /*
+ |--------------------------------------------------------------------------
+ | Mail "Pretend"
+ |--------------------------------------------------------------------------
+ |
+ | When this option is enabled, e-mail will not actually be sent over the
+ | web and will instead be written to your application's logs files so
+ | you may inspect the message. This is great for local development.
+ |
+ */
+
+ 'pretend' => false,
+
+);
\ No newline at end of file
diff --git a/bootstrap/start.php b/bootstrap/start.php
index 9848f9bc9e99..d8b2b120c6b0 100755
--- a/bootstrap/start.php
+++ b/bootstrap/start.php
@@ -28,8 +28,9 @@
$env = $app->detectEnvironment(array(
- 'local' => array('your-machine-name'),
-
+ 'local' => array('http://*.dev', 'http://*.local', '*.local*', '127.0.0.1', 'localhost*'),
+ 'staging' => array('http://staging.yourserver.com'),
+ 'production' => array('http://www.yourserver.com')
));
/*
diff --git a/composer.json b/composer.json
index 0150f72ce74d..3147feef1db7 100755
--- a/composer.json
+++ b/composer.json
@@ -20,6 +20,10 @@
]
},
"scripts": {
+ "post-install-cmd": [
+ "php artisan migrate --package=cartalyst/sentry"
+ "php artisan migrate"
+ ]
"pre-update-cmd": [
"php artisan clear-compiled"
],