From b851ed48ad92d9d4a5e6ff5a90ef4c38f710df9c Mon Sep 17 00:00:00 2001 From: chimiana Date: Sat, 10 Dec 2022 03:38:55 +0000 Subject: [PATCH 01/15] Corrections to README.md A spelling mistake and remove a docker command that does not work --- README.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index fb7e943d0..f0dd1abb1 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ psql postgres -c "create database calckey with encoding = 'UTF8';" ## 💅 Customize - To add custom CSS for all users, edit `./custom/assets/instance.css`. -- To add static assets (such as images for the splash screen), place them in the `./custom/assets/` directory. They'll then be avaliable on `https://yourinstance.tld/static-assets/filename.ext`. +- To add static assets (such as images for the splash screen), place them in the `./custom/assets/` directory. They'll then be available on `https://yourinstance.tld/static-assets/filename.ext`. - To add custom locales, place them in the `./custom/locales/` directory. If you name your custom locale the same as an existing locale, it will overwrite it. If you give it a unique name, it will be added to the list. Also make sure that the first part of the filename matches the locale you're basing it on. (Example: `en-FOO.yml`) - To update custom assets without rebuilding, just run `yarn run gulp`. @@ -141,10 +141,7 @@ pm2 start "NODE_ENV=production yarn start" --name Calckey ### 🐋 Prebuilt Docker image -```sh -docker pull thatonecalculator/calckey -docker up -d -``` +[thatonecalculator/calckey docker image](https://hub.docker.com/r/thatonecalculator/calckey) at Docker Hub. ### 🐳 Docker Compose From 058a4db835862a7abd7e446d203f83802efcee66 Mon Sep 17 00:00:00 2001 From: chimiana Date: Mon, 12 Dec 2022 01:08:59 +0000 Subject: [PATCH 02/15] Updated autosize dependency to 5.0.2. This fixes #9040 as it was a bug in the dependency. --- packages/client/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/client/package.json b/packages/client/package.json index 9c4b7bd2b..d8d57ddde 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -15,7 +15,7 @@ "@vitejs/plugin-vue": "3.2.0", "@vue/compiler-sfc": "3.2.45", "autobind-decorator": "2.4.0", - "autosize": "5.0.1", + "autosize": "5.0.2", "blurhash": "1.1.5", "broadcast-channel": "4.18.1", "browser-image-resizer": "https://github.com/misskey-dev/browser-image-resizer.git#commit=0380d12c8e736788ea7f4e6e985175521ea7b23c", From 0adf713f85e72292a06c78d52e27cafc04541449 Mon Sep 17 00:00:00 2001 From: chimiana Date: Mon, 12 Dec 2022 01:11:13 +0000 Subject: [PATCH 03/15] Removed tap-highlight-color from style.scsss as it is not a valid css property --- packages/client/src/style.scss | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/client/src/style.scss b/packages/client/src/style.scss index 48babbe2a..033d0b674 100644 --- a/packages/client/src/style.scss +++ b/packages/client/src/style.scss @@ -94,7 +94,6 @@ a { text-decoration: none; cursor: pointer; color: inherit; - tap-highlight-color: transparent; -webkit-tap-highlight-color: transparent; } @@ -103,7 +102,6 @@ a { // } textarea, input { - tap-highlight-color: transparent; -webkit-tap-highlight-color: transparent; } @@ -166,7 +164,6 @@ hr { cursor: pointer; color: inherit; touch-action: manipulation; - tap-highlight-color: transparent; -webkit-tap-highlight-color: transparent; font-size: 1em; font-family: inherit; From e85aa145bbdb2bb070c9d7aa922379a41d17eeb5 Mon Sep 17 00:00:00 2001 From: chimiana Date: Mon, 12 Dec 2022 04:36:22 +0000 Subject: [PATCH 04/15] Added _button class to nav items that were missing it --- packages/client/src/ui/_common_/navbar.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/client/src/ui/_common_/navbar.vue b/packages/client/src/ui/_common_/navbar.vue index 33e818a2f..25a26d3bb 100644 --- a/packages/client/src/ui/_common_/navbar.vue +++ b/packages/client/src/ui/_common_/navbar.vue @@ -29,14 +29,14 @@
- + {{ i18n.ts.controlPanel }} - + {{ i18n.ts.settings }} From 23ce63e49ff1ee2f696b8443121966580fc994d5 Mon Sep 17 00:00:00 2001 From: chimiana Date: Tue, 13 Dec 2022 03:34:18 +0000 Subject: [PATCH 05/15] instance server admin docker-compose files and docs --- docker/config/default_example.yml | 192 ++++++++++++++++++++++++++++++ docker/config/docker_example.env | 4 + docker/docker-compose.yml | 55 +++++++++ 3 files changed, 251 insertions(+) create mode 100644 docker/config/default_example.yml create mode 100644 docker/config/docker_example.env create mode 100644 docker/docker-compose.yml diff --git a/docker/config/default_example.yml b/docker/config/default_example.yml new file mode 100644 index 000000000..c44e350be --- /dev/null +++ b/docker/config/default_example.yml @@ -0,0 +1,192 @@ +#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +# Calckey configuration +#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + +# ┌─────┐ +#───┘ URL └───────────────────────────────────────────────────── + +# Final accessible URL seen by a user. +url: https://example.tld/ + +# ONCE YOU HAVE STARTED THE INSTANCE, DO NOT CHANGE THE +# URL SETTINGS AFTER THAT! + +# ┌───────────────────────┐ +#───┘ Port and TLS settings └─────────────────────────────────── + +# +# Misskey requires a reverse proxy to support HTTPS connections. +# +# +----- https://example.tld/ ------------+ +# +------+ |+-------------+ +----------------+| +# | User | ---> || Proxy (443) | ---> | Misskey (3000) || +# +------+ |+-------------+ +----------------+| +# +---------------------------------------+ +# +# You need to set up a reverse proxy. (e.g. nginx) +# An encrypted connection with HTTPS is highly recommended +# because tokens may be transferred in GET requests. + +# The port that your Misskey server should listen on. +port: 3000 + +# ┌──────────────────────────┐ +#───┘ PostgreSQL configuration └──────────────────────────────── + +db: + host: calckey_db_1 # replace with your db container name + port: 5432 + + # Database name + db: calckey + + # Auth + user: example-calckey-user + pass: example-calckey-pass + + # Whether disable Caching queries + #disableCache: true + + # Extra Connection options + #extra: + # ssl: true + +# ┌─────────────────────┐ +#───┘ Redis configuration └───────────────────────────────────── + +redis: + host: calckey_redis_1 # replace with your redis container name + port: 6379 + #family: 0 # 0=Both, 4=IPv4, 6=IPv6 + #pass: example-pass + #prefix: example-prefix + #db: 1 + +# ┌─────────────────────────────┐ +#───┘ Elasticsearch configuration └───────────────────────────── + +#elasticsearch: +# host: localhost # replace with your elasticsearch container name +# port: 9200 +# ssl: false +# user: +# pass: + +# ┌───────────────┐ +#───┘ ID generation └─────────────────────────────────────────── + +# You can select the ID generation method. +# You don't usually need to change this setting, but you can +# change it according to your preferences. + +# Available methods: +# aid ... Short, Millisecond accuracy +# meid ... Similar to ObjectID, Millisecond accuracy +# ulid ... Millisecond accuracy +# objectid ... This is left for backward compatibility + +# ONCE YOU HAVE STARTED THE INSTANCE, DO NOT CHANGE THE +# ID SETTINGS AFTER THAT! + +id: 'aid' + +# ┌─────────────────────┐ +#───┘ Other configuration └───────────────────────────────────── + +# Whether disable HSTS +#disableHsts: true + +# Number of worker processes +#clusterLimit: 1 + +# Job concurrency per worker +# deliverJobConcurrency: 128 +# inboxJobConcurrency: 16 + +# Job rate limiter +# deliverJobPerSec: 128 +# inboxJobPerSec: 16 + +# Job attempts +# deliverJobMaxAttempts: 12 +# inboxJobMaxAttempts: 8 + +# IP address family used for outgoing request (ipv4, ipv6 or dual) +#outgoingAddressFamily: ipv4 + +# Syslog option +#syslog: +# host: localhost +# port: 514 + +# Proxy for HTTP/HTTPS +#proxy: http://127.0.0.1:3128 + +#proxyBypassHosts: [ +# 'example.com', +# '192.0.2.8' +#] + +# Proxy for SMTP/SMTPS +#proxySmtp: http://127.0.0.1:3128 # use HTTP/1.1 CONNECT +#proxySmtp: socks4://127.0.0.1:1080 # use SOCKS4 +#proxySmtp: socks5://127.0.0.1:1080 # use SOCKS5 + +# Media Proxy +#mediaProxy: https://example.com/proxy + +# Proxy remote files (default: false) +#proxyRemoteFiles: true + +#allowedPrivateNetworks: [ +# '127.0.0.1/32' +#] + +# Upload or download file size limits (bytes) +#maxFileSize: 262144000 + +# Managed hosting settings +# !!!!!!!!!! +# >>>>>> NORMAL SELF-HOSTERS, STAY AWAY! <<<<<< +# >>>>>> YOU DON'T NEED THIS! <<<<<< +# !!!!!!!!!! +# Each category is optional, but if each item in each category is mandatory! +# If you mess this up, that's on you, you've been warned... + +#maxUserSignups: 100 +#isManagedHosting: true +#deepl: +# managed: true +# authKey: '' +# isPro: false +# +#email: +# managed: true +# address: 'example@email.com' +# host: 'email.com' +# port: 587 +# user: 'example@email.com' +# pass: '' +# useImplicitSslTls: false +# +#objectStorage: +# managed: true +# baseUrl: '' +# bucket: '' +# prefix: '' +# endpoint: '' +# region: '' +# accessKey: '' +# secretKey: '' +# useSsl: true +# connnectOverProxy: false +# setPublicReadOnUpload: true +# s3ForcePathStyle: true + +# !!!!!!!!!! +# >>>>>> AGAIN, NORMAL SELF-HOSTERS, STAY AWAY! <<<<<< +# >>>>>> YOU DON'T NEED THIS, ABOVE SETTINGS ARE FOR MANAGED HOSTING ONLY! <<<<<< +# !!!!!!!!!! + +# Seriously. Do NOT fill out the above settings if you're self-hosting. +# They're much better off being set from the control panel. diff --git a/docker/config/docker_example.env b/docker/config/docker_example.env new file mode 100644 index 000000000..fdd7e3108 --- /dev/null +++ b/docker/config/docker_example.env @@ -0,0 +1,4 @@ +# db settings +POSTGRES_PASSWORD=example-calckey-pass +POSTGRES_USER=example-calckey-user +POSTGRES_DB=calckey diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 000000000..826a239ee --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,55 @@ +version: "3" + +services: + web: + image: docker.io/thatonecalculator/calckey + restart: unless-stopped + depends_on: + - db + - redis +# - es + ports: + - "3000:3000" + networks: + - calcnet +# - web + environment: + NODE_ENV: production + volumes: + - ./files:/calckey/files + - ./config:/calckey/.config:ro + + redis: + restart: unless-stopped + image: docker.io/redis:7.0-alpine + networks: + - calcnet + volumes: + - ./redis:/data + + db: + restart: unless-stopped + image: docker.io/postgres:12.2-alpine + networks: + - calcnet + env_file: + - config/docker.env + volumes: + - ./db:/var/lib/postgresql/data + +# es: +# restart: unless-stopped +# image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.4.2 +# environment: +# - "ES_JAVA_OPTS=-Xms512m -Xmx512m" +# - "TAKE_FILE_OWNERSHIP=111" +# networks: +# - calcnet +# volumes: +# - ./elasticsearch:/usr/share/elasticsearch/data + +networks: + calcnet: + # web: + # external: + # name: web From 20be880f517f2935024b83e67ffb32c7e0ab1db5 Mon Sep 17 00:00:00 2001 From: chimiana Date: Tue, 13 Dec 2022 03:41:49 +0000 Subject: [PATCH 06/15] Added README.md to docker/ with instructions on running a server instance with docker-compose --- docker/README.md | 71 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 docker/README.md diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 000000000..d4ef1c117 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,71 @@ +# Running a Calckey instance with Docker +It is simple to run an instance of calckey with docker and docker-compose - you can be running your own *fedi* server in no time. + +## Pre-built docker container +[thatonecalculator/calckey](https://hub.docker.com/r/thatonecalculator/calckey) +## docker-compose +You can find a `docker-compose.yml` file in the same folder as this `README`, along with a folder called `config` containing two **example** files needed to get the instance running: +- config/docker.env (**db config settings**) +- config/default.yml (**calckey instance settings**) + +## configuring calckey + +Rename the files: + +`mv config/default_example.yml default.yml` + +`mv config/docker_example.env docker.env` + +then edit them according to your environment. +You can configure `docker.env` with anything you like, but you will have to pay attention to the `default.yml` file: +- `url` should be set to the URL you will be hosting the web interface for the instance at. +- `host`, `db`, `user`, `pass` will have to be configured in the PostgreSQL configuration section - `host` is the name of the postgres container (eg: *calckey_db_1*), and the others should match your `docker.env`. +- `host`will need to be configured in the *Redis configuration* section - it is the name of the redis container (eg: *calckey_redis_1*) + +Everything else can be left as-is; unless you are setting up elasticsearch. More on this below. +## Running docker-compose +This will take some time. The [prebuilt container for calckey](https://hub.docker.com/r/thatonecalculator/calckey) is fairly large, and may take a few minutes to download and extract using docker. + +Copy `docker-compose.yml` and the `config/` to the directory from which you intend to run your instance, and then from that directory run the **docker-compose** command: +`docker-compose up -d`. + +This will take some time to come fully online, even after download and extracting the container images, and it may emit some error messages before completing successfully. Specifically, the `db` container needs to initialize and so isn't available to the `web` container right away. Only once the `db` container comes online does the `web` container start building and initializing the calckey tables. + +Once the instance is up you can use a web browser to access the web interface at `http://serverip:3000` (where `serverip` is the IP of the server you are running the calckey instance on). + +## Securing your instance with a reverse proxy +On its own *calckey* serves itself with HTTP, and does not support SSL. In order to support encrypted connections via HTTPS - an absolute necessity if you intend to host an instance accessible from the public internet - you need to add a reverse proxy to your setup. +### Adding reverse proxy container +Only [swag](https://hub.docker.com/r/linuxserver/swag) has been tested, but a similar setup should be possible with [caddy](https://hub.docker.com/_/caddy), or [traefik](https://hub.docker.com/_/traefik) or a bare metal `nginx` install. +- Follow the instructions at [https://github.com/linuxserver/docker-swag](https://github.com/linuxserver/docker-swag) to set up a separate `swag` container. +- Add a second shared external docker network for the `calckey` and `swag` containers to talk to each other, ensure both are connected to it via their respective `docker-compose.yml` files. +- configure `/config/nginx/proxy-confs/calckey.subdomain.conf` with the following: +``` +server { + listen 443 ssl; + listen [::]:443 ssl; + server_name yourdomain.whatever; + include /config/nginx/ssl.conf; + client_max_body_size 0; + + location / { + include /config/nginx/proxy.conf; + include /config/nginx/resolver.conf; + set $upstream_app chimkey_web_1; + set $upstream_port 3000; + set $upstream_proto http; + proxy_pass $upstream_proto://$upstream_app:$upstream_port; + + } +} +``` +Note: Make sure you set `server_name` in the above to your domain. + +Once you bring up both the `swag` reverse proxy container with the above configuration, and the `calckey` containers, you should be serving your instance and be able to browse to it at `https://yourdomain.whatever`. + +## Enabling elasticsearch +If you decide to enable `elasticsearch`, you can uncomment the configuration lines for it in the `docker-compose.yml`, but you will also need to configure the `Elasticsearch configuration` section of the `config/default.yml`. + +This is disabled by default, as it uses a great deal of server memory and can increase the load for your instance significantly. It is unlikely that you will need to enable this for a small server, and if you are running a giant server then you probably do not need this `README` to begin with. + +## Enjoy being a fediverse server admin \ No newline at end of file From 08b727874f242a6db5849821e01939e3ec2fa638 Mon Sep 17 00:00:00 2001 From: chimiana Date: Tue, 13 Dec 2022 03:47:29 +0000 Subject: [PATCH 07/15] Fixed error in swag configuration stanza --- docker/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/README.md b/docker/README.md index d4ef1c117..23a23575e 100644 --- a/docker/README.md +++ b/docker/README.md @@ -51,7 +51,7 @@ server { location / { include /config/nginx/proxy.conf; include /config/nginx/resolver.conf; - set $upstream_app chimkey_web_1; + set $upstream_app calckey_web_1; set $upstream_port 3000; set $upstream_proto http; proxy_pass $upstream_proto://$upstream_app:$upstream_port; @@ -59,7 +59,7 @@ server { } } ``` -Note: Make sure you set `server_name` in the above to your domain. +Note: Make sure you set `server_name` in the above to your domain, and `$upstream_app` to the name for your calckey container. Once you bring up both the `swag` reverse proxy container with the above configuration, and the `calckey` containers, you should be serving your instance and be able to browse to it at `https://yourdomain.whatever`. @@ -68,4 +68,4 @@ If you decide to enable `elasticsearch`, you can uncomment the configuration lin This is disabled by default, as it uses a great deal of server memory and can increase the load for your instance significantly. It is unlikely that you will need to enable this for a small server, and if you are running a giant server then you probably do not need this `README` to begin with. -## Enjoy being a fediverse server admin \ No newline at end of file +## Enjoy being a fediverse server admin From d4f8ba118ae9c6228adc8133da870f9d381eebf4 Mon Sep 17 00:00:00 2001 From: chimiana Date: Tue, 13 Dec 2022 04:22:39 +0000 Subject: [PATCH 08/15] Made the docs much shorter --- docker/README.md | 48 +++++++----------------------------------------- 1 file changed, 7 insertions(+), 41 deletions(-) diff --git a/docker/README.md b/docker/README.md index 23a23575e..c782a4105 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,5 +1,4 @@ # Running a Calckey instance with Docker -It is simple to run an instance of calckey with docker and docker-compose - you can be running your own *fedi* server in no time. ## Pre-built docker container [thatonecalculator/calckey](https://hub.docker.com/r/thatonecalculator/calckey) @@ -19,53 +18,20 @@ Rename the files: then edit them according to your environment. You can configure `docker.env` with anything you like, but you will have to pay attention to the `default.yml` file: - `url` should be set to the URL you will be hosting the web interface for the instance at. -- `host`, `db`, `user`, `pass` will have to be configured in the PostgreSQL configuration section - `host` is the name of the postgres container (eg: *calckey_db_1*), and the others should match your `docker.env`. +- `host`, `db`, `user`, `pass` will have to be configured in the `PostgreSQL configuration` section - `host` is the name of the postgres container (eg: *calckey_db_1*), and the others should match your `docker.env`. - `host`will need to be configured in the *Redis configuration* section - it is the name of the redis container (eg: *calckey_redis_1*) -Everything else can be left as-is; unless you are setting up elasticsearch. More on this below. -## Running docker-compose -This will take some time. The [prebuilt container for calckey](https://hub.docker.com/r/thatonecalculator/calckey) is fairly large, and may take a few minutes to download and extract using docker. +Everything else can be left as-is. -Copy `docker-compose.yml` and the `config/` to the directory from which you intend to run your instance, and then from that directory run the **docker-compose** command: +## Running docker-compose +The [prebuilt container for calckey](https://hub.docker.com/r/thatonecalculator/calckey) is fairly large, and may take a few minutes to download and extract using docker. + +Copy `docker-compose.yml` and the `config/` to a directory, then run the **docker-compose** command: `docker-compose up -d`. -This will take some time to come fully online, even after download and extracting the container images, and it may emit some error messages before completing successfully. Specifically, the `db` container needs to initialize and so isn't available to the `web` container right away. Only once the `db` container comes online does the `web` container start building and initializing the calckey tables. +NOTE: This will take some time to come fully online, even after download and extracting the container images, and it may emit some error messages before completing successfully. Specifically, the `db` container needs to initialize and so isn't available to the `web` container right away. Only once the `db` container comes online does the `web` container start building and initializing the calckey tables. Once the instance is up you can use a web browser to access the web interface at `http://serverip:3000` (where `serverip` is the IP of the server you are running the calckey instance on). ## Securing your instance with a reverse proxy On its own *calckey* serves itself with HTTP, and does not support SSL. In order to support encrypted connections via HTTPS - an absolute necessity if you intend to host an instance accessible from the public internet - you need to add a reverse proxy to your setup. -### Adding reverse proxy container -Only [swag](https://hub.docker.com/r/linuxserver/swag) has been tested, but a similar setup should be possible with [caddy](https://hub.docker.com/_/caddy), or [traefik](https://hub.docker.com/_/traefik) or a bare metal `nginx` install. -- Follow the instructions at [https://github.com/linuxserver/docker-swag](https://github.com/linuxserver/docker-swag) to set up a separate `swag` container. -- Add a second shared external docker network for the `calckey` and `swag` containers to talk to each other, ensure both are connected to it via their respective `docker-compose.yml` files. -- configure `/config/nginx/proxy-confs/calckey.subdomain.conf` with the following: -``` -server { - listen 443 ssl; - listen [::]:443 ssl; - server_name yourdomain.whatever; - include /config/nginx/ssl.conf; - client_max_body_size 0; - - location / { - include /config/nginx/proxy.conf; - include /config/nginx/resolver.conf; - set $upstream_app calckey_web_1; - set $upstream_port 3000; - set $upstream_proto http; - proxy_pass $upstream_proto://$upstream_app:$upstream_port; - - } -} -``` -Note: Make sure you set `server_name` in the above to your domain, and `$upstream_app` to the name for your calckey container. - -Once you bring up both the `swag` reverse proxy container with the above configuration, and the `calckey` containers, you should be serving your instance and be able to browse to it at `https://yourdomain.whatever`. - -## Enabling elasticsearch -If you decide to enable `elasticsearch`, you can uncomment the configuration lines for it in the `docker-compose.yml`, but you will also need to configure the `Elasticsearch configuration` section of the `config/default.yml`. - -This is disabled by default, as it uses a great deal of server memory and can increase the load for your instance significantly. It is unlikely that you will need to enable this for a small server, and if you are running a giant server then you probably do not need this `README` to begin with. - -## Enjoy being a fediverse server admin From c1ae61551e6d7c03a42d8ef8f420da4db765cd9a Mon Sep 17 00:00:00 2001 From: chimiana Date: Tue, 13 Dec 2022 04:32:12 +0000 Subject: [PATCH 09/15] Moved dev docker-compose.yml to dev/, instance admin docker-compose.yml to /, removed new example files, moved docs to root and adjusted them to reflect file changes --- {docker => dev}/docker-compose.yml | 33 ++--- docker/README.md => docker-README.md | 10 +- docker-compose.yml | 33 +++-- docker/config/default_example.yml | 192 --------------------------- docker/config/docker_example.env | 4 - 5 files changed, 38 insertions(+), 234 deletions(-) rename {docker => dev}/docker-compose.yml (58%) rename docker/README.md => docker-README.md (86%) delete mode 100644 docker/config/default_example.yml delete mode 100644 docker/config/docker_example.env diff --git a/docker/docker-compose.yml b/dev/docker-compose.yml similarity index 58% rename from docker/docker-compose.yml rename to dev/docker-compose.yml index 826a239ee..f9b64e75c 100644 --- a/docker/docker-compose.yml +++ b/dev/docker-compose.yml @@ -3,7 +3,8 @@ version: "3" services: web: image: docker.io/thatonecalculator/calckey - restart: unless-stopped + build: . + restart: always depends_on: - db - redis @@ -11,45 +12,39 @@ services: ports: - "3000:3000" networks: - - calcnet -# - web - environment: - NODE_ENV: production + - network volumes: - ./files:/calckey/files - - ./config:/calckey/.config:ro + - ./.config:/calckey/.config:ro redis: - restart: unless-stopped + restart: always image: docker.io/redis:7.0-alpine networks: - - calcnet + - network volumes: - ./redis:/data db: - restart: unless-stopped + restart: always image: docker.io/postgres:12.2-alpine networks: - - calcnet + - network env_file: - - config/docker.env + - .config/docker.env volumes: - ./db:/var/lib/postgresql/data # es: -# restart: unless-stopped -# image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.4.2 -# environment: +# restart: always +# image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.4.2 +# environment: # - "ES_JAVA_OPTS=-Xms512m -Xmx512m" # - "TAKE_FILE_OWNERSHIP=111" # networks: -# - calcnet +# - network # volumes: # - ./elasticsearch:/usr/share/elasticsearch/data networks: - calcnet: - # web: - # external: - # name: web + network: diff --git a/docker/README.md b/docker-README.md similarity index 86% rename from docker/README.md rename to docker-README.md index c782a4105..a38f784c1 100644 --- a/docker/README.md +++ b/docker-README.md @@ -3,17 +3,17 @@ ## Pre-built docker container [thatonecalculator/calckey](https://hub.docker.com/r/thatonecalculator/calckey) ## docker-compose -You can find a `docker-compose.yml` file in the same folder as this `README`, along with a folder called `config` containing two **example** files needed to get the instance running: -- config/docker.env (**db config settings**) -- config/default.yml (**calckey instance settings**) +You can find a `docker-compose.yml` file in the same folder as this `README`, along with a folder called `.config` containing two **example** files needed to get the instance running: +- .config/docker.env (**db config settings**) +- .config/default.yml (**calckey instance settings**) ## configuring calckey Rename the files: -`mv config/default_example.yml default.yml` +`mv .config/default_example.yml .config/default.yml` -`mv config/docker_example.env docker.env` +`mv .config/docker_example.env .config/docker.env` then edit them according to your environment. You can configure `docker.env` with anything you like, but you will have to pay attention to the `default.yml` file: diff --git a/docker-compose.yml b/docker-compose.yml index f9b64e75c..826a239ee 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,8 +3,7 @@ version: "3" services: web: image: docker.io/thatonecalculator/calckey - build: . - restart: always + restart: unless-stopped depends_on: - db - redis @@ -12,39 +11,45 @@ services: ports: - "3000:3000" networks: - - network + - calcnet +# - web + environment: + NODE_ENV: production volumes: - ./files:/calckey/files - - ./.config:/calckey/.config:ro + - ./config:/calckey/.config:ro redis: - restart: always + restart: unless-stopped image: docker.io/redis:7.0-alpine networks: - - network + - calcnet volumes: - ./redis:/data db: - restart: always + restart: unless-stopped image: docker.io/postgres:12.2-alpine networks: - - network + - calcnet env_file: - - .config/docker.env + - config/docker.env volumes: - ./db:/var/lib/postgresql/data # es: -# restart: always -# image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.4.2 -# environment: +# restart: unless-stopped +# image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.4.2 +# environment: # - "ES_JAVA_OPTS=-Xms512m -Xmx512m" # - "TAKE_FILE_OWNERSHIP=111" # networks: -# - network +# - calcnet # volumes: # - ./elasticsearch:/usr/share/elasticsearch/data networks: - network: + calcnet: + # web: + # external: + # name: web diff --git a/docker/config/default_example.yml b/docker/config/default_example.yml deleted file mode 100644 index c44e350be..000000000 --- a/docker/config/default_example.yml +++ /dev/null @@ -1,192 +0,0 @@ -#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ -# Calckey configuration -#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - -# ┌─────┐ -#───┘ URL └───────────────────────────────────────────────────── - -# Final accessible URL seen by a user. -url: https://example.tld/ - -# ONCE YOU HAVE STARTED THE INSTANCE, DO NOT CHANGE THE -# URL SETTINGS AFTER THAT! - -# ┌───────────────────────┐ -#───┘ Port and TLS settings └─────────────────────────────────── - -# -# Misskey requires a reverse proxy to support HTTPS connections. -# -# +----- https://example.tld/ ------------+ -# +------+ |+-------------+ +----------------+| -# | User | ---> || Proxy (443) | ---> | Misskey (3000) || -# +------+ |+-------------+ +----------------+| -# +---------------------------------------+ -# -# You need to set up a reverse proxy. (e.g. nginx) -# An encrypted connection with HTTPS is highly recommended -# because tokens may be transferred in GET requests. - -# The port that your Misskey server should listen on. -port: 3000 - -# ┌──────────────────────────┐ -#───┘ PostgreSQL configuration └──────────────────────────────── - -db: - host: calckey_db_1 # replace with your db container name - port: 5432 - - # Database name - db: calckey - - # Auth - user: example-calckey-user - pass: example-calckey-pass - - # Whether disable Caching queries - #disableCache: true - - # Extra Connection options - #extra: - # ssl: true - -# ┌─────────────────────┐ -#───┘ Redis configuration └───────────────────────────────────── - -redis: - host: calckey_redis_1 # replace with your redis container name - port: 6379 - #family: 0 # 0=Both, 4=IPv4, 6=IPv6 - #pass: example-pass - #prefix: example-prefix - #db: 1 - -# ┌─────────────────────────────┐ -#───┘ Elasticsearch configuration └───────────────────────────── - -#elasticsearch: -# host: localhost # replace with your elasticsearch container name -# port: 9200 -# ssl: false -# user: -# pass: - -# ┌───────────────┐ -#───┘ ID generation └─────────────────────────────────────────── - -# You can select the ID generation method. -# You don't usually need to change this setting, but you can -# change it according to your preferences. - -# Available methods: -# aid ... Short, Millisecond accuracy -# meid ... Similar to ObjectID, Millisecond accuracy -# ulid ... Millisecond accuracy -# objectid ... This is left for backward compatibility - -# ONCE YOU HAVE STARTED THE INSTANCE, DO NOT CHANGE THE -# ID SETTINGS AFTER THAT! - -id: 'aid' - -# ┌─────────────────────┐ -#───┘ Other configuration └───────────────────────────────────── - -# Whether disable HSTS -#disableHsts: true - -# Number of worker processes -#clusterLimit: 1 - -# Job concurrency per worker -# deliverJobConcurrency: 128 -# inboxJobConcurrency: 16 - -# Job rate limiter -# deliverJobPerSec: 128 -# inboxJobPerSec: 16 - -# Job attempts -# deliverJobMaxAttempts: 12 -# inboxJobMaxAttempts: 8 - -# IP address family used for outgoing request (ipv4, ipv6 or dual) -#outgoingAddressFamily: ipv4 - -# Syslog option -#syslog: -# host: localhost -# port: 514 - -# Proxy for HTTP/HTTPS -#proxy: http://127.0.0.1:3128 - -#proxyBypassHosts: [ -# 'example.com', -# '192.0.2.8' -#] - -# Proxy for SMTP/SMTPS -#proxySmtp: http://127.0.0.1:3128 # use HTTP/1.1 CONNECT -#proxySmtp: socks4://127.0.0.1:1080 # use SOCKS4 -#proxySmtp: socks5://127.0.0.1:1080 # use SOCKS5 - -# Media Proxy -#mediaProxy: https://example.com/proxy - -# Proxy remote files (default: false) -#proxyRemoteFiles: true - -#allowedPrivateNetworks: [ -# '127.0.0.1/32' -#] - -# Upload or download file size limits (bytes) -#maxFileSize: 262144000 - -# Managed hosting settings -# !!!!!!!!!! -# >>>>>> NORMAL SELF-HOSTERS, STAY AWAY! <<<<<< -# >>>>>> YOU DON'T NEED THIS! <<<<<< -# !!!!!!!!!! -# Each category is optional, but if each item in each category is mandatory! -# If you mess this up, that's on you, you've been warned... - -#maxUserSignups: 100 -#isManagedHosting: true -#deepl: -# managed: true -# authKey: '' -# isPro: false -# -#email: -# managed: true -# address: 'example@email.com' -# host: 'email.com' -# port: 587 -# user: 'example@email.com' -# pass: '' -# useImplicitSslTls: false -# -#objectStorage: -# managed: true -# baseUrl: '' -# bucket: '' -# prefix: '' -# endpoint: '' -# region: '' -# accessKey: '' -# secretKey: '' -# useSsl: true -# connnectOverProxy: false -# setPublicReadOnUpload: true -# s3ForcePathStyle: true - -# !!!!!!!!!! -# >>>>>> AGAIN, NORMAL SELF-HOSTERS, STAY AWAY! <<<<<< -# >>>>>> YOU DON'T NEED THIS, ABOVE SETTINGS ARE FOR MANAGED HOSTING ONLY! <<<<<< -# !!!!!!!!!! - -# Seriously. Do NOT fill out the above settings if you're self-hosting. -# They're much better off being set from the control panel. diff --git a/docker/config/docker_example.env b/docker/config/docker_example.env deleted file mode 100644 index fdd7e3108..000000000 --- a/docker/config/docker_example.env +++ /dev/null @@ -1,4 +0,0 @@ -# db settings -POSTGRES_PASSWORD=example-calckey-pass -POSTGRES_USER=example-calckey-user -POSTGRES_DB=calckey From 1930c23cd5e9b0708ba8c23cbbef5decf21ac39e Mon Sep 17 00:00:00 2001 From: chimiana Date: Tue, 13 Dec 2022 04:38:46 +0000 Subject: [PATCH 10/15] Fixed issues with relative paths in dev/docker-compose.yml caused by moving it to a subdirectory --- dev/docker-compose.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dev/docker-compose.yml b/dev/docker-compose.yml index f9b64e75c..25c2e9ea9 100644 --- a/dev/docker-compose.yml +++ b/dev/docker-compose.yml @@ -3,7 +3,7 @@ version: "3" services: web: image: docker.io/thatonecalculator/calckey - build: . + build: .. restart: always depends_on: - db @@ -14,8 +14,8 @@ services: networks: - network volumes: - - ./files:/calckey/files - - ./.config:/calckey/.config:ro + - ../files:/calckey/files + - ../.config:/calckey/.config:ro redis: restart: always @@ -23,7 +23,7 @@ services: networks: - network volumes: - - ./redis:/data + - ../redis:/data db: restart: always @@ -31,9 +31,9 @@ services: networks: - network env_file: - - .config/docker.env + - ../.config/docker.env volumes: - - ./db:/var/lib/postgresql/data + - ../db:/var/lib/postgresql/data # es: # restart: always From f8736ebfe07da8320a641a2c59077fa9aed11ae7 Mon Sep 17 00:00:00 2001 From: chimiana Date: Tue, 13 Dec 2022 04:45:48 +0000 Subject: [PATCH 11/15] Updated README.md with link to docker-README.md instead of link to Docker Hub --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f0dd1abb1..6b4259366 100644 --- a/README.md +++ b/README.md @@ -139,12 +139,13 @@ NODE_ENV=production yarn run rebuild && yarn run migrate pm2 start "NODE_ENV=production yarn start" --name Calckey ``` -### 🐋 Prebuilt Docker image +### 🐋 Docker -[thatonecalculator/calckey docker image](https://hub.docker.com/r/thatonecalculator/calckey) at Docker Hub. +[How to run Calckey with Docker](/docker-README.md). ### 🐳 Docker Compose +Shorter version: ```sh docker-compose build docker-compose run --rm web yarn run init From b7477a26fb055a4d4aff92d00a7414ff2b796a49 Mon Sep 17 00:00:00 2001 From: chimiana Date: Tue, 13 Dec 2022 04:48:30 +0000 Subject: [PATCH 12/15] Attempting to fix link in docs --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6b4259366..626d6ed45 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ pm2 start "NODE_ENV=production yarn start" --name Calckey ### 🐋 Docker -[How to run Calckey with Docker](/docker-README.md). +[How to run Calckey with Docker](./docker-README.md). ### 🐳 Docker Compose From badaf776579fd78f201ac115f07a9b37b0029067 Mon Sep 17 00:00:00 2001 From: chimiana Date: Tue, 13 Dec 2022 04:50:15 +0000 Subject: [PATCH 13/15] Tweaks to docker-README.md to reflect its new relative path --- docker-README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-README.md b/docker-README.md index a38f784c1..d6989065a 100644 --- a/docker-README.md +++ b/docker-README.md @@ -11,9 +11,9 @@ You can find a `docker-compose.yml` file in the same folder as this `README`, al Rename the files: -`mv .config/default_example.yml .config/default.yml` +`cp .config/default_example.yml .config/default.yml` -`mv .config/docker_example.env .config/docker.env` +`cp .config/example.env .config/docker.env` then edit them according to your environment. You can configure `docker.env` with anything you like, but you will have to pay attention to the `default.yml` file: From 5aeda4635fbdb058c77fc8048c589ff26f6ef97e Mon Sep 17 00:00:00 2001 From: chimiana Date: Tue, 13 Dec 2022 04:59:02 +0000 Subject: [PATCH 14/15] Update to docker-compose for development section of README --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 626d6ed45..b1c7940c2 100644 --- a/README.md +++ b/README.md @@ -143,10 +143,11 @@ pm2 start "NODE_ENV=production yarn start" --name Calckey [How to run Calckey with Docker](./docker-README.md). -### 🐳 Docker Compose +### 🐳 Docker Compose for Development + -Shorter version: ```sh +cd dev/ docker-compose build docker-compose run --rm web yarn run init docker-compose up -d From a2269955891c47fea1f5f2f08c034421afe79a45 Mon Sep 17 00:00:00 2001 From: chimiana Date: Tue, 13 Dec 2022 07:53:42 +0000 Subject: [PATCH 15/15] Moved 'docker for development' stanza from root README.md to docker-README.md --- README.md | 10 ---------- docker-README.md | 9 +++++++++ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index b1c7940c2..d2386fda6 100644 --- a/README.md +++ b/README.md @@ -143,16 +143,6 @@ pm2 start "NODE_ENV=production yarn start" --name Calckey [How to run Calckey with Docker](./docker-README.md). -### 🐳 Docker Compose for Development - - -```sh -cd dev/ -docker-compose build -docker-compose run --rm web yarn run init -docker-compose up -d -``` - ## 😉 Tips & Tricks - When editing the config file, please don't fill out the settings at the bottom. They're designed *only* for managed hosting, not self hosting. Those settings are much better off being set in Calckey's control panel. diff --git a/docker-README.md b/docker-README.md index d6989065a..cca4c011d 100644 --- a/docker-README.md +++ b/docker-README.md @@ -1,3 +1,12 @@ +# 🐳 Docker Compose for Development + +```sh +cd dev/ +docker-compose build +docker-compose run --rm web yarn run init +docker-compose up -d +``` + # Running a Calckey instance with Docker ## Pre-built docker container