From f2a750f274dd4a7c27b0e8912f32bceff84c0474 Mon Sep 17 00:00:00 2001 From: Jesper Zedlitz Date: Wed, 7 May 2025 17:59:16 +0200 Subject: [PATCH 1/2] added Dockerfile and docker-compose.yml --- Dockerfile | 13 +++++++++++++ docker-compose.yml | 10 ++++++++++ 2 files changed, 23 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f655271 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM node:alpine + +WORKDIR /app +COPY package.json /app/package.json +RUN npm install + +COPY public /app/public +COPY server.js /app/server.js +COPY src /app/src + +RUN npm install +EXPOSE 3000 +ENTRYPOINT ["npm","run","start"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..20460b3 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +services: + + postmarks: + build: . + env_file: .env + ports: + - "127.0.0.1:3000:3000" + volumes: + - ./.data:/app/.data + - ./account.json:/app/account.json:ro From 60b83c50be6aa560bf145b61d25ce838c7cbe2cb Mon Sep 17 00:00:00 2001 From: Jesper Zedlitz Date: Wed, 7 May 2025 17:59:54 +0200 Subject: [PATCH 2/2] hints for usage with Docker --- README.md | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index db75794..a991078 100644 --- a/README.md +++ b/README.md @@ -15,21 +15,30 @@ Check the setup below to understand how to do that! To set your app up: -- If you're using Glitch: +If you're using Glitch: + - Rename your project immediately in the project settings, if you intend to be called something else. This determines the domain that your site lives at, which also determines the second half of your `@username@project-name.glitch.me` identity on the fediverse. NOTE: If you change this later, you will break the connection any existing followers have to your site, they'll have to re-follow the account on its new domain (and depending on the software they're following from, may even prevent them from unfollowing the old URL 😱) - In your `.env` editor, create a key `ADMIN_KEY` and give it a text string as a value. This is your "password" when your browser prompts you, so make it as secure as you need to protect your data. - Add another key to your .env called `SESSION_SECRET` and generate a random string for its value. This is your [session secret](http://expressjs.com/en/resources/middleware/session.html#secret), used to generate the hashed version of your session that gets encoded with the cookies used to store your login. If you make this string too easily guessable, you make it easier for someone to hijack your session and gain unauthorized login. Also, if you ever change this string, it will invalidate all existing cookies. - If you've got a custom domain in front of your Glitch project, add a key to your .env called `PUBLIC_BASE_URL` with the value set to the hostname (the part after the https://) at which you want the project to be accessible. - Edit the contents of `account.json.example` to set your `@username`, display name, bio, and avatar. (If you don't set a username, your default actor name will be 'bookmarks', so people will find you on the fediverse `@bookmarks@project-name.glitch.me`.) - THEN: either rename `account.json.example` to `account.json`, or copy the contents into a new file called `account.json`. Whatever `username` you have in this file when the project first starts you'll need to retain or else you'll break your followers' connection to this account. -- Otherwise: + +Otherwise: - Create a `.env` file in the root of the project. - Add the line `PUBLIC_BASE_URL=` to your .env where \ is the hostname of your instance. - Add the line `ADMIN_KEY=` to your .env where \ is the password you'll enter when the browser prompts you, and another line for `SESSION_SECRET=` where \ is a random string used when hashing your session for use in a secure cookie. - Make a file called `account.json` in the project root. Copy the contents of `account.json.example` into it and edit the values to set your `@username`, display name, bio, and avatar. (If you don't set a username, your default actor name will be 'bookmarks', so people will find you on the fediverse `@bookmarks@project-name.glitch.me`.) -- If you're using Glitch, you should be done! If you're running this yourself, run `npm run start` via whatever mechanism you choose to use to host this website. -- Click on the **Admin** link in the footer, and enter the password (whatever you set ADMIN_KEY to in the .env). -- You should be logged in, at which point you can configure various settings, import bookmarks, and use the "Add" links in the header and footer (as well as the bookmarklet, available in the Admin section) to save new bookmarks. + +If you're using Glitch, you should be done! + +If you are using Docker compose you can run `docker compose up` or `docker-compose up` (depending on the version of Docker you are using) and Postmarks should be running. You can access it at http://localhost:3000 + +Otherwise, run `npm run start` via whatever mechanism you choose to use to host this website. + +Click on the **Admin** link in the footer, and enter the password (whatever you set ADMIN_KEY to in the .env). + +You should be logged in, at which point you can configure various settings, import bookmarks, and use the "Add" links in the header and footer (as well as the bookmarklet, available in the Admin section) to save new bookmarks. ## Mastodon Verification