Skip to content

A free open source IT asset/license management system

Add base heroku changes

Jason Spriggsb51392e4a58f
diff --git a/Procfile b/Procfile
new file mode 100644
index 0000000000..80269037c6
--- /dev/null
+++ b/Procfile
@@ -0,0 +1 @@
+web: php heroku/startup.php && heroku-php-apache2 public/
\ No newline at end of file
diff --git a/app.json b/app.json
new file mode 100644
index 0000000000..2e2dab35dc
--- /dev/null
+++ b/app.json
@@ -0,0 +1,145 @@
+{
+ "name": "Snipe-IT",
+ "description": "Open source asset management.",
+ "keywords": [
+ "asset management",
+ "it asset"
+ ],
+ "website": "https://snipeitapp.com/",
+ "repository": "https://github.com/snipe/snipe-it",
+ "logo": "https://snipeitapp.com/img/logos/snipe-it-logo-xs.png",
+ "success_url": "/setup",
+ "env": {
+ "APP_ENV": {
+ "description": "Symfony environment mode.",
+ "value": "production"
+ },
+ "APP_KEY": {
+ "description": "A secret key for verifying the integrity of signed cookies. (https://coderstoolbox.online/toolbox/generate-symfony-secret)",
+ "value": ""
+ },
+ "APP_URL": {
+ "description": "URL where your Snipe-IT install will be available at.",
+ "value": "https://your-app-name.herokuapp.com"
+ },
+ "APP_TIMEZONE": {
+ "description": "Which timezone do you want to use for your install? (http://php.net/manual/en/timezones.php)",
+ "value": "UTC"
+ },
+ "APP_LOCALE": {
+ "description": "Which language do you want to use for your install? (https://snipe-it.readme.io/docs/configuration#setting-a-language)",
+ "value": "en"
+ },
+ "MAIL_DRIVER": {
+ "description": "",
+ "value": "smtp"
+ },
+ "MAIL_HOST": {
+ "description": "",
+ "value": "smtp.your.domain.name"
+ },
+ "MAIL_PORT": {
+ "description": "",
+ "value": "25"
+ },
+ "MAIL_USERNAME": {
+ "description": "",
+ "value": "YOURUSERNAME"
+ },
+ "MAIL_PASSWORD": {
+ "description": "",
+ "value": "YOURPASSWORD"
+ },
+ "MAIL_ENCRYPTION": {
+ "description": "",
+ "value": "null"
+ },
+ "MAIL_FROM_ADDR": {
+ "description": "",
+ "value": "[email protected]"
+ },
+ "MAIL_FROM_NAME": {
+ "description": "",
+ "value": "Snipe-IT"
+ },
+ "MAIL_REPLYTO_ADDR": {
+ "description": "",
+ "value": "[email protected]"
+ },
+ "MAIL_REPLYTO_NAME": {
+ "description": "",
+ "value": "Snipe-IT"
+ },
+ "MAIL_AUTO_EMBED": {
+ "description": "",
+ "value": "true"
+ },
+ "MAIL_AUTO_EMBED_METHOD": {
+ "description": "",
+ "value": "base64"
+ },
+ "SESSION_LIFETIME": {
+ "description": "",
+ "value": "12000"
+ },
+ "EXPIRE_ON_CLOSE": {
+ "description": "",
+ "value": "false"
+ },
+ "ENCRYPT": {
+ "description": "",
+ "value": "false"
+ },
+ "COOKIE_NAME": {
+ "description": "",
+ "value": "snipeit_session"
+ },
+ "COOKIE_DOMAIN": {
+ "description": "",
+ "value": "your-app-name.herokuapp.com"
+ },
+ "SECURE_COOKIES": {
+ "description": "",
+ "value": "false"
+ },
+ "LOGIN_MAX_ATTEMPTS": {
+ "description": "",
+ "value": "5"
+ },
+ "LOGIN_LOCKOUT_DURATION": {
+ "description": "",
+ "value": "60"
+ },
+ "APP_LOG": {
+ "description": "Driver to send logs to. (errorlog for stderr)",
+ "value": "errorlog"
+ },
+ "ALLOW_IFRAMING": {
+ "description": "",
+ "value": "false"
+ },
+ "GOOGLE_MAPS_API": {
+ "description": "",
+ "value": ""
+ },
+ "BACKUP_ENV": {
+ "description": "",
+ "value": "true"
+ },
+ "ENABLE_HSTS": {
+ "description": "",
+ "value": "false"
+ }
+ },
+ "formation": {
+ "web": {
+ "quantity": 1,
+ "size": "free"
+ }
+ },
+ "image": "heroku/php",
+ "addons": [
+ "cleardb:ignite",
+ "heroku-redis:hobby-dev"
+ ]
+ }
\ No newline at end of file
diff --git a/heroku/startup.php b/heroku/startup.php
new file mode 100644
index 0000000000..336ae2b6ae
--- /dev/null
+++ b/heroku/startup.php
@@ -0,0 +1,47 @@
+<?php
+// Snipe-IT Heroku Startup Script
+
+// If DB_<value> values are set, ignore parser.
+if (getenv("DB_DATABASE") || getenv("DB_HOST") || getenv("DB_USERNAME")) {
+ echo "Database Environment variables are manually set. Ignoring add-ins.";
+} else if (getenv("CLEARDB_DATABASE_URL")) { // ClearDB Add-in
+ echo "Using ClearDB Heroku add-in." . PHP_EOL;
+ set_db(getenv('CLEARDB_DATABASE_URL'));
+} else if (getenv("JAWSDB_MARIA_URL")) { // JawsDB Maria Add-in
+ echo "Using JawsDB Maria Heroku add-in." . PHP_EOL;
+ set_db(getenv("JAWSDB_MARIA_URL"));
+} else if (getenv("JAWSDB_MYSQL_URL")) { // JawsDB MySQL Add-in
+ echo "Using JawsDB MySQL Heroku add-in." . PHP_EOL;
+ set_db(getenv("JAWSDB_MYSQL_URL"));
+}
+
+function set_db($uri) {
+ file_put_contents('./.env', 'DB_HOST=' . parse_url($uri, PHP_URL_HOST). PHP_EOL, FILE_APPEND);
+ file_put_contents('./.env', 'DB_USERNAME=' . parse_url($uri, PHP_URL_USER). PHP_EOL, FILE_APPEND);
+ file_put_contents('./.env', 'DB_PASSWORD=' . parse_url($uri, PHP_URL_PASS). PHP_EOL, FILE_APPEND);
+ file_put_contents('./.env', 'DB_DATABASE=' . ltrim(parse_url($uri, PHP_URL_PATH), '/'). PHP_EOL, FILE_APPEND);
+}
+
+// If Heroku Redis is setup, let's get it working.
+if (getenv("REDIS_URL")) { // Heroku Redis
+ echo "Setting up Heroku Redis." . PHP_EOL;
+ $url = getenv("REDIS_URL");
+ file_put_contents('./.env', 'REDIS_HOST=' . parse_url($url, PHP_URL_HOST). PHP_EOL, FILE_APPEND);
+ file_put_contents('./.env', 'REDIS_PASSWORD=' . parse_url($url, PHP_URL_PASS). PHP_EOL, FILE_APPEND);
+ file_put_contents('./.env', 'REDIS_PORT=' . parse_url($url, PHP_URL_PORT). PHP_EOL, FILE_APPEND);
+}
+
+// Set up APP_TRUSTED_PROXIES to allow for the Heroku Router
+// https://devcenter.heroku.com/articles/deploying-symfony4#trusting-the-heroku-router
+file_put_contents('./.env', 'APP_TRUSTED_PROXIES=10.0.0.0/8' . PHP_EOL, FILE_APPEND);
+
+// Set up GD
+file_put_contents('./.env', 'IMAGE_LIB=gd' . PHP_EOL, FILE_APPEND);
+
+// Set local FILESYSTEM_DISK
+file_put_contents('./.env', 'FILESYSTEM_DISK=local' . PHP_EOL, FILE_APPEND);
+
+// Set APP_CIPHER
+file_put_contents('./.env', 'APP_CIPHER=AES-256-CBC' . PHP_EOL, FILE_APPEND);
+
+?>