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

Feat breaking change UI port inside container #823

Merged
merged 4 commits into from
Feb 2, 2024
Merged
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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ RUN corepack install && \

USER node

EXPOSE 80
EXPOSE 6246

VOLUME [ "/opt/data" ]
ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
21 changes: 18 additions & 3 deletions server/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,34 @@ async function bootstrap() {
await app.listen(3001);
}

function createDataDirectoryStructure(): void {
function createDataDirectoryStructure() {
try {
const dir = path.join(__dirname, `../../data/logs`);
// Check if data directory has read and write permissions
fs.accessSync(
path.join(__dirname, `../../data`),
fs.constants.R_OK | fs.constants.W_OK,
);

// create logs dir
const dir = path.join(__dirname, `../../data/logs`);
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir, {
recursive: true,
mode: 0o777,
});
}

// if db already exists, check r/w permissions
const db = path.join(__dirname, `../../data/maintainerr.sqlite`);
if (fs.existsSync(db)) {
fs.accessSync(db, fs.constants.R_OK | fs.constants.W_OK);
}
} catch (err) {
console.warn(
`THE CONTAINER NO LONGER OPERATES WITH PRIVILEGED USER PERMISSIONS. PLEASE UPDATE YOUR CONFIGURATION ACCORDINGLY: https://github.com/jorenn92/Maintainerr/releases/tag/v2.0.0`,
);
console.error(
'Could not create data directory. Make sure your permissions are set correctly.',
'Could not create or access (files in) the data directory. Please make sure the necessary permissions are set',
);
process.exit(0);
}
Expand Down
2 changes: 1 addition & 1 deletion supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ stdout_logfile_maxbytes=0
redirect_stderr=true

[program:ui]
environment=PORT=80
environment=PORT=6246
command=yarn node /opt/app/ui/server.js
autorestart=true
startretries=100
Expand Down
Loading