Skip to content

Commit 99825d5

Browse files
committed
validated docker image works with cli
1 parent dc7337e commit 99825d5

File tree

14 files changed

+604
-311
lines changed

14 files changed

+604
-311
lines changed

Dockerfile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,8 @@ COPY requirements.txt .
2525
RUN pip install --no-cache-dir -r requirements.txt
2626

2727
# Create necessary directories with proper permissions
28-
RUN mkdir -p /app/src/bluesky_notify/data /app/logs /app/instance \
29-
&& chmod -R 777 /app/src/bluesky_notify/data \
30-
&& chmod -R 777 /app/logs \
31-
&& chmod 777 /app/instance
28+
RUN mkdir -p /app/.local/share/bluesky-notify/logs /app/.local/share/bluesky-notify/data \
29+
&& chmod -R 777 /app/.local/share/bluesky-notify
3230

3331
# Create a non-root user
3432
RUN useradd -m -r appuser \
@@ -43,12 +41,15 @@ RUN pip install --no-cache-dir .
4341
# Switch to non-root user
4442
USER appuser
4543

44+
# Set HOME for XDG base directories
45+
ENV HOME=/app
46+
4647
# Expose the application port
4748
EXPOSE 5001
4849

4950
# Health check
5051
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
51-
CMD python -c "import requests; requests.get('http://localhost:5001/health')"
52+
CMD curl -f http://localhost:5001/ || exit 1
5253

5354
# Run the application
5455
CMD ["python", "run.py"]

README.md

Lines changed: 92 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
A cross-platform desktop notification system for Bluesky. Monitor and receive notifications from your favorite Bluesky accounts.
44

5-
[![Version](https://img.shields.io/badge/version-0.4.0-blue.svg)](https://github.com/jerdog/bluesky-notify)
5+
[![Version](https://img.shields.io/badge/version-0.4.1-blue.svg)](https://github.com/jerdog/bluesky-notify)
66
[![Python](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
77
[![Flask](https://img.shields.io/badge/Flask-3.1.0-blue)](https://pypi.org/project/Flask/)
88
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
99

1010
## Features
1111

1212
- Monitor multiple Bluesky accounts for new posts
13+
- Real-time browser notifications in Docker environment
1314
- Desktop notifications support across platforms (macOS, Linux, Windows)
1415
- Daemon mode for continuous monitoring
1516
- Web interface for easy account management
@@ -19,6 +20,7 @@ A cross-platform desktop notification system for Bluesky. Monitor and receive no
1920
- Cross-platform compatibility
2021
- Consistent CLI interface with clear version and configuration information
2122
- Comprehensive logging system with rotation and separate error logs
23+
- WebSocket support for real-time updates in Docker environment
2224

2325
## Installation
2426

@@ -33,7 +35,7 @@ bluesky-notify --version
3335

3436
Example output:
3537
```
36-
Bluesky Notify v0.4.0
38+
Bluesky Notify v0.4.1
3739
Config: /Users/username/.local/share/bluesky-notify
3840
3941
A cross-platform desktop notification system for Bluesky. Monitor and receive notifications from your favorite Bluesky accounts.
@@ -43,19 +45,19 @@ Usage: bluesky-notify [OPTIONS] COMMAND [ARGS]...
4345
Run 'bluesky-notify start --daemon' to install and run as a system service.
4446
4547
Options:
46-
--version Show version and exit
47-
--help Show this message and exit.
48+
--version Show version and exit
49+
--help Show this message and exit
4850
4951
Commands:
50-
add Add a Bluesky account to monitor.
51-
list List all monitored Bluesky accounts and their notification...
52-
remove Remove a Bluesky account from monitoring.
53-
settings View or update application settings.
54-
start Start the notification service.
55-
status View the current status of the service.
56-
stop Stop the notification service.
57-
toggle Toggle monitoring status for a Bluesky account.
58-
update Update notification preferences for a monitored account.
52+
add Add a Bluesky account to monitor.
53+
list List all monitored Bluesky accounts and their notification...
54+
remove Remove a Bluesky account from monitoring.
55+
settings View or update application settings.
56+
start Start the notification service.
57+
status View the current status of the service.
58+
stop Stop the notification service.
59+
toggle Toggle monitoring status for a Bluesky account.
60+
update Update notification preferences for a monitored account.
5961
```
6062

6163
## Configuration
@@ -65,6 +67,17 @@ The application uses the XDG Base Directory Specification for storing its data:
6567
- Configuration: `~/.config/bluesky-notify/`
6668
- Data: `~/.local/share/bluesky-notify/`
6769
- Cache: `~/.cache/bluesky-notify/`
70+
- Logs:
71+
- macOS: `~/Library/Logs/bluesky-notify/`
72+
- Linux: `~/.local/share/bluesky-notify/logs/`
73+
74+
### Port Configuration
75+
76+
The web interface runs on port 3000 by default. On macOS, port 5000 is avoided as it's reserved for AirPlay. You can change the port using:
77+
78+
```bash
79+
bluesky-notify settings --port NUMBER
80+
```
6881

6982
### Email Notifications (Optional)
7083

@@ -79,6 +92,18 @@ export MAILGUN_TO_EMAIL='your-email@example.com'
7992

8093
## Usage
8194

95+
### Starting the Service
96+
97+
Start the service with debug logging:
98+
```bash
99+
bluesky-notify start --log-level DEBUG
100+
```
101+
102+
Start as a system service:
103+
```bash
104+
bluesky-notify start --daemon
105+
```
106+
82107
### Command Help
83108

84109
To see all available commands and options:
@@ -104,136 +129,102 @@ Options:
104129
bluesky-notify list
105130
```
106131

107-
### Removing an Account
108-
109-
```bash
110-
bluesky-notify remove username.bsky.social
111-
```
112-
113-
### Toggling Account Status
132+
### Managing Accounts
114133

134+
Toggle monitoring for an account:
115135
```bash
116136
bluesky-notify toggle username.bsky.social
117137
```
118138

119-
### Updating Notification Preferences
120-
121-
```bash
122-
bluesky-notify update username.bsky.social --desktop --no-email
123-
```
124-
125-
### Checking Service Status
126-
127-
View the current status of the service:
128-
```bash
129-
bluesky-notify status
130-
```
131-
132-
This will show:
133-
- Service status (running/not running) and mode (terminal/daemon)
134-
- Web interface status and URL
135-
- Data directory location
136-
- Current configuration
137-
138-
### Starting and Stopping the Service
139-
140-
Start the service:
139+
Remove an account:
141140
```bash
142-
# Run in terminal mode
143-
bluesky-notify start
144-
145-
# Run as system service (daemon mode)
146-
bluesky-notify start --daemon
141+
bluesky-notify remove username.bsky.social
147142
```
148143

149-
Stop the service:
144+
Update notification preferences:
150145
```bash
151-
bluesky-notify stop
146+
bluesky-notify update username.bsky.social --desktop/--no-desktop --email/--no-email
152147
```
153-
The stop command will automatically detect whether the service is running in terminal or daemon mode and stop it accordingly.
154148

155-
### Viewing/Updating Settings
149+
## Docker Support
156150

157-
View current settings:
158-
```bash
159-
bluesky-notify settings
160-
```
151+
When running in Docker, the application supports browser notifications through WebSocket connections. The web interface will automatically detect the Docker environment and enable real-time notifications.
161152

162-
Update settings:
163-
```bash
164-
# Change check interval
165-
bluesky-notify settings --interval 120
153+
### Environment Variables
166154

167-
# Change log level
168-
bluesky-notify settings --log-level debug
155+
- `DOCKER_CONTAINER`: Set to 'true' to enable Docker-specific features
156+
- `PORT`: Override the default port (default: 5001 in Docker)
169157

170-
# Change web interface port
171-
bluesky-notify settings --port 8080
172-
```
173-
174-
Available settings:
175-
- Check interval (in seconds)
176-
- Log level (DEBUG, INFO, WARNING, ERROR)
177-
- Web interface port
178-
179-
### Logging
158+
## Logging
180159

181160
The application uses a comprehensive logging system:
182161

183-
- Log files are stored in `~/.local/share/bluesky-notify/logs/`
162+
- Log files are stored in platform-specific locations:
163+
- macOS: `~/Library/Logs/bluesky-notify/`
164+
- Linux: `~/.local/share/bluesky-notify/logs/`
165+
184166
- Two log files are maintained:
185167
- `bluesky-notify.log`: General application logs (INFO level and above)
186-
- `bluesky-notify.error.log`: Error-specific logs (ERROR level only)
168+
- `bluesky-notify.error.log`: Error logs only (ERROR level)
169+
187170
- Log rotation is enabled:
188171
- Maximum file size: 1MB
189172
- Keeps up to 5 backup files
190173
- Rotated files are named with numerical suffixes (e.g., bluesky-notify.log.1)
191174

192-
Log levels can be configured using the settings command:
193-
```bash
194-
bluesky-notify settings --log-level debug # Set to DEBUG level
195-
bluesky-notify settings --log-level info # Set to INFO level (default)
196-
```
175+
- Debug logging can be enabled with:
176+
```bash
177+
bluesky-notify start --log-level DEBUG
178+
```
197179

198-
## Version History
180+
## Development
199181

200-
- 0.4.0: Add web interface to daemon + terminal mode
201-
- 0.3.0: Add daemon mode, web interface, and improved CLI help text
202-
- 0.2.7: Fixed CLI output formatting and help text organization
203-
- 0.2.6: Enhanced CLI interface with consistent version and config display
204-
- 0.2.5: Improved help text formatting and command output
205-
- 0.2.4: Added version and config information to all commands
206-
- 0.2.3: Refined CLI presentation and version display
207-
- 0.2.0: Initial public release
182+
### Requirements
208183

209-
## Development
184+
- Python 3.9 or higher
185+
- Dependencies listed in pyproject.toml
186+
187+
### Setting Up Development Environment
210188

211189
1. Clone the repository:
212190
```bash
213191
git clone https://github.com/jerdog/bluesky-notify.git
214192
cd bluesky-notify
215193
```
216194

217-
2. Create a virtual environment:
218-
```bash
219-
python -m venv venv
220-
source venv/bin/activate # On Windows: venv\Scripts\activate
221-
```
222-
223-
3. Install development dependencies:
195+
2. Install development dependencies:
224196
```bash
225197
pip install -e ".[dev]"
226198
```
227199

228-
4. Build the package:
200+
3. Run tests:
229201
```bash
230-
python -m build
202+
pytest
231203
```
232204

233-
5. Install the built package:
234-
```bash
235-
pip install dist/bluesky_notify-0.4.0-py3-none-any.whl
236-
```
205+
## License
206+
207+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
208+
209+
## Contributing
210+
211+
Contributions are welcome! Please feel free to submit a Pull Request.
212+
213+
## Support
214+
215+
If you encounter any issues or have questions, please file an issue on the GitHub repository.
216+
217+
## Version History
218+
219+
- 0.4.1: Validate Docker container image builds correctly, make CLI co-exist
220+
- 0.4.0: Add web interface to daemon + terminal mode
221+
- 0.3.0: Add daemon mode, web interface, and improved CLI help text
222+
- 0.2.7: Fixed CLI output formatting and help text organization
223+
- 0.2.6: Enhanced CLI interface with consistent version and config display
224+
- 0.2.5: Improved help text formatting and command output
225+
- 0.2.4: Added version and config information to all commands
226+
- 0.2.3: Refined CLI presentation and version display
227+
- 0.2.0: Initial public release
237228

238229
## Troubleshooting
239230

@@ -250,15 +241,3 @@ pip install dist/bluesky_notify-0.4.0-py3-none-any.whl
250241
- Verify Bluesky handles are entered correctly (without '@' symbol)
251242
- Check your internet connection
252243
- Ensure the Bluesky API is accessible
253-
254-
## License
255-
256-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
257-
258-
## Contributing
259-
260-
Contributions are welcome! Please feel free to submit a Pull Request.
261-
262-
## Support
263-
264-
If you encounter any issues or have questions, please file an issue on the GitHub repository.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "bluesky-notify"
7-
version = "0.4.0"
7+
version = "0.4.1"
88
authors = [
99
{ name = "Jeremy Meiss", email = "jeremy.meiss@gmail.com" },
1010
]

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ sqlalchemy>=2.0.36
33
flask>=3.1.0
44
flask-cors>=5.0.0
55
flask-sqlalchemy>=3.1.1
6+
flask-sock>=0.7.0
7+
simple-websocket>=0.10.1
68
click>=8.1.7
79
python-dotenv>=1.0.1
810
rich>=13.9.4

0 commit comments

Comments
 (0)