-
Notifications
You must be signed in to change notification settings - Fork 173
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
Selfhost #22
Comments
i want to add that the interface looks really good, props to you! |
Thanks for the compliment! 😂 This seems a duplicate for #14 (sorry for simplified Chinese) That's definitely not how it's expected to work, but if you have a valid reason to self-host this project instead of uptime-kuma (which is more feature-rich as it's run on native platforms instead of Workers), there is a method: Cloudflare wrangler has a built-in I used this method for another project: https://github.com/lyc8503/onedrive-cf-index-ng I may try to write a dockerfile when I have time, you can also try it yourself, if you configure it successfully, PRs are always welcome. |
Oh, yeah I am absolutely going to try that, and yeah I didn't see that because its simplified Chinese. Would you mind sharing your discord or some other platform if I have questions? Or should I Just keep opening issues if there are some? |
Sorry I don't use discord very often, but if you don't feel comfortable communicating in issues, you can also send me e-mails: [email protected] |
yeah im definitely going to do that, but i am some how lost i cant find any dependecies and on what port this service runs, i guess 80. Do you have some sort of internal documentation? |
I don't have any internal docs. Maybe you can refer to https://developers.cloudflare.com/workers/wrangler/commands/#dev. I thought last time I got it to work just by installing |
Ah okay Im reading through it right now, are there any sort of dependecies used? Idk like wget or curl or something like that? |
@lyc8503 I'm getting a constant 405 Method not allowed as far as i can see its this line if (request.method !== 'POST') {
return new Response('Remote worker is working...', { status: 405 })
} |
nvm forgot to build the project 😭 |
@lyc8503 do you have some sort of .dev.vars file? Wrangler throws me that Error. This is my Dockerfile: # Use Node.js 20 Alpine as base image
FROM node:20-alpine AS base
# Update package index
RUN apk update
# Create directories
RUN mkdir -p /app && \
mkdir -p /tmp/package
# Copy package.json files to /tmp/package/
COPY ./data/package*.json /tmp/package/
# Change working directory to /tmp/package/ and install wrangler globally and npm packages
RUN cd /tmp/package && \
npm install -g wrangler@latest && \
npm install
# Set working directory to /app
WORKDIR /app
# Create a .env file
RUN touch /app/.env
# Copy the application code to /app
COPY ./data /app # ./data is just the entire repo for now
# Define volume for /app
VOLUME [ "/app" ]
# Expose port 9999
EXPOSE 9999
# Set the default command to run the development server
CMD ["wrangler", "dev", "-c", "worker/wrangler-dev.toml", "--node-compat", "--port", "9999", "--log-level", "debug"] And this is the error: Failed to load .env file "/app/worker/.dev.vars": Error: ENOENT: no such file or directory, open '/app/worker/.dev.vars'
at Object.openSync (node:fs:573:18)
at Object.readFileSync (node:fs:452:35)
at tryLoadDotEnv (/usr/local/lib/node_modules/wrangler/wrangler-dist/cli.js:158864:72)
at loadDotEnv (/usr/local/lib/node_modules/wrangler/wrangler-dist/cli.js:158873:12)
at getVarsForDev (/usr/local/lib/node_modules/wrangler/wrangler-dist/cli.js:197634:18)
at getBindings (/usr/local/lib/node_modules/wrangler/wrangler-dist/cli.js:205523:10)
at getBindingsAndAssetPaths (/usr/local/lib/node_modules/wrangler/wrangler-dist/cli.js:205404:20)
at getDevReactElement (/usr/local/lib/node_modules/wrangler/wrangler-dist/cli.js:205076:40)
at startDev (/usr/local/lib/node_modules/wrangler/wrangler-dist/cli.js:205140:60)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/app/worker/.dev.vars' |
Sorry, I'm not sure what this file is, this should be a wrangler issue, you may need to google it. If wrangler is working on your host, there should be no reason why it doesn't work/need extra files in the container, you might want to check args, workdir, environment variables or something like that. |
mhh okay i was already looking around, but hey i made a lot of progress in my opinion :D And sooner or late it'll work Edit: current help for this is found here: https://discord.com/channels/595317990191398933/1240726123034316942 |
Got it to work (kinda) the website won't load tho gonna look into it later |
@lyc8503 maybe you know what this is, I don't have a clue about GO.
|
Sorry I don't know what this is, I can only tell by the error message that this seems to be a problem with esbuild, how did you come across this error? Also, in Docker containers you may need to listen on 0.0.0.0 before you can use -p for port forwarding. |
AFAIK if there is only -p it defaults to 0.0.0.0 I can provide the wrangler dev command here:
|
I just ran the container with this dockerfile: # Use Node.js 20 Alpine as base image
FROM node:slim
# Create and set the working directory
WORKDIR /app
# Copy the application code to the working directory
COPY ./data /app # ./data is just the whole UptimeFlare Repository
# Install global npm packages and local dependencies
RUN npm install -g npm wrangler
# Create a .env file
RUN touch .env
# Define volume for /app
VOLUME [ "/app" ]
# Expose port 9999
EXPOSE 9999
# Set the default command to run the development server
CMD ["wrangler", "dev", "--local", "-c", "worker/wrangler-dev.toml", "--node-compat", "--port", "9999", "--log-level", "log"] And ran with this command: |
And btw. this was just an info message the .dev.vars file isn't needed, its optional (still no clue what it's used for) |
(sry for the spam btw) Your worker has access to the following bindings:
- KV Namespaces:
- UPTIMEFLARE_STATE: UPTIMEFLARE_STATE
⎔ Starting local server...
✘ [ERROR] service core:user:uptimeflare_worker: Uncaught SyntaxError: Unexpected token 'export'
at null.<anonymous> (index.ts:6)
✘ [ERROR] MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above. This was achieved using I am not really sure how typescript works, but this seems to be the problem. |
index.ts export interface Env {
UPTIMEFLARE_STATE: KVNamespace
} this seems to be the part where the problem occured. I don't know how typescript works but it seems running the export function locally is some sort of error, so maybe adding a check if wrangler is running locally? |
I know this isn't the designed usecase.
But might it be possible to run this inside a docker container?
I would love to help but im not sure how Cloudflare Workers work
The text was updated successfully, but these errors were encountered: