{"id":13552750,"url":"https://github.com/openfoodfoundation/ofn-install","last_synced_at":"2025-04-04T12:07:53.892Z","repository":{"id":17187230,"uuid":"19954737","full_name":"openfoodfoundation/ofn-install","owner":"openfoodfoundation","description":"Ansible scripts for provisioning and deploying Open Food Network","archived":false,"fork":false,"pushed_at":"2024-10-29T05:12:32.000Z","size":1632,"stargazers_count":54,"open_issues_count":45,"forks_count":112,"subscribers_count":34,"default_branch":"master","last_synced_at":"2024-10-29T16:13:14.547Z","etag":null,"topics":["ansible","openfoodnetwork"],"latest_commit_sha":null,"homepage":"","language":"Jinja","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openfoodfoundation.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"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},"funding":{"github":"openfoodfoundation","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2014-05-19T19:28:44.000Z","updated_at":"2024-10-29T05:12:36.000Z","dependencies_parsed_at":"2023-12-18T15:13:46.206Z","dependency_job_id":"b34c63a1-8000-43d2-9aa9-8d282729c1c4","html_url":"https://github.com/openfoodfoundation/ofn-install","commit_stats":{"total_commits":1287,"total_committers":42,"mean_commits":"30.642857142857142","dds":0.655011655011655,"last_synced_commit":"f23019aa311249d7aad2e1d3e01e33b7ca8a1bbf"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openfoodfoundation%2Fofn-install","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openfoodfoundation%2Fofn-install/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openfoodfoundation%2Fofn-install/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openfoodfoundation%2Fofn-install/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openfoodfoundation","download_url":"https://codeload.github.com/openfoodfoundation/ofn-install/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246962571,"owners_count":20861300,"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","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":["ansible","openfoodnetwork"],"created_at":"2024-08-01T12:02:09.270Z","updated_at":"2025-04-04T12:07:53.873Z","avatar_url":"https://github.com/openfoodfoundation.png","language":"Jinja","funding_links":["https://github.com/sponsors/openfoodfoundation"],"categories":["HTML","ansible"],"sub_categories":[],"readme":"Deploying Open Food Network\n===========================\n\nThese are [Ansible](http://docs.ansible.com/ansible/) playbooks (scripts) for managing an Open Food Network app server. This is **not for your local development environment**. Head to the [OFN getting started guide](https://github.com/openfoodfoundation/openfoodnetwork/blob/master/GETTING_STARTED.md) to run the OFN locally.\n\n## Documentation\nSee the [**wiki**](https://github.com/openfoodfoundation/ofn-install/wiki) for more information, including: additional setup, configuring, provisioning and deployment.\n\nFor deploying OFN versions below `v4.x.x`, please use the `ofn-v3` branch of this repo.\n\n## Playbooks\n\nThese playbooks will install the Open Food Network app onto a server running an apt-compatible OS like Debian or Ubuntu. It has currently been tested on **Ubuntu 16.04, 18.04 and 20.04 (64 bit)** on AWS, DigitalOcean and Scaleway cloud servers.\n\nThe playbooks take information from the inventory. Make sure that your host's information is up to date before running a playbook (see `host_vars/` and [secrets](#secrets)).\n\nThese are the main playbooks (found under `playbooks/`). See inside each for more details. They can be executed together with `site.yml`:\n\n* `setup.yml` - Use a root login to ensure python is installed and create a default user (defined in inventory/group_vars/all.yml) on the server for installation (mandatory the first time you provision a server).\n* `provision.yml` - Install and configure all required software on the server (requires secrets, see below).\n* `deploy.yml` - Deploy OFN to the server by copying a git repo to the server and using ruby/rake/rails tasks to configure and migrate.\n\nOther playbooks include:\n* `backup.yml` - Backup database and image files on the server to the local machine.\n* `rollback.yml` - Rollback the database and codebase to the previous version.\n* `db_transfer.yml` - Transfer the database directly from one host to another (see [Refreshing a staging server](https://github.com/openfoodfoundation/ofn-install/wiki/Refreshing-a-staging-server))\n* `setup_remote_deployment.yml` - Set up a staging server to allow remote triggering of the deploy playbook (eg from a GitHub Action)\n* and more...\n\nYou may want to use the [ansible option \"checkrun\"](http://docs.ansible.com/playbooks_checkmode.html) to do a dry-run of the playbooks. With this option, Ansible will run the playbooks, but not actually make changes on the server.\n\n\n## Setup\n\n* Fork the ofn-install repository.\n* Clone the forked copy:\n  ```\n  git clone https://github.com/\u003cyour-namespace\u003e/ofn-install.git\n  ```\n\n### Python\n\nIt's recommended you set up your Python environment using [Pyenv](https://github.com/pyenv/pyenv).\n\n* Install and configure [pyenv](https://github.com/pyenv/pyenv)\n* Install and configure [pyenv-virtualenv](https://github.com/pyenv/pyenv-virtualenv)\n* Install the required Python version and install dependencies into a virtualenv for the project:\n  ```\n  ./bin/pyenv-install\n  ```\n\n### Ansible Galaxy Roles\n\nSome playbooks require third-party roles, which are specified in `bin/requirements.yml`. You can install with the included script:\n\n```\n$ bin/setup\n```\n\n## Secrets\n\nSome tasks (eg provision.yml) require host-specific secrets, and will show an error if they haven't been provided. Secrets can be added to the relevant `host_vars` subfolder (see [wiki](https://github.com/openfoodfoundation/ofn-install/wiki/Configuration#add-host_vars)) where they will be loaded automatically.\n\nSecrets can also be loaded from a different folder with a parameter like so:\n\n```sh\nansible-playbook playbooks/provision.yml --limit=au_staging -e \"@../ofn-secrets/au_staging/secrets.yml\" --ask-vault-pass\n```\n\nMany servers are managed by the OFN core team, so we have a copy of secrets in a shared repository which is considered the source of truth. Once your server is managed by the core team, ensure any config changes are sent to them.\n\nCore team members can fetch the latest with the `fetch_secrets.yml` playbook. The secrets for each host will be loaded into the relevant directory in `inventory/host_vars/`, then you can go ahead and provision. See the [ofn-secrets readme](https://github.com/openfoodfoundation/ofn-secrets/#readme) for more tips on setup.\nThese can change from time to time, so **always ensure you have the latest before provisioning**.\n\n```sh\nansible-playbook playbooks/fetch_secrets.yml \u0026\u0026 ansible-playbook playbooks/provision.yml\n```\n\n## Code quality\n\nRun the [ansible-lint](https://github.com/willthames/ansible-lint) checks using:\n```\nansible-lint site.yml --exclude=community\n```\n\n~~~This is also run in CI.~~~\n\n## Security\n\nThis repository doesn't manage additional security configuration. The private repository `ofn-security` is used for servers managed by the OFN team.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenfoodfoundation%2Fofn-install","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenfoodfoundation%2Fofn-install","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenfoodfoundation%2Fofn-install/lists"}