Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/igorkasyanchuk/sweet_staging
Access your Rails console, see logs, execute rake commands directly from the browser. Great addition to your Staging ENV.
https://github.com/igorkasyanchuk/sweet_staging
rails ruby-on-rails
Last synced: 15 days ago
JSON representation
Access your Rails console, see logs, execute rake commands directly from the browser. Great addition to your Staging ENV.
- Host: GitHub
- URL: https://github.com/igorkasyanchuk/sweet_staging
- Owner: igorkasyanchuk
- License: mit
- Created: 2020-12-24T16:54:54.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-02-28T13:18:03.000Z (almost 2 years ago)
- Last Synced: 2025-01-04T09:27:22.907Z (21 days ago)
- Topics: rails, ruby-on-rails
- Language: JavaScript
- Homepage: https://www.railsjazz.com/
- Size: 2.55 MB
- Stars: 49
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: MIT-LICENSE
Awesome Lists containing this project
README
# Sweet Staging
[![RailsJazz](https://github.com/igorkasyanchuk/rails_time_travel/blob/main/docs/my_other.svg?raw=true)](https://www.railsjazz.com)
[![https://www.patreon.com/igorkasyanchuk](https://github.com/igorkasyanchuk/rails_time_travel/blob/main/docs/patron.svg?raw=true)](https://www.patreon.com/igorkasyanchuk)
[![Listed on OpenSource-Heroes.com](https://opensource-heroes.com/badge-v1.svg)](https://opensource-heroes.com/r/igorkasyanchuk/sweet_staging)We often need access to the staging.logs (or production), sidekiq.log, etc. And often direct access to the server is closed and you cannot get them. The idea of this gem is let developer or QA get access to the logs which you want to share.
This gem allows to access files which are ONLY specified in config. Same about shell commands. Same about Rails console.
### Very Important
```
Use this gem CAREFULLY on the environment which you need!!!
To protect access to the logs and other commands you can use various configuration options.```
## Demo
See in action demo of the gem (opened app and `/sweet/staging` in a separate window)
[](https://github.com/igorkasyanchuk/sweet_staging/blob/main/docs/res_sweet_staging.gif?raw=true)
## Usage
Basically just add this gem to the Gemfile and open `/sweet/staging` path.
Additionaly you need to configure files which you want to get access to `confif/initializers/sweet_staging.rb`:
```ruby
SweetStaging.setup do |config|
config.enabled = true
config.fetch_timeout = 1000
config.console = true
config.logs = [
{
name: "staging.log",
path: "log/staging.log"
},
{
name: "sidekiq.log",
path: "log/sidekiq.log"
},
{
name: "cron.log",
path: "log/cron.log"
}
]
config.commands = [
{
name: "ps aux",
command: "ps aux"
},
{
name: "free -m",
command: "free -m"
}
]
# protect your Performance Dashboard with HTTP BASIC password
# config.http_basic_authentication_enabled = false
# config.http_basic_authentication_user_name = 'sweet'
# config.http_basic_authentication_password = 'password12'# if you need an additional rules to check user permissions
# config.verify_access_proc = proc { |controller| true }
# for example when you have `current_user`
# config.verify_access_proc = proc { |controller| controller.current_user && controller.current_user.admin? }end if defined?(SweetStaging)
```You can use configuration options above to protect access to the logs for a specific user or by HTTP BASIC auth.
Please note, that this is not a real Rails console as we used, it's basically evaluating Ruby code sent to the server (stateless).
## Installation
Add this gem to the needed group of gems. For example for staging env. Be careful with production env and access to the logs.
```ruby
group :staging do
gem 'sweet_staging'
end
```And then execute:
```bash
$ bundle
```After the installation start the server and open the `/sweet/staging`. Make sure that before you created an initializer and condifured all needed commands and files.
You need to have a "tail" and "wc" utils commands on the server to make everything working.
## TODO
- on scroll put on pause, on scroll to the bottom continue scrolling
- on selection put on pause
- implement link to log line feature
- specs
- support for Ruby <2.5 (open3 gem looks like was extracted into a separate gem)## Contributing
You are welcome to contribute.
## Contributors
- https://github.com/ulianadzoba
## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
[](https://www.railsjazz.com/?utm_source=github&utm_medium=bottom&utm_campaign=sweet_staging)