Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/data retention #790

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
4 changes: 3 additions & 1 deletion app/models/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
'use strict';

var mongoose = require('mongoose');
var settings = require('./app/config'),
var ObjectId = mongoose.Schema.Types.ObjectId;

var MessageSchema = new mongoose.Schema({
Expand All @@ -25,7 +26,8 @@ var MessageSchema = new mongoose.Schema({
posted: {
type: Date,
default: Date.now,
index: true
index: true,
expires: settings.database.message_retention
}
});

Expand Down
6 changes: 4 additions & 2 deletions app/models/room.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//

'use strict';

const settings = require('./app/config')
var mongoose = require('mongoose'),
uniqueValidator = require('mongoose-unique-validator'),
bcrypt = require('bcryptjs');
Expand Down Expand Up @@ -51,7 +51,9 @@ var RoomSchema = new mongoose.Schema({
},
lastActive: {
type: Date,
default: Date.now
default: Date.now,
expires: settings.database.room_retention

},
private: {
type: Boolean,
Expand Down
2 changes: 2 additions & 0 deletions defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ xmpp:

database:
uri: mongodb://localhost/letschat
message_retention: 10800
room_retention: '30d'

secrets:
cookie: secretsauce
Expand Down
11 changes: 11 additions & 0 deletions docker-cloud.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
app:
image: tr4nsf3r/lets-chat:latest
autoredeploy: true
links:
- mongo
ports:
- 8080:8080
- 5222:5222

mongo:
image: mongo:latest
4 changes: 2 additions & 2 deletions docker/docker-compose.yml → docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
# Usage: docker-compose up

app:
image: sdelements/lets-chat:latest
image: tr4nsf3r/lets-chat:latest
links:
- mongo
ports:
- 80:8080
- 8080:8080
- 5222:5222

mongo:
Expand Down
54 changes: 0 additions & 54 deletions docker/README.md

This file was deleted.