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

Update local dev MongoDB versions #15334

Open
wants to merge 16 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
working mongo docker compose 🎉
negue committed Dec 3, 2024
commit 82445d23600a52bb84e0ba91ac1a0a3483122ceb
4 changes: 2 additions & 2 deletions config.json.example
Original file line number Diff line number Diff line change
@@ -34,8 +34,8 @@
"LOGGLY_TOKEN": "example-token",
"LOG_REQUESTS_EXCESSIVE_MODE": "false",
"MAINTENANCE_MODE": "false",
"NODE_DB_URI": "mongodb://localhost:27017/habitica-dev?replicaSet=rs&directConnection=true",
"TEST_DB_URI": "mongodb://localhost:27017/habitica-test?replicaSet=rs&directConnection=true",
"NODE_DB_URI": "mongodb://localhost:27017/habitica-dev?replicaSet=rs&directConnection=true&readPreference=secondary",
"TEST_DB_URI": "mongodb://localhost:27017/habitica-test?replicaSet=rs&directConnection=true&readPreference=secondary",
"MONGODB_POOL_SIZE": "10",
"MONGODB_SOCKET_TIMEOUT": "20000",
"NODE_ENV": "development",
46 changes: 34 additions & 12 deletions docker-compose.mongo-local.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,37 @@
# big thanks to https://pakisan.github.io/posts/docker-compose-mongodb-single-node-replica-set/ <3

version: "3.9"
networks:
mongodb-network:
name: "mongodb-network"
driver: bridge
services:
mongo:
image: mongo:7.0
restart: unless-stopped
command: ["--replSet", "rs", "--bind_ip_all", "--port", "27017"]
healthcheck:
test: echo "try { rs.status() } catch (err) { rs.initiate() }" | mongosh --port 27017 --quiet
interval: 10s
timeout: 30s
start_period: 0s
retries: 30
volumes:
- "./mongodb-data2:/data/db"
mongodb:
image: "mongo:7.0"
container_name: "mongodb"
networks:
- mongodb-network
hostname: "mongodb"
ports:
- "27017:27017"
restart: "unless-stopped"
volumes:
- "./mongodb-data:/data/db"
entrypoint: [ "/usr/bin/mongod", "--bind_ip_all", "--replSet", "rs" ]
mongoinit:
image: "mongo:7.0"
container_name: "mongodb_replSet_initializer"
restart: "on-failure" # WITHOUT THIS, the initializer tries only once and fails
depends_on:
- mongodb
networks:
- mongodb-network

command: >
mongosh --host mongodb:27017 --eval "rs.initiate({
_id: \"rs\",
members: [
{_id: 0, host: \"mongodb\"}
]
})"

Unchanged files with check annotations Beta

import babel from 'gulp-babel';
import os from 'os';
import fs from 'fs';
import spawn from 'cross-spawn'; // eslint-disable-line import/no-extraneous-dependencies

Check failure on line 8 in gulp/gulp-build.js

GitHub Actions / lint (21.x)

'spawn' is defined but never used

Check failure on line 8 in gulp/gulp-build.js

GitHub Actions / lint (21.x)

'spawn' is defined but never used
import clean from 'rimraf';

Check failure on line 9 in gulp/gulp-build.js

GitHub Actions / lint (21.x)

'clean' is defined but never used

Check failure on line 9 in gulp/gulp-build.js

GitHub Actions / lint (21.x)

'clean' is defined but never used
gulp.task('build:babel:server', () => gulp.src('website/server/**/*.js')
.pipe(babel())
const mongooseOptions = getDefaultConnectionOptions();
const connectionUrl = getDevelopmentConnectionUrl(TEST_DB_URI);
console.info({

Check warning on line 62 in gulp/gulp-tests.js

GitHub Actions / lint (21.x)

Unexpected console statement

Check warning on line 62 in gulp/gulp-tests.js

GitHub Actions / lint (21.x)

Unexpected console statement
mongooseOptions,
connectionUrl,
});
// Specifically helpful for the GET /groups tests,
// resets the db to an empty state and creates a tavern document
export async function resetHabiticaDB () {
console.info('Resetting Habitica DB');

Check warning on line 24 in test/helpers/mongo.js

GitHub Actions / lint (21.x)

Unexpected console statement

Check warning on line 24 in test/helpers/mongo.js

GitHub Actions / lint (21.x)

Unexpected console statement
const groups = mongoose.connection.db.collection('groups');
const users = mongoose.connection.db.collection('users');
return mongoose.connection.dropDatabase()
return count;
}
export function remainingGearInSet (userGear = {}, set) {

Check warning on line 50 in website/common/script/count.js

GitHub Actions / lint (21.x)

Default parameters should be last

Check warning on line 50 in website/common/script/count.js

GitHub Actions / lint (21.x)

Default parameters should be last
const gear = filter(content.gear.flat, item => {
if (item.klass !== set) {
return false;
return count;
}
export function questsOfCategory (userQuests = {}, category) {

Check warning on line 66 in website/common/script/count.js

GitHub Actions / lint (21.x)

Default parameters should be last

Check warning on line 66 in website/common/script/count.js

GitHub Actions / lint (21.x)

Default parameters should be last
const quests = filter(content.quests, quest => {
const categoryMatches = quest.category === category;
const hasQuest = userQuests[quest.key];
return Math.random();
}
export default function randomDrop (user, options, req = {}, analytics) {

Check warning on line 30 in website/common/script/fns/randomDrop.js

GitHub Actions / lint (21.x)

Default parameters should be last

Check warning on line 30 in website/common/script/fns/randomDrop.js

GitHub Actions / lint (21.x)

Default parameters should be last
let acceptableDrops;
let drop;
let dropMultiplier;
export default async function buy (
user,
req = {},

Check warning on line 26 in website/common/script/ops/buy/buy.js

GitHub Actions / lint (21.x)

Default parameters should be last

Check warning on line 26 in website/common/script/ops/buy/buy.js

GitHub Actions / lint (21.x)

Default parameters should be last
analytics,
options = { quantity: 1, hourglass: false },
) {
import { removeItemByPath } from '../pinnedGearUtils';
import getItemInfo from '../../libs/getItemInfo';
export default async function buyMysterySet (user, req = {}, analytics) {

Check warning on line 15 in website/common/script/ops/buy/buyMysterySet.js

GitHub Actions / lint (21.x)

Default parameters should be last

Check warning on line 15 in website/common/script/ops/buy/buyMysterySet.js

GitHub Actions / lint (21.x)

Default parameters should be last
const key = get(req, 'params.key');
if (!key) throw new BadRequest(errorMessage('missingKeyParam'));
import { removeItemByPath } from '../pinnedGearUtils';
import updateUserHourglasses from '../updateUserHourglasses';
export default async function purchaseHourglass (user, req = {}, analytics, quantity = 1) {

Check warning on line 15 in website/common/script/ops/buy/hourglassPurchase.js

GitHub Actions / lint (21.x)

Default parameters should be last

Check warning on line 15 in website/common/script/ops/buy/hourglassPurchase.js

GitHub Actions / lint (21.x)

Default parameters should be last
const key = get(req, 'params.key');
if (!key) throw new BadRequest(errorMessage('missingKeyParam'));
const acceptedTypes = ['eggs', 'hatchingPotions', 'food', 'gear', 'bundles'];
const singlePurchaseTypes = ['gear'];
export default async function purchase (user, req = {}, analytics) {

Check warning on line 79 in website/common/script/ops/buy/purchase.js

GitHub Actions / lint (21.x)

Default parameters should be last

Check warning on line 79 in website/common/script/ops/buy/purchase.js

GitHub Actions / lint (21.x)

Default parameters should be last
const type = get(req.params, 'type');
const key = get(req.params, 'key');
return balanceRemoved;
}
export default async function changeClass (user, req = {}, analytics) {

Check warning on line 37 in website/common/script/ops/changeClass.js

GitHub Actions / lint (21.x)

Default parameters should be last

Check warning on line 37 in website/common/script/ops/changeClass.js

GitHub Actions / lint (21.x)

Default parameters should be last
const klass = get(req, 'query.class');
let balanceRemoved = 0;
// user.flags.classSelected is set to false after the user paid the 3 gems
components: {
Sprite,
},
props: ['data'],

Check warning on line 108 in website/client/src/components/achievements/genericAchievement.vue

GitHub Actions / client-unit (21.x)

Prop "data" should define at least its type

Check warning on line 108 in website/client/src/components/achievements/genericAchievement.vue

GitHub Actions / client-unit (21.x)

Prop "data" should define at least its type

Check warning on line 108 in website/client/src/components/achievements/genericAchievement.vue

GitHub Actions / production-build (21.x)

Prop "data" should define at least its type

Check warning on line 108 in website/client/src/components/achievements/genericAchievement.vue

GitHub Actions / production-build (21.x)

Prop "data" should define at least its type
data () {
return {
icons: Object.freeze({
components: {
Avatar,
},
props: ['data'],

Check warning on line 135 in website/client/src/components/achievements/login-incentives.vue

GitHub Actions / client-unit (21.x)

Prop "data" should define at least its type

Check warning on line 135 in website/client/src/components/achievements/login-incentives.vue

GitHub Actions / client-unit (21.x)

Prop "data" should define at least its type

Check warning on line 135 in website/client/src/components/achievements/login-incentives.vue

GitHub Actions / production-build (21.x)

Prop "data" should define at least its type

Check warning on line 135 in website/client/src/components/achievements/login-incentives.vue

GitHub Actions / production-build (21.x)

Prop "data" should define at least its type
data () {
return {
loginIncentives: content.loginIncentives,
withBackground: {
type: Boolean,
},
overrideAvatarGear: {

Check warning on line 157 in website/client/src/components/avatar.vue

GitHub Actions / client-unit (21.x)

Prop 'overrideAvatarGear' requires default value to be set

Check warning on line 157 in website/client/src/components/avatar.vue

GitHub Actions / client-unit (21.x)

Prop 'overrideAvatarGear' requires default value to be set
type: Object,
},
width: {
type: String,
default: '0 auto 0 24px',
},
overrideTopPadding: {

Check warning on line 172 in website/client/src/components/avatar.vue

GitHub Actions / client-unit (21.x)

Prop 'overrideTopPadding' requires default value to be set

Check warning on line 172 in website/client/src/components/avatar.vue

GitHub Actions / client-unit (21.x)

Prop 'overrideTopPadding' requires default value to be set
type: String,
},
showVisualBuffs: {
await this.loadChallenge();
next();
},
props: ['challengeId'],

Check warning on line 412 in website/client/src/components/challenges/challengeDetail.vue

GitHub Actions / client-unit (21.x)

Prop "challengeId" should define at least its type

Check warning on line 412 in website/client/src/components/challenges/challengeDetail.vue

GitHub Actions / client-unit (21.x)

Prop "challengeId" should define at least its type
data () {
return {
searchId: '',
components: {
TaskColumn: Column,
},
props: ['challengeId'],

Check warning on line 48 in website/client/src/components/challenges/challengeMemberProgressModal.vue

GitHub Actions / client-unit (21.x)

Prop "challengeId" should define at least its type

Check warning on line 48 in website/client/src/components/challenges/challengeMemberProgressModal.vue

GitHub Actions / client-unit (21.x)

Prop "challengeId" should define at least its type
data () {
return {
columns: ['habit', 'daily', 'todo', 'reward'],
markdown: markdownDirective,
},
mixins: [userStateMixin],
props: ['groupId'],

Check warning on line 289 in website/client/src/components/challenges/challengeModal.vue

GitHub Actions / client-unit (21.x)

Prop "groupId" should define at least its type

Check warning on line 289 in website/client/src/components/challenges/challengeModal.vue

GitHub Actions / client-unit (21.x)

Prop "groupId" should define at least its type
data () {
const categoryOptions = CategoryOptions;
const hashedCategories = {};
components: {
memberSearchDropdown,
},
props: ['challengeId', 'members', 'prize', 'flagCount'],

Check warning on line 137 in website/client/src/components/challenges/closeChallengeModal.vue

GitHub Actions / client-unit (21.x)

Prop "challengeId" should define at least its type

Check warning on line 137 in website/client/src/components/challenges/closeChallengeModal.vue

GitHub Actions / client-unit (21.x)

Prop "members" should define at least its type

Check warning on line 137 in website/client/src/components/challenges/closeChallengeModal.vue

GitHub Actions / client-unit (21.x)

Prop "prize" should define at least its type

Check warning on line 137 in website/client/src/components/challenges/closeChallengeModal.vue

GitHub Actions / client-unit (21.x)

Prop "challengeId" should define at least its type

Check warning on line 137 in website/client/src/components/challenges/closeChallengeModal.vue

GitHub Actions / client-unit (21.x)

Prop "members" should define at least its type

Check warning on line 137 in website/client/src/components/challenges/closeChallengeModal.vue

GitHub Actions / client-unit (21.x)

Prop "prize" should define at least its type
data () {
return {
winner: {},
};
</script>
<style src="@/assets/scss/index.scss" lang="scss"></style>

Check warning on line 303 in website/client/src/app.vue

GitHub Actions / production-build (21.x)

The <style> should be above the <script> on line 106

Check warning on line 303 in website/client/src/app.vue

GitHub Actions / production-build (21.x)

The <style> should be above the <script> on line 106
<style src="@/assets/scss/sprites.scss" lang="scss"></style>

Check warning on line 304 in website/client/src/app.vue

GitHub Actions / production-build (21.x)

The <style> should be above the <script> on line 106

Check warning on line 304 in website/client/src/app.vue

GitHub Actions / production-build (21.x)

The <style> should be above the <script> on line 106
};
</script>
<style lang="scss" scoped>

Check warning on line 56 in website/client/src/components/404.vue

GitHub Actions / production-build (21.x)

The <style> should be above the <script> on line 37

Check warning on line 56 in website/client/src/components/404.vue

GitHub Actions / production-build (21.x)

The <style> should be above the <script> on line 37
@import '~@/assets/scss/colors.scss';
h1, .static-wrapper h1 {
>
Could not find any matching users.
</div>
<loading-spinner class="mx-auto mb-2" dark-color="true" v-if="isSearching" />

Check warning on line 10 in website/client/src/components/admin-panel/search.vue

GitHub Actions / production-build (21.x)

'dark-color' should be on a new line

Check warning on line 10 in website/client/src/components/admin-panel/search.vue

GitHub Actions / production-build (21.x)

Attribute "v-if" should go before "dark-color"

Check warning on line 10 in website/client/src/components/admin-panel/search.vue

GitHub Actions / production-build (21.x)

'v-if' should be on a new line

Check warning on line 10 in website/client/src/components/admin-panel/search.vue

GitHub Actions / production-build (21.x)

'dark-color' should be on a new line

Check warning on line 10 in website/client/src/components/admin-panel/search.vue

GitHub Actions / production-build (21.x)

Attribute "v-if" should go before "dark-color"

Check warning on line 10 in website/client/src/components/admin-panel/search.vue

GitHub Actions / production-build (21.x)

'v-if' should be on a new line
<div
v-if="users.length > 0"
class="list-group"
computed: {
...mapState({ user: 'user.data' }),
},
beforeRouteUpdate (to, from, next) {

Check warning on line 73 in website/client/src/components/admin-panel/search.vue

GitHub Actions / production-build (21.x)

The "beforeRouteUpdate" property should be above the "data" property on line 62

Check warning on line 73 in website/client/src/components/admin-panel/search.vue

GitHub Actions / production-build (21.x)

The "beforeRouteUpdate" property should be above the "data" property on line 62
this.userIdentifier = to.params.userIdentifier;
next();
},
methods: {
async saveItem (item) {
// prepare the item's new value and path for being saved
this.hero.achievementPath = item.path;

Check warning on line 260 in website/client/src/components/admin-panel/user-support/achievements.vue

GitHub Actions / production-build (21.x)

Unexpected mutation of "hero" prop

Check warning on line 260 in website/client/src/components/admin-panel/user-support/achievements.vue

GitHub Actions / production-build (21.x)

Unexpected mutation of "hero" prop
this.hero.achievementVal = item.value;
await this.saveHero({ hero: this.hero, msg: item.path });