mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
fix local file
This commit is contained in:
@@ -1,6 +1,28 @@
|
||||
import fs from 'fs';
|
||||
|
||||
export default class LocalFile {
|
||||
public static async makeDirectory(path: string): Promise<void> {
|
||||
return new Promise((resolve: Function, reject: Function) => {
|
||||
fs.mkdir(path, { recursive: true }, (err: unknown) => {
|
||||
if (err) {
|
||||
return reject(err);
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public static async write(path: string, data: string): Promise<void> {
|
||||
return new Promise((resolve: Function, reject: Function) => {
|
||||
fs.writeFile(path, data, (err: unknown) => {
|
||||
if (err) {
|
||||
return reject();
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public static async read(path: string): Promise<string> {
|
||||
return new Promise(
|
||||
(resolve: (data: string) => void, reject: Function) => {
|
||||
|
||||
@@ -43,4 +43,21 @@ helm lint ./HelmChart/Public/oneuptime
|
||||
|
||||
```
|
||||
helm test oneuptime
|
||||
```
|
||||
|
||||
|
||||
### Postgres Ops
|
||||
|
||||
To access postgres use port forwarding in kubenrtes
|
||||
|
||||
```
|
||||
kubectl port-forward --address 0.0.0.0 service/oneuptime-postgresql 5432:5432
|
||||
```
|
||||
|
||||
then you should be able to access from the server IP and port 5432
|
||||
|
||||
You also need to read postgres password which is stored in kubenretes secrets. You can decode the password by using this command:
|
||||
|
||||
```
|
||||
kubectl get secret/oneuptime-postgresql -o go-template='{{.data.password|base64decode}}'
|
||||
```
|
||||
@@ -25,8 +25,8 @@ import LIMIT_MAX from 'Common/Types/Database/LimitMax';
|
||||
import axios, { AxiosResponse } from 'axios';
|
||||
import GreenlockCertificate from 'Model/Models/GreenlockCertificate';
|
||||
import GreenlockCertificateService from 'CommonServer/Services/GreenlockCertificateService';
|
||||
import fs from 'fs';
|
||||
import SelfSignedSSL from '../../Utils/SelfSignedSSL';
|
||||
import LocalFile from 'CommonServer/Utils/LocalFile';
|
||||
|
||||
const router: ExpressRouter = Express.getRouter();
|
||||
|
||||
@@ -466,12 +466,23 @@ RunCron(
|
||||
]) as string;
|
||||
}
|
||||
|
||||
// Need to make sure StatusPageCerts dir exists.
|
||||
|
||||
try {
|
||||
await LocalFile.makeDirectory('/usr/src/Certs/StatusPageCerts');
|
||||
} catch (err) {
|
||||
// directory already exists, ignore.
|
||||
logger.err('Create directory err');
|
||||
logger.err(err);
|
||||
}
|
||||
|
||||
// Write to disk.
|
||||
fs.writeFileSync(
|
||||
await LocalFile.write(
|
||||
`/usr/src/Certs/StatusPageCerts/${cert.key}.crt`,
|
||||
crt
|
||||
);
|
||||
fs.writeFileSync(
|
||||
|
||||
await LocalFile.write(
|
||||
`/usr/src/Certs/StatusPageCerts/${cert.key}.key`,
|
||||
key
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user