├── Dockerfile ├── LICENSE ├── README.md ├── app.json ├── docker-compose.yml ├── heroku-entrypoint.sh └── heroku.yml /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nextcloud 2 | COPY heroku-entrypoint.sh /heroku-entrypoint.sh 3 | ENTRYPOINT ["/heroku-entrypoint.sh"] 4 | CMD ["apachectl", "-D", "FOREGROUND"] 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Alexander Mancevice 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) 2 | 3 | # Nextcloud on Heroku 4 | 5 | Deploy your own [Nextcloud](https://nextcloud.com) instance on [Heroku](https://heroku.com). 6 | 7 | ## Docker Compose 8 | 9 | Use `docker-compose` to deploy Nextcloud locally: 10 | 11 | ```bash 12 | docker-compose up -d 13 | # Wait for MySQL/Nextcloud to start... 14 | open http://localhost:8000 15 | ``` 16 | 17 | ## Heroku 18 | 19 | Follow the instructions on Heroku's [Container Registry & Runtime](https://devcenter.heroku.com/articles/container-registry-and-runtime) for creating a new heroku app. 20 | 21 | ### MySQL Add-on 22 | 23 | Add a MySQL add-on to your app. This will contain your Nextcloud backend. 24 | 25 | JawsDB: 26 | 27 | ```bash 28 | heroku addons:create jawsdb:kitefin 29 | ``` 30 | 31 | ClearDB: 32 | 33 | ```bash 34 | heroku addons:create cleardb:ignite 35 | ``` 36 | 37 | Once the add-on is ready, take note of the connection details. 38 | 39 | ### Configuration 40 | 41 | You will need to set config variables to allow Nextcloud to connect to the MySQL backend as well as the Nextcloud administrator login info. 42 | 43 | Set the following config variables in your app: 44 | 45 | ```bash 46 | heroku config:set MYSQL_DATABASE= 47 | heroku config:set MYSQL_HOST= 48 | heroku config:set MYSQL_PASSWORD= 49 | heroku config:set MYSQL_USER= 50 | heroku config:set NEXTCLOUD_ADMIN_PASSWORD= 51 | heroku config:set NEXTCLOUD_ADMIN_USER= 52 | ``` 53 | 54 | ### Deploy 55 | 56 | Login to the Heroku container registry: 57 | 58 | ```bash 59 | heroku container:login 60 | ``` 61 | 62 | Build & push the image to your app: 63 | 64 | ```bash 65 | heroku container:push web 66 | ``` 67 | 68 | After deployment look at this issue[https://github.com/amancevice/nextcloud-heroku/issues/1] to fix Nextcloud not starting up. 69 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "name": "Nextcloud Heroku", 4 | "env": { 5 | }, 6 | "website": "", 7 | "repository": "", 8 | "stack": "container" 9 | } 10 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.3' 2 | services: 3 | nextcloud: 4 | build: . 5 | depends_on: 6 | - postgres 7 | environment: 8 | POSTGRES_DB: ${POSTGRES_DB:-nextcloud} 9 | POSTGRES_USER: ${POSTGRES_USER:-nextcloud} 10 | POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-nextcloud} 11 | POSTGRES_HOST: ${POSTGRES_HOST:-postgres} 12 | NEXTCLOUD_ADMIN_USER: ${NEXTCLOUD_ADMIN_USER:-admin} 13 | NEXTCLOUD_ADMIN_PASSWORD: ${NEXTCLOUD_ADMIN_PASSWORD:-admin} 14 | image: registry.heroku.com/smallweirdnumber-nextcloud/web 15 | ports: 16 | - 8000:80 17 | restart: always 18 | volumes: 19 | - nextcloud:/var/www/html 20 | - apps:/var/www/html/custom_apps 21 | - config:/var/www/html/config 22 | - data:/var/www/html/data 23 | - theme:/var/www/html/themes/custom 24 | postgres: 25 | environment: 26 | POSTGRES_DB: ${POSTGRES_DB:-postgres} 27 | POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres} 28 | POSTGRES_USER: ${POSTGRES_USER:-postgres} 29 | image: postgres 30 | restart: always 31 | volumes: 32 | - postgres:/var/lib/postgresql/data 33 | volumes: 34 | apps: 35 | config: 36 | data: 37 | nextcloud: 38 | postgres: 39 | theme: 40 | -------------------------------------------------------------------------------- /heroku-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #a2dismod mpm_prefork 4 | 5 | #service apache2 restart 6 | 7 | echo "Listen ${PORT:-80}" > /etc/apache2/ports.conf 8 | 9 | /entrypoint.sh "$@" 10 | -------------------------------------------------------------------------------- /heroku.yml: -------------------------------------------------------------------------------- 1 | build: 2 | docker: 3 | web: Dockerfile 4 | --------------------------------------------------------------------------------