{"id":25025190,"url":"https://github.com/bsutton/pig_server","last_synced_at":"2025-07-20T16:32:50.337Z","repository":{"id":272202939,"uuid":"915604965","full_name":"bsutton/pig_server","owner":"bsutton","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-01T02:55:12.000Z","size":81739,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-18T22:00:01.365Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dart","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/bsutton.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2025-01-12T10:14:08.000Z","updated_at":"2025-06-01T02:55:18.000Z","dependencies_parsed_at":"2025-02-12T00:33:56.738Z","dependency_job_id":null,"html_url":"https://github.com/bsutton/pig_server","commit_stats":null,"previous_names":["bsutton/pig_server"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/bsutton/pig_server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsutton%2Fpig_server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsutton%2Fpig_server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsutton%2Fpig_server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsutton%2Fpig_server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bsutton","download_url":"https://codeload.github.com/bsutton/pig_server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsutton%2Fpig_server/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266160230,"owners_count":23885881,"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":[],"created_at":"2025-02-05T16:38:39.387Z","updated_at":"2025-07-20T16:32:50.323Z","avatar_url":"https://github.com/bsutton.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PiGation\n\nPiGation is a WebServer and front end for running an irrigation system\non the raspberry pi.\n\nPiGation lets you configure garden beds and lights associate those features\nwith general IO pins on your Rapsberry PI.\n\nPigation is written in Dart and easy to install.\n\nStart by installing Dart on your raspberry PI.\n\nOnce Dart is installed you can install PiGation.\n\nNOTE: you can run up a test system on any linux system as PiGation\ncomes with a IO simulator that simply logs out any IO PIN changes when\nnot run on a RiPi.\n\n```bash\ndart pub global activate pigation\ndart pub global activate dcli_sdk\nsudo env PATH=\"$PATH\" dcli install\n```\n\nFollow the dcli instructions on adding the ~/.dcli/bin directory to your path.\n\nNow compile pigation.\n\n```bash\ndcli compile --package pigation\n```\n\n\nNow run the pigation installer. This will install pigation into /opt/pigation.\n\nAs part of the install you need to decide if you will use HTTP or HTTPS to\naccess PiGation.  If you want to use HTTPS then your PI must be exposed on\nthe internet (using NAT) with both port 80 and 443 open.\n\nIf you don't understand how to configure NAT then just choose HTTP.\n\n\n```bash\nsudo env PATH=\"$PATH\" pig\n```\n\n# Accessing \nThe pigation server has an embedded front end.\n\nTo access the Pigation front end navigate to the IP address of FQDN of\nyour RiPI from a browser.\n\n`http://mypi`\n\nIf you have enabled HTTPS then:\n`https://mypi`\n\n# Getting Started\nThe first thing you need to do is connect the GIO pins to your irrigation\nvalues, you will need a relay device to provide enough power to trigger the vales.\n\nOnce the hardware is configured you need to define End Points and Garden Beds\n\nAn EndPoint creates a named mapping to a GIO pin on the pie.\nOnce you have defined you End Points you can go in and configure your\nGarden Beds. After which you are ready to water your garden.\n\n\n\n# HTTPS\nIf you have selected HTTPS then the server will attempt to obtain a letsencrypt\ncertificate when it starts. It will also auto renew the certificate as require.\n\nIn order to user HTTPS the following requirements must be met:\n\nPorts 80 and 443 must be exposed to the public internet. This usually requires\nthe configuration of NAT on your home router.\n\nWhen installing pigation you should choose a 'Staging' certificate until\nyou have successfully obtain a certificate.\n\nOnce you have obtained a staging certificate you can switch to a live\ncertificate by running `sudo pig` and switch to a Live certificate.\n\n\n# deployment\n\nThe pig installer installs itself into /opt/pigation.\n\nIt also installs a cron job so that the pigation server restarts if\nyour RiPi reboots.\n\n\n# Release\nPigation use pub_release to publish to pub.dev.\n\nFrom the pig_server root directory run: \n```\ndart pub global activate pub_release\npub_release\n```\n\n\n# configuration\n\nThe /opt/pigation/config/config.yaml file is used to configure the server.\n\nThe install creates the config.yaml file based on your answers during the \ninstall. \nIt is generally easier to run `sudo pig` if you need to make config modification\nas that command will restart you pigation server with the new config.\n\n\n# development\nYou will need a separate config.yaml files for your development environment.\n\n| usage | location |\n| ----- | ----- |\n| development path | `\u003cproject root\u003e/config/config.yaml` |\n\n\nThe following is a sample for your **development** environment\n\n`\u003cproject root\u003e/config/config.yaml`\n```yaml\npassword: XXXXXXXXXXX\npath_to_static_content: /home/yourhome/pigation/pig_app/build/web\npath_to_lets_encrypt_live: /opt/pigation/letsencrypt/live\nfqdn: \u003cyour local ip\u003e\ndomain_email: your@email.dev\nhttps_port: 10443  # use ports above 1024\nhttp_port: 1080\nproduction: false\nbinding_address: 0.0.0.0\nlogger_path: console\n\n```\n\n\n\n| setting | purpose |\n| ------------ | ----------------- |\n| password | hashed password used to auth the front end app. |\n| path_to_static_content | location where the server will look for the sites static web content |\n| path_to_lets_encrypt_live | The location to store the lets encrypt certificate. |\n| fqdn | The fully qualified domain name of your web site |\n| domain_email | The email address we submit to Lets Encrypt so it can send renewal notices and other critical communications. (We do however renew certificates automatically). |\n| https_port | The port to listen to https requests on. |\n| http_port | The port to listen to http requests on. This port MUST be open as it is required by Lets Encrypt to obtain a certificate |\n| production | Controls wheter we obtain a live or staging Lets Encrypt certificate. You should start by setting this to false until you have seen IHAServer successfully obtain a certificate. You can then change the setting to 'true' and restart the IAHServer to obtain a live certificate. **See below for additional information**|\n| binding_address | The IP address that IAHServer will listen to. Using 0.0.0.0 tells the PIG Server to listen on all local addresses. If you use a specific address it must be a local addres on the server. |\n| logger_path | The path to write log messages to. If you set this value to 'console' log messages are printed to the stdout (the console). This is useful in a development environment |\n\n\n\n# Certificates in Development\n\nWithin you development environement you are likely to be behind a NAT.\nTo test the cert aquistion and renewal you will need to forward \nport 443 and 80 from your local router to your development box.\n\nYou will need a DNS server with a real domain name and an A record that \npoints to your router's public IP.\n\nOn Linux, you will need to make the server use ports above 1024 (you can only\nlisten to ports below 1024 if you are root - not recommended for dev).\n\nI suggest:\n80 -\u003e 8080\n443 -\u003e 8443\n\nYou will need to change the config/config.yaml port settings to match the port\nnumbers you choose.\n\nYou should generally test using a staging certificate until you are certain your configuration\nand NAT are set up correctly.\n\n## Run the service locally\n\nTo debug the pig server you can simply launch bin/pig.dart --server in your favourite IDE.\n\n\n# Build on the PI\n\n```bash\ndart pub global activate dcli_sdk\nudo env PATH=\"$PATH\" dcli install\ngit clone https://github.com/bsutton/pig_server.git\ndcli compile bin/pig.dart\nsudo env PATH=\"$PATH\" pig\n```\n\n# publishing to pub.dev\n\nThe pigation server is intended to be publish to pub.dev to make installation\nsimple.\n\nWe use pub_release to do this.\n\n```\ndart pub global activate pub_release\npub_release\n```\n\nThere is a pub_release hook too/pre_release_hook/build_and_pack_wasm.dart which\nbuilds the wasm target and packs it into the pigation server.\n\n\n# cross platform compliation\n\n* requires dart 3.8\n\nYou can compile pig for you raspberry pi using a Linix/Windows or MacOS\ndesktop environment.\n\nCompiling on your rpi can be very slow and requires quite a bit of memory.\nAs such it is better to compile the pig exec on a desktop system.\n\n* Note the cross compilation will take a few minutes.\n\nTo cross compile run:\n\n```bash\ncd pig_server\n\ntool/cross_build.dart\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbsutton%2Fpig_server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbsutton%2Fpig_server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbsutton%2Fpig_server/lists"}