{"id":15439044,"url":"https://github.com/alecbcs/fly-nextcloud","last_synced_at":"2025-10-15T22:51:01.523Z","repository":{"id":43133132,"uuid":"468888351","full_name":"alecbcs/fly-nextcloud","owner":"alecbcs","description":"A Nextcloud Deployment \u0026 Management System for Fly.io","archived":false,"fork":false,"pushed_at":"2023-05-15T14:14:35.000Z","size":79,"stargazers_count":31,"open_issues_count":0,"forks_count":22,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-19T20:17:25.763Z","etag":null,"topics":["fly","nextcloud","s3"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alecbcs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-03-11T20:17:55.000Z","updated_at":"2025-04-17T18:23:00.000Z","dependencies_parsed_at":"2025-04-16T12:48:22.933Z","dependency_job_id":"3e53068e-94c7-4cd5-a1b6-c46f959e2420","html_url":"https://github.com/alecbcs/fly-nextcloud","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alecbcs/fly-nextcloud","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecbcs%2Ffly-nextcloud","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecbcs%2Ffly-nextcloud/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecbcs%2Ffly-nextcloud/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecbcs%2Ffly-nextcloud/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alecbcs","download_url":"https://codeload.github.com/alecbcs/fly-nextcloud/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alecbcs%2Ffly-nextcloud/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279124093,"owners_count":26108835,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-15T02:00:07.814Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fly","nextcloud","s3"],"created_at":"2024-10-01T19:02:04.634Z","updated_at":"2025-10-15T22:51:01.494Z","avatar_url":"https://github.com/alecbcs.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fly-nextcloud\nA Nextcloud Deployment \u0026amp; Management System for Fly.io\n\n## Table of Contents\n\n- [Introduction](#introduction)\n- [Cluster Pricing](#cluster-pricing)\n- [Getting Started](#getting-started)\n  - [Making an Account on Fly.io](#making-an-account-on-fly-io)\n  - [Create a S3 Storage Bucket](#create-a-s3-storage-bucket)\n  - [Naming Your Nextcloud Cluster](#naming-your-nextcloud-cluster)\n  - [Deploying Nextcloud](#deploying-nextcloud)\n    - [GitHub Workflow (Recommended)](#github-workflow-recommended)\n    - [Manual](#manual)\n- [Nextcloud Suggestions](#nextcloud-suggestions)\n- [Maintenance Tasks](#maintenance-tasks)\n- [License](#license)\n\n## Introduction\nSimilar to a 1-click app from DigitalOcean or Linode this project aims to provide a simple way to install a [Nextcloud](https://github.com/nextcloud) cluster on [Fly.io](https://fly.io) using an S3 bucket as primary storage. The idea is that you should be able to fork this repository, add your own credentials as repository secrets, and then start a GitHub Action to build your Nextcloud cluster.\n\nThis project aims to tackle the task of periodically updating and maintaining your Nextcloud cluster through the use of GitHub actions. Unlike traditional 1-click apps, a maintenance job will spin up daily to check the size of your Postgres database and dynamically resize the supporting Fly volume if you are running out of space. Additionally, the (re)deployment action will run once a week to check for updates and apply them to your cluster.\n\n## Cluster Pricing\n#### Free Allowances\nCheckout the details of Fly's free resources [here](https://fly.io/docs/about/pricing/#free-allowances).\n\n#### Fly.io Virtual Machines\nRunning this workflow will generate a Nextcloud cluster by spinning up the following virtual machines on fly,\n\n|            |    CPU    |   RAM   |  Price  |\n|------------|-----------|---------|---------|\n| Postgres   | 1 shared  | 256MB   | $1.94   |\n| Redis      | 1 shared  | 256MB   | $1.94   |\n| Nextcloud  | 1 shared  |   1GB   | $5.70   |\n\nTotal Cost: `$9.58/Month`\n\nTotal Cost (with Free Allowences): `$3.76/Month`\n\n#### S3 Storage Providers\nTo avoid any possible conflicts of interest or sense of bias, I won't recommend a specific cloud storage provider for you to use. I've listed a couple of possible options below that I've used in the past, but you can use any S3 compatible storage system.\n\n|                                                               |                Storage              |      Egress     |  Monthly Minimum  |\n|---------------------------------------------------------------|-------------------------------------|-----------------|-------------------|\n| [Backblaze](https://www.backblaze.com/b2/cloud-storage.html)  | $0.005 GB/Month ($5.00/TB/Month)    | $0.01 GB/Month  | $0.00             |\n| [Cloudflare](https://www.cloudflare.com/r2-storage/)          | $0.015 GB/Month ($15.00/TB/Month)   | $0.00 GB/Month  | $0.00             |\n| [DigitalOcean](https://www.digitalocean.com/products/spaces)  | $0.020 GB/Month ($20.00/TB/Month)   | $0.01 GB/Month  | $5.00             |\n| [Linode](https://www.linode.com/products/object-storage/)     | $0.020 GB/Month ($20.00/TB/Month)   | $0.01 GB/Month  | $5.00             |\n###### * This pricing table does not include API usage fees.\n###### ** Wasabi S3 Storage is not listed since they force customers to store data all data for a minimum of 90 days.\n\n## Getting Started\n### Making an Account on Fly.io\nIf you haven't already, you'll need to sign up for Fly and install the `flyctl` application by heading over to [fly.io](https://fly.io/docs/hands-on/start/). After you've completed Step 3 you may come back to this guide. To see your `FLY_API_TOKEN` run the following command and save the output for later.\n\n```\nflyctl auth token\n```\n\n### Create a S3 Storage Bucket\nCreate an S3 bucket and key on your chosen cloud provider then save the `ACCESS_KEY_ID` and `SECRET_KEY` of your newly created key for later.\n\n### Naming Your Nextcloud Cluster\nBefore you can deploy your Nextcloud cluster we'll need to give it a name and check if that name is available on Fly. Unless you've got a custom domain, this name is how you'll access your Nextcloud cluster from the web. (`YOURNAME.fly.dev`)\n\n### Picking a `FLY_APP_REGION`\nBefore you deploy your Nextcloud cluster we'll also need to decide which fly data center to launch it in. To explore the available fly regions run,\n```\nflyctl platform regions\n```\nremember the three letter acronym of the region closest to you.\n\nTo check if your name is available run,\n```\nhost YOURNAME.fly.dev\n```\n\nand if you get back a response that looks like,\n```\nHost YOURNAME.fly.dev not found: 3(NXDOMAIN)\n```\n\nthat means your chosen name is available.\n\n### Deploying Nextcloud\n#### GitHub Workflow (Recommended)\n1. Fork this repository (click fork in the top right)\n2. Go to your new repository's settings \u003e\u003e secrets \u003e\u003e action's secrets\n3. Create new secrets for each of the following,\n   ```\n   FLY_API_TOKEN\n   FLY_ORG\n   FLY_APP_NAME\n   FLY_APP_REGION\n   FLY_DB_PASSWORD\n   FLY_REDIS_PASSWORD\n   S3_BUCKET_NAME\n   S3_ENDPOINT\n   S3_ACCESS_KEY\n   S3_SECRET_KEY\n   ```\n4. Now go to your repositories \"Actions\" tab. You should see two actions, (re)deploy \u0026 maintenance.\n5. Click on (re)deploy \u0026 enable the workflow for your fork.\n6. Now manually run your workflow by clicking \"Run Workflow\" on the right of the screen. Your workflow should now begin and automatically deploy your Nextcloud cluster.\n7. To automatically resize your postgres DB when needed, go back to the \"Actions\" tab and this time enable the \"Maintenance\" workflow.\n8. Once your deployment workflow is done you should be good to login to your new Nextcloud instance at `YOURNAME.fly.dev`.\n\n#### Manual\n1. Clone this repository\n2. Open vars.sh and add your custom values to,\n   ```\n   export FLY_ORG=\n   export FLY_APP_NAME=\n   export FLY_APP_REGION=\n   export FLY_DB_PASSWORD=\n   export FLY_REDIS_PASSWORD=\n   export S3_BUCkET_NAME=\n   export S3_ENDPOINT=\n   export S3_ACCESS_KEY=\n   export S3_SECRET_KEY=\n   ```\n3. Run `chmod a+x ./deploy.sh`\n4. Run `./deploy.sh`\n5. Run `flyctl open -a YOUR_FLY_APP_NAME`\n\n## Nextcloud Suggestions\nHere are a couple of my personal suggestions for your new Nextcloud instance.\n\nIf you've never used Fly's ssh functionality before you should first type,\n```\nflyctl ssh issue\n```\non your local computer.\n\nThen after logging into your Nextcloud web interface for the first time, ssh into your cluster by running,\n```\nflyctl ssh console -a YOUR_NAME\n```\n\n#### Setup OCC Alias\n```\nalias occ='sudo -u www-data PHP_MEMORY_LIMIT=512M php /var/www/html/occ'\n```\n\n#### Limit Tashbin Size to 10GB\n```\nocc trashbin:size 10GB\n```\n\n#### Improve Image Thumbnail Generation\n```\nocc config:app:set previewgenerator squareSizes --value=\"32 256\"\nocc config:app:set previewgenerator widthSizes  --value=\"256 384\"\nocc config:app:set previewgenerator heightSizes --value=\"256\"\nocc config:system:set preview_max_x --value 2048\nocc config:system:set preview_max_y --value 2048\nocc config:system:set jpeg_quality --value 60\nocc config:app:set preview jpeg_quality --value=\"60\"\n```\n\n### Generate Image Thumbnails When System Idle Instead of On Demand\nClick on the circle at the very top right of the web interface \u003e Click on Apps \n\u003e Search (Magnifying Glass) \"Preview Generator\" \u003e Click on \"Download and Enable\"\n\u003e Enter Your Password if Needed \u003e Done!\n\n#### Fix Nextcloud Desktop \u0026 Mobile Login Auth Errors\n```\nocc config:system:set overwritehost --value=\"YOURNAME.fly.dev\"\nocc config:system:set overwriteprotocol --value=\"https\"\n```\n\n#### Increase Log Level to 3 (Errors Only) to Improve Page Load Speed\n```\nocc config:system:set loglevel --value 3\n```\n\n#### Disable Rich Workspaces to Reduce Interface Clutter\n```\nocc config:app:set text workspace_available --value 0\n```\n\n#### Exit\nTo leave your ssh session type,\n```\nexit\n```\n\n## Maintenance Tasks\n### Automatically Scaling Postgres's Volume\n\nOver time, you may need to increase the size of the volume attached to your Postgres instance as your database grows.\n\nIf you deployed your Nextcloud cluster using the GitHub Workflow method, you shouldn't need to worry about this, as we automatically run a workflow every day to check if your database is within 90% of your volume size. If your database is greater than 90% of your volume size, the workflow will dynamically increase the size of your volume.\n\nIf you deployed your Nextcloud cluster manually, you should set up a way to periodically run the `maintenance.sh` script to dynamically resize the volume attached to your Postgres instance.\n\n### Cleaning up Incomplete Uploads from S3\nOne of the long-standing complaints in the community about using a Nextcloud cluster with an S3 backend is that Nextcloud doesn't cleanup failed uploads automatically. This means that your S3 bucket continues to grow in size with inaccessible failed uploads even if the size of your Nextcloud files stays the same. To prevent this from happening, this Workflow as well as maintenance.sh scrape for incomplete uploads in your S3 bucket and delete those older than 1 week.\n\n## Disclaimer\n\nDo not enable Nextcloud server-side encryption with this setup as it will lead to data corruption. See nextcloud/server#22077 for more details.\n\n## License\n\nCopyright 2022 Alec Scott hi@alecbcs.com\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falecbcs%2Ffly-nextcloud","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falecbcs%2Ffly-nextcloud","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falecbcs%2Ffly-nextcloud/lists"}