{"id":43101938,"url":"https://github.com/rescoot/sunshine","last_synced_at":"2026-01-31T17:16:56.922Z","repository":{"id":280158800,"uuid":"940500786","full_name":"rescoot/sunshine","owner":"rescoot","description":"Open source Rails application for managing unu/librescoot electric scooters, providing a web interface and API for monitoring telemetry data, tracking trips, and controlling scooter functionality.","archived":false,"fork":false,"pushed_at":"2025-05-24T07:13:12.000Z","size":65756,"stargazers_count":3,"open_issues_count":11,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-05-24T08:24:16.535Z","etag":null,"topics":["cloud","e-mobility","telemetry"],"latest_commit_sha":null,"homepage":"https://sunshine.rescoot.org","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rescoot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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-02-28T09:36:11.000Z","updated_at":"2025-05-24T07:13:15.000Z","dependencies_parsed_at":"2025-05-24T08:32:58.643Z","dependency_job_id":null,"html_url":"https://github.com/rescoot/sunshine","commit_stats":null,"previous_names":["rescoot/sunshine"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rescoot/sunshine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rescoot%2Fsunshine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rescoot%2Fsunshine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rescoot%2Fsunshine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rescoot%2Fsunshine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rescoot","download_url":"https://codeload.github.com/rescoot/sunshine/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rescoot%2Fsunshine/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28948361,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T14:26:55.697Z","status":"ssl_error","status_checked_at":"2026-01-31T14:26:52.545Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["cloud","e-mobility","telemetry"],"created_at":"2026-01-31T17:16:55.718Z","updated_at":"2026-01-31T17:16:56.912Z","avatar_url":"https://github.com/rescoot.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sunshine ☀️\n\nSunshine is a source-available Rails application for managing unu/librescoot electric scooters. It provides a web interface and API for monitoring telemetry data, tracking trips, and controlling scooter functionality.\n\n## Sponsorship\n\n| [![Starsong Consulting Avatar](https://avatars.githubusercontent.com/u/166622226?s=48)](https://starsong.eu/) | This project is sponsored by [Starsong Consulting](https://starsong.eu/). |\n|-|-|\n\n## Features\n\n- Real-time telemetry monitoring via MQTT\n- Trip tracking and statistics\n- User management with owner/user roles\n- API with token-based authentication\n- Admin dashboard with debugging tools\n- Remote scooter control (lock, unlock, blinkers, honk, seatbox, etc.)\n- Achievements system with various challenges and rewards (including configurable secret achievements)\n- Leaderboards with user rankings and statistics\n- Two-factor authentication (2FA) for enhanced security\n- Internationalization/localization support\n\n## Requirements\n\n- Ruby 3.2 or higher\n- Redis 7.0 or higher (for caching, background jobs, and real-time updates)\n- Mosquitto MQTT broker with authentication (for scooter communication)\n\n## Development Setup\n\n1. Clone the repository:\n```bash\ngit clone https://github.com/rescoot/sunshine.git\ncd sunshine\n```\n\n2. Install dependencies:\n```bash\nbundle install\n```\n\n3. Set up the database:\n```bash\nrails db:create db:migrate\n```\n\n4. Start Redis:\n```bash\ndocker compose start redis\n```\n\n5. Start the Rails server:\n```bash\nbin/dev\n```\n\n## Deployment\n\nThis application is designed to be deployed using [Kamal](https://kamal-deploy.org/). \n\n1. First, set up your production environment variables in `.env.production`:\n```bash\n# Kamal registry credentials\nKAMAL_REGISTRY_USERNAME=your-username\nKAMAL_REGISTRY_PASSWORD=your-token\n\n# Docker image\nIMAGE_NAME=your-registry/your-image\n\n# Server IPs\nWEB_SERVER_IP=your-web-server-ip\nJOB_SERVER_IP=your-job-server-ip\nMQTT_SERVER_IP=your-mqtt-server-ip\n\n# Builder configuration\nDEPLOY_USER=your-deploy-user\nDEPLOY_HOST=your-deploy-host\n\n# Domain names\nPRIMARY_DOMAIN=your-primary-domain\nSUNSHINE_DOMAIN=your-sunshine-domain\nUNU_DOMAIN=your-unu-domain\nUNU_CLOUD_DOMAIN=your-unu-cloud-domain\n\n# Rails configuration\nRAILS_ENV=production\nRAILS_LOG_TO_STDOUT=true\nREDIS_URL=redis://sunshine-redis:6379/1\n\n# SMTP configuration\nSMTP_ADDRESS=your-smtp-address\nSMTP_PASSWORD=your-smtp-password\n\n# MQTT configuration\nMQTT_HOST=your-mqtt-host\nMQTT_PORT=your-mqtt-port\nMQTT_SSL=true\nMQTT_USERNAME=your-mqtt-username\nMQTT_PASSWORD=your-mqtt-password\n```\n\nYou can use the provided `.env.production.example` as a template.\n\n2. Deploy:\n```bash\nsource .env.production  # or use `dotenv`\nkamal setup  # first run only\nkamal deploy\n```\n\n### MQTT Setup\n\nThe application requires a Mosquitto MQTT broker with authentication configured. Here's how to set it up:\n\n1. Install Mosquitto:\n```bash\napt install mosquitto mosquitto-clients\n```\n\n2. Generate certificates using the provided Rake tasks (optional):\n```bash\n# Create CA certificate (adjust organization and country as needed)\nrails mqtt_certs:create_ca[Rescoot,DE]\n\n# Generate server certificate\nrails mqtt_certs:create_server\n\n# Optional, if you want to use client cert auth: Generate client certificate (for each client)\nrails mqtt_certs:create_client[client_name]\n\n# Optional: Extract public certificates for distribution (not currently needed)\nrails mqtt_certs:extract_public\n```\n\nThis will create certificates in `config/mqtt_certs` with the following structure:\n```\nconfig/mqtt_certs/\n├── ca.crt           # CA certificate\n├── ca.key           # CA private key (keep secure!)\n├── clients/         # Client certificates\n│   └── client_name/\n│       ├── client.crt\n│       └── client.key\n├── public/          # Public certificates for distribution\n│   ├── ca.crt\n│   └── server.crt\n└── server/          # Server certificates\n    ├── server.crt\n    └── server.key\n```\n\nKeep all private keys (*.key files) secure and never distribute them.\n\nOr use openssl directly:\n```bash\n# Create CA key and certificate\nopenssl genrsa -out ca.key 2048\nopenssl req -new -x509 -days 3650 -key ca.key -out ca.crt\n\n# Create server key and certificate\nopenssl genrsa -out server.key 2048\nopenssl req -new -key server.key -out server.csr\nopenssl x509 -req -days 3650 -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt\n```\n\n3. Configure Mosquitto in `config/mosquitto/default.conf`.\n\nRemove `cafile`, `certfile`, `keyfile` if you're not using your own CA.\n\n4. Set up DynSec authentication. See `config/mosquitto/dynamic-security.json` for a baseline.\n\n5. Restart Mosquitto:\n```bash\nkamal accessory reboot mqtt\n# or if not using kamal\nsystemctl restart mosquitto\n```\n\n## Achievement System\n\nSunshine includes an achievement system that rewards users for various activities like distance traveled, trips completed, and special milestones. The system includes both regular achievements (visible to all users) and secret achievements (only revealed after being earned).\n\n### Configuring Achievements\n\nAchievements are configured using YAML files in the `config/achievements` directory:\n\n- `default.yml`: Contains regular (non-secret) achievements that are visible to users before they earn them.\n- `secret.yml.example`: Contains example secret achievements. These are not visible to users until they earn them.\n- `secret.yml`: The actual secret achievements used by your instance. This file is gitignored and should not be committed to the repository.\n\nTo set up secret achievements for your instance:\n\n1. Copy the example file to create your own secret achievements file:\n   ```bash\n   cp config/achievements/secret.yml.example config/achievements/secret.yml\n   ```\n\n2. Edit `secret.yml` to customize your secret achievements.\n\n3. The `secret.yml` file will be loaded automatically when the application starts.\n\nSee `config/achievements/README.md` for more details on the achievement format and configuration options.\n\n## Contributing\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## License\n\nThis project is licensed under the Elastic License v2.0. In short, this means you cannot:\n\n- provide the software to others as a hosted or managed service\n- alter or remove copyright or licensing info\n\nSee the [LICENSE.md](LICENSE.md) file for details.\nIf you want to offer Sunshine as a commercial service, contact us to discuss commercial licensing options.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frescoot%2Fsunshine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frescoot%2Fsunshine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frescoot%2Fsunshine/lists"}