Difference between revisions of "NextCloud: Install: Heroku"

From Gratiel's Wiki
(→‎Heroku: - Syntax Mistake)
(→‎Heroku: - Return response)
Line 208: Line 208:
 
Restart  
 
Restart  
 
  heroku ps:restart --app infinite-lowlands-38883
 
  heroku ps:restart --app infinite-lowlands-38883
 +
Restarting dynos on <span style="color:#8787D7">⬢ infinite-lowlands-38883</span>... done
  
 
* [https://devcenter.heroku.com/articles/dynos#cli-commands-for-dyno-management CLI commands for dyno management]
 
* [https://devcenter.heroku.com/articles/dynos#cli-commands-for-dyno-management CLI commands for dyno management]

Revision as of 18:53, 18 June 2019

Preface

  • Ephemeral Drive
    • Locked Code
    • S3
  • Databases
    • PostgreSQL

Prerequisites

You are going to need the following Services and Software before getting started with your NextCloud installation on Heroku. 

Be sure you have accounts setup for the following Services listed below. 
Also, be sure you have installed the following Software listed below.

Services

Software

sudo snap install heroku --classic

Setup Heroku

Login to Heroku CLI (Ubuntu)

heroku login

Create App

  • This needs to be created after git. IT will automatically create the remote links needed in Git
heroku create

Heroku will return a sample app and location. Use this for the rest of the install.

Creating app... done, ⬢ infinite-lowlands-38883
https://infinite-lowlands-38883.herokuapp.com/ | https://git.heroku.com/infinite-lowlands-38883.git

Heroku Add-ons

  • Heroku Postgres

Install NextCloud - Phase 1

Download & Extract NextCloud

Download the version of nextcloud

wget https://download.nextcloud.com/server/releases/nextcloud-15.0.8.zip

Unzip nextcloud-x.x.x.zip to it's own folder

unzip nextcloud-15.0.8.zip

Create a new folder `nextcloud-x.x.x`

mkdir nextcloud-15.0.8

Move folder `nextcloud` into `nextcloud-x.x.x` and label it `server`

mv nextcloud nextcloud-15.0.8/server

Initialize Git

cd nextcloud-15.0.8
git init
git config user.name "Eric Wanchic"
git config user.email "ewanchic@elifestream.com"
cat > .gitignore

Copy & Paste the following to the file:

/vendor/
.env

Ctrl+D

git add .
git commit -m "Initial NextCloud 15.0.8"

Setup Composer

cat > composer.json

Copy & Paste the following to the file:

{
  "require" : {
    "php": "7.2.19",
    "ext-mbstring": "*",
    "ext-gd": "*",
    "ext-intl" : "*",
    "ext-imagick": "*",
    "ext-memcached": "*",
    "ext-pcntl": "*"
  },
  "require-dev": {
    "php": "7.2.19",
    "ext-mbstring": "*",
    "ext-gd": "*",
    "ext-intl" : "*",
    "ext-imagick": "*",
    "ext-memcached": "*",
    "ext-pcntl": "*"
  }
}

Ctrl+D to exit

composer update

Commit code to repo

git add .
git commit -m "Adding composer files."

Setup PHP FPM file

cat > fpm_custom.conf

Copy & Paste the following to the file:

php_value[upload_max_filesize] = 300M
php_value[post_max_size] = 200M
php_value[memory_limit] = 128M
php_value[mbstring.func_overload] = 0
php_value[default_charset] = 'UTF-8'
php_value[output_buffering] = 0

php_value[apc.enable_cli] = 1

Ctrl+D to exit

Commit code to repo

git add .
git commit -m "Adding custom php fpm."


Setup Procfile

cat > Procfile

Copy & Paste the following to the file:

web: vendor/bin/heroku-php-apache2 -F fpm_custom.conf server/

Ctrl+D to exit

You might be tempted to use nginx instead of apache. In this instance, stay with apache.

Commit code to repo

git add .
git commit -m "Adding Procfile."

Install PostgreSQL Add on

heroku addons:create heroku-postgresql:hobby-dev --app infinite-lowlands-38883

DB is created. You'll have to log in to get further details.

Creating heroku-postgresql:hobby-dev on ⬢ infinite-lowlands-38883... free
Database has been created and is available
 ! This database is empty. If upgrading, you can transfer
 ! data from another database with pg:copy
Created postgresql-crystalline-20674 as DATABASE_URL
Use heroku addons:docs heroku-postgresql to view documentation

Install NextCloud - Phase 2

Pushing Code to Heroku

git push heroku master

Do not setup the app just yet.

SSH into App

Need to SSH into Heroku after app starts.

heroku ps:exec --app infinite-lowlands-38883
Running this command for the first time requires a dyno restart.
Do you want to continue? [y/n]: y
Initializing feature... done
Restarting dynos... done
Waiting for web.1 to start... done
Establishing credentials... done
Connecting to web.1 on ⬢ infinite-lowlands-38883... 
~ $

Get the current Config

cd server/config
cat config.php
<?php
$CONFIG = array (
  'instanceid' => 'oczm2c0yitlu',
);

Create a config

cat > config.php
<?php
$CONFIG = array (
  'instanceid' => 'oczm2c0yitlu',
);

Ctrl+D

git add .
git commit -m "Initializing config.php"

Install NextCloud - Phase 3

Patches

Heroku

More than one MPM loaded.

Heroku - AH00534: apache2: Configuration error: More than one MPM loaded.

To fix this, you need to execute this patch to heroku:

heroku labs:enable --app infinite-lowlands-38883 runtime-new-layer-extract
Enabling runtime-new-layer-extract for infinite-lowlands-38883... done

NextCloud

S3 Issues

Commands

Heroku

Restart

heroku ps:restart --app infinite-lowlands-38883
Restarting dynos on ⬢ infinite-lowlands-38883... done

NextCloud

Backup

Restore

Upgrading

References

Return