From: nutomic Date: Mon, 9 Mar 2020 16:50:28 +0000 (+0000) Subject: Move volumes into subfolder (ref #474) (#23) X-Git-Url: http://these/git/%7B%60%24%7BwebArchiveUrl%7D/%22%7B%7D/readmes/%7B%7D/%22%7Burl%7D/%24%7Bargs.pageFn.jump%20n%7D?a=commitdiff_plain;h=bf1db428f6cd9611574d09e4a8fd99fee8636e03;p=lemmy.git Move volumes into subfolder (ref #474) (#23) Change ports and container names Move volumes into subfolder (ref #474) Merge pull request #587 from StaticallyTypedRice/patch-2 Clarify that content violating this code of conduct will likely be removed. Clarify that content violating this code of conduct will likely be removed. Lemmy has a general policy of removing any content that violates the rules whenever possible, which is typically a good thing, and I felt it important to mention that in the code of conduct. Co-authored-by: Felix Co-authored-by: Dessalines Co-authored-by: Richie Zhang <12566991+StaticallyTypedRice@users.noreply.github.com> --- diff --git a/.gitignore b/.gitignore index 2c0071a7..d823aaca 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ docker/dev/env_deploy.sh build/ .idea/ ui/src/translations +docker/dev/volumes \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index b350ddbb..5a6c7d67 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -19,7 +19,7 @@ These are the policies for upholding our community’s standards of conduct. If 1. Remarks that violate the Lemmy standards of conduct, including hateful, hurtful, oppressive, or exclusionary remarks, are not allowed. (Cursing is allowed, but never targeting another user, and never in a hateful manner.) 2. Remarks that moderators find inappropriate, whether listed in the code of conduct or not, are also not allowed. -3. Moderators will first respond to such remarks with a warning. +3. Moderators will first respond to such remarks with a warning, at the same time the offending content will likely be removed whenever possible. 4. If the warning is unheeded, the user will be “kicked,” i.e., kicked out of the communication channel to cool off. 5. If the user comes back and continues to make trouble, they will be banned, i.e., indefinitely excluded. 6. Moderators may choose at their discretion to un-ban the user if it was a first offense and they offer the offended party a genuine apology. diff --git a/ansible/templates/config.hjson b/ansible/templates/config.hjson index 42698dfb..c0f387c4 100644 --- a/ansible/templates/config.hjson +++ b/ansible/templates/config.hjson @@ -1,7 +1,7 @@ { database: { password: "{{ postgres_password }}" - host: "lemmy_db" + host: "postgres" } hostname: "{{ domain }}" jwt_secret: "{{ jwt_password }}" diff --git a/ansible/templates/docker-compose.yml b/ansible/templates/docker-compose.yml index bf9aeeb5..57ee142a 100644 --- a/ansible/templates/docker-compose.yml +++ b/ansible/templates/docker-compose.yml @@ -9,31 +9,32 @@ services: volumes: - ./lemmy.hjson:/config/config.hjson:ro depends_on: - - lemmy_db - - lemmy_pictshare + - postgres + - pictshare + - iframely - lemmy_db: + postgres: image: postgres:12-alpine environment: - POSTGRES_USER=lemmy - POSTGRES_PASSWORD={{ postgres_password }} - POSTGRES_DB=lemmy volumes: - - lemmy_db:/var/lib/postgresql/data + - ./volumes/postgres:/var/lib/postgresql/data restart: always - lemmy_pictshare: + pictshare: image: shtripok/pictshare:latest ports: - "127.0.0.1:8537:80" volumes: - - lemmy_pictshare:/usr/share/nginx/html/data + - ./volumes/pictshare:/usr/share/nginx/html/data restart: always - lemmy_iframely: + iframely: image: dogbin/iframely:latest ports: - - "127.0.0.1:8061:8061" + - "127.0.0.1:8061:80" volumes: - ./iframely.config.local.js:/iframely/config.local.js:ro restart: always @@ -42,8 +43,4 @@ services: image: mwader/postfix-relay environment: - POSTFIX_myhostname={{ domain }} - restart: "always" -volumes: - lemmy_db: - lemmy_pictshare: - lemmy_iframely: + restart: "always" \ No newline at end of file diff --git a/docker/dev/docker-compose.yml b/docker/dev/docker-compose.yml index 987be4d5..64ba1db4 100644 --- a/docker/dev/docker-compose.yml +++ b/docker/dev/docker-compose.yml @@ -1,15 +1,16 @@ version: '3.3' services: - lemmy_db: + postgres: image: postgres:12-alpine environment: - POSTGRES_USER=lemmy - POSTGRES_PASSWORD=password - POSTGRES_DB=lemmy volumes: - - lemmy_db:/var/lib/postgresql/data + - ./volumes/postgres:/var/lib/postgresql/data restart: always + lemmy: build: context: ../../ @@ -20,22 +21,22 @@ services: volumes: - ../lemmy.hjson:/config/config.hjson:ro depends_on: - - lemmy_db - lemmy_pictshare: + - postgres + - pictshare + - iframely + + pictshare: image: shtripok/pictshare:latest ports: - "127.0.0.1:8537:80" volumes: - - lemmy_pictshare:/usr/share/nginx/html/data + - ./volumes/pictshare:/usr/share/nginx/html/data restart: always - lemmy_iframely: + + iframely: image: dogbin/iframely:latest ports: - - "127.0.0.1:8061:8061" + - "127.0.0.1:8061:80" volumes: - ../iframely.config.local.js:/iframely/config.local.js:ro restart: always -volumes: - lemmy_db: - lemmy_pictshare: - lemmy_iframely: diff --git a/docker/iframely.config.local.js b/docker/iframely.config.local.js index 5c00cb14..8e8bc21f 100644 --- a/docker/iframely.config.local.js +++ b/docker/iframely.config.local.js @@ -37,7 +37,7 @@ }, */ - port: 8061, //can be overridden by PORT env var + port: 80, //can be overridden by PORT env var host: '0.0.0.0', // Dockers beware. See https://github.com/itteco/iframely/issues/132#issuecomment-242991246 //can be overridden by HOST env var diff --git a/docker/lemmy.hjson b/docker/lemmy.hjson index 55c2f2b7..5a6d1ff1 100644 --- a/docker/lemmy.hjson +++ b/docker/lemmy.hjson @@ -5,7 +5,7 @@ # password to connect to postgres password: "password" # host where postgres is running - host: "lemmy_db" + host: "postgres" # port where postgres can be accessed port: 5432 # name of the postgres database for lemmy diff --git a/docker/prod/docker-compose.yml b/docker/prod/docker-compose.yml index 3e0b8284..bfe4bb8e 100644 --- a/docker/prod/docker-compose.yml +++ b/docker/prod/docker-compose.yml @@ -1,15 +1,16 @@ version: '3.3' services: - lemmy_db: + postgres: image: postgres:12-alpine environment: - POSTGRES_USER=lemmy - POSTGRES_PASSWORD=password - POSTGRES_DB=lemmy volumes: - - lemmy_db:/var/lib/postgresql/data + - ./volumes/postgres:/var/lib/postgresql/data restart: always + lemmy: image: dessalines/lemmy:v0.6.33 ports: @@ -18,22 +19,22 @@ services: volumes: - ./lemmy.hjson:/config/config.hjson:ro depends_on: - - lemmy_db - lemmy_pictshare: + - postgres + - pictshare + - iframely + + pictshare: image: shtripok/pictshare:latest ports: - "127.0.0.1:8537:80" volumes: - - lemmy_pictshare:/usr/share/nginx/html/data + - ./volumes/pictshare:/usr/share/nginx/html/data restart: always - lemmy_iframely: + + iframely: image: dogbin/iframely:latest ports: - - "127.0.0.1:8061:8061" + - "127.0.0.1:8061:80" volumes: - ./iframely.config.local.js:/iframely/config.local.js:ro restart: always -volumes: - lemmy_db: - lemmy_pictshare: - lemmy_iframely: diff --git a/server/src/lib.rs b/server/src/lib.rs index 60addd27..f437c200 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -155,7 +155,7 @@ pub struct IframelyResponse { } pub fn fetch_iframely(url: &str) -> Result { - let fetch_url = format!("http://lemmy_iframely:8061/oembed?url={}", url); + let fetch_url = format!("http://iframely/oembed?url={}", url); let text = chttp::get(&fetch_url)?.text()?; let res: IframelyResponse = serde_json::from_str(&text)?; Ok(res) @@ -169,7 +169,7 @@ pub struct PictshareResponse { pub fn fetch_pictshare(image_url: &str) -> Result { let fetch_url = format!( - "http://lemmy_pictshare/api/geturl.php?url={}", + "http://pictshare/api/geturl.php?url={}", utf8_percent_encode(image_url, NON_ALPHANUMERIC) ); let text = chttp::get(&fetch_url)?.text()?;