-
Notifications
You must be signed in to change notification settings - Fork 461
Production Environment Tips & Tricks
This page is collection of tips & tricks about our production environment.
We are running the rails application as the user wwwrun. So whatever you want to do you should also do this as this user to avoid creating files/running services with the wrong permissions. For this just prepend
run_in_api rails console
We have our own systemd target that defines all the services we need. You can look at the status of all of them with
systemctl list-dependencies obs-api-support.target
There are a couple of log files
-
Ruby on Rails:
/srv/www/obs/api/log/production.log -
Ruby on Rails calling the backend:
/srv/www/obs/api/log/backend_access.log -
clockworkd:
/srv/www/obs/api/log/clockworkd.clock.output -
searchd:
/srv/www/obs/api/log/production.searchd.logand/srv/www/obs/api/log/production.searchd.query.log -
Apache:
/srv/www/obs/api/log/apache_access.logand/srv/www/obs/api/log/error.log -
Postfix:
/var/log/mail -
All systemd units:
journalctl -u $SERVICEFilter messages within a time range (either timestamp or placeholders like "yesterday"):
journalctl -u $SERVICE --since now|today|yesterday|tomorrow --until YYYY-MM-DD HH:MM:SS
We are recording shell commands with timestamps in /root/.bash_history. You can look at it with the history command. Please note that the history is not sorted in chronological order. You can look at this in chronological order with
history | tr --squeeze-repeats " " | cut -d " " -f 3- | sort
pry which we use as rails console has a nice history feature. You can also look at the history file:
/var/lib/wwwrun/.local/share/pry/pry_history
journalctl -u sshd --utc -o json --since "6 hours ago" | ruby /root/who.rb
run_in_api rake user:toggle_admin_rights theusername
Grep the top 15 IPs requesting Webui::PackageController#view_file
grep 'controller=Webui::PackageController action=view_file' log/production.log |awk 'match($0,/\yhost=(\S+)/, arr) {print arr[1]}'|sort |uniq -c|sort |tail -n 15
- Development Environment Overview
- Development Environment Tips & Tricks
- Spec-Tips
- Code Style
- Rubocop
- Testing with VCR
- Test in kanku
- Authentication
- Authorization
- Autocomplete
- BS Requests
- Events
- ProjectLog
- Notifications
- Feature Toggles
- Build Results
- Attrib classes
- Flags
- The BackendPackage Cache
- Maintenance classes
- Cloud uploader
- Delayed Jobs
- Staging Workflow
- StatusHistory
- OBS API
- Owner Search
- Search
- Links
- Distributions
- Repository
- Data Migrations
- Package Versions
- next_rails
- Ruby Update
- Rails Profiling
- Remote Pairing Setup Guide
- Factory Dashboard
- osc
- Setup an OBS Development Environment on macOS
- Run OpenQA smoketest locally
- Responsive Guidelines
- Importing database dumps
- Problem Statement & Solution
- Kickoff New Stuff
- New Swagger API doc
- Documentation and Communication
- GitHub Actions
- Brakeman
- How to Introduce Software Design Patterns
- Query Objects
- Services
- View Components
- RFC: Core Components
- RFC: Decorator Pattern
- RFC: Backend models
- RFC: Hotwire Turbo Frames Pattern