vicalloy / outline-docker-compose

Install a self-hosted Outline wiki instance in a couple of minutes
BSD 3-Clause "New" or "Revised" License
770 stars 132 forks source link

Unable to Expose to 0.0.0.0 #72

Open 7ekhed opened 10 months ago

7ekhed commented 10 months ago

Hey there,

Thank you so much for this project!! 4 little instructions to install, WAY simpler than the native way!

Currently, I am trying to host this in a container for my local network, however the way this is setup natively:

127.0.0.1:8888

Doesn't allow it to be exposed to my network

Changing the config file to be 0.0.0.0:8888 and 0.0.0.0 port 8888 allows me to get to the User Manager through the /uc/admin page, but going to ipaddress:8888 in my web browser, where Outline should appear, shows a blank dark-themed screen

Is there another way to expose this application to the network?

Thank you!

7ekhed commented 10 months ago

brave_y1lqAHx5hf

7ekhed commented 10 months ago

Update, changing to my local IP works locally (instead of 0.0.0.0:8888, use localip:8888, in my case 10.1.10.100:8888), however I am trying to assign this to a domain @ notes.mydomain.com, and while I can load this on my local net, trying to load on notes.mydomain.com loads the blank page again, while the UC Admin can be accessed just fine

I've got an NGINX proxy manager on a different server that is pointing back to this instance

giovannipollo commented 10 months ago

I'm trying to do exatcly the same. Have you found a solution to this? Thanks

Codename-11 commented 9 months ago

Bump

hardingCheng commented 9 months ago

这个问题我也遇到了 但是,这个nginx代理就会出问题。外网访问 ,但是无法绑定域名。

7ekhed commented 9 months ago

I found how to fix this,

Combined with the resolution in here of adding user: 0:0 // add this line <---------------------------- This line does not exist, add it to wk-outline in the Docker Compose and what I'm about to post here, this should work for you all, too

FULL STEPS OF HOW I SET THIS UP (scroll down to the code chunks to see the config.sh configs): ~~

Create an Ubuntu / Debian Container / VM

Install Updates and Upgrades

Install Docker, Make, and Nano

Clone the Git

Clone the config.sh from scripts/config.sh.example

Nano the config.sh

Then, “Make Install”

Commands:

Start Off:

cd /

mkdir outlineserverfolder

Apt-get update && apt-get upgrade -y

Apt install make && apt install nano

Install Docker:

apt-get install ca-certificates curl gnupg

install -m 0755 -d /etc/apt/keyrings

curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

sudo chmod a+r /etc/apt/keyrings/docker.gpg

echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

apt-get update

apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-compose

Install Outline from Github:

outline-docker-compose-master.zipcd directory/where/outlinedata/is/stored (/outlineserverfolder in this case)

git clone https://github.com/vicalloy/outline-docker-compose.git

cd outline-docker-compose

cp /scripts/config.sh.sample scripts/config.sh

nano scripts/config.sh

OutlineConfig: URL= (PublicFacingURL:PublicFacingPort[PORT REQUIRED!])notes.mydomain.com:443 PORT= 3000

NginxConfig: URL=0.0.0.0 (Ties Nginx Container to the Host IP) PORT = 8888

CTRL + O to save, CTRL + X to exit nano

Run the MakeFile to Install and Setup the Server:

make install

Other Commands:

docker ps ~ Will show Docker Containers

docker exec -it /bin/bash ~ executes /bin/bash on container, CTRL+P+Q to exit

make install ~ Installs and Sets Up the server

make start ~ Starts all associated containers

make stop ~ Stops all associated containers

make clean ~ Clears data from all containers make clean-data ~ Clears All Container .env Variables and All Container Data, also Deletes Containers

Notes regarding- Outline Config: URL = PublicFacingURL:PublicFacingPort

The URL and domain that you are using to host this with the port of the site. Essentially, if you host this at notes.yourdomain.com via cloudflare, and you’re pointing it back to an NGINX proxy, the service itself will host on the NginxConfig host, 0.0.0.0, and is accessible via port 8888, so redirect from notes.yourdomain.com to the IP Address of the Outline host on port 8888, ensure 443 and 80 are open in your firewall, and in the configuration, when it is asking for the OutlineConfig URL, ensure that you list both the domain URL and the port utilized (if using HTTP, port 80, if HTTPS, port 443) in the Outline Config, the port is a required element

How this is setup:

Docker Host: 192.168.1.100

Config File:

                OutlineSection ~ URL: notes.mydomain.com:443 PORT: 3000

                NginxSection    ~ URL: 0.0.0.0 PORT: 8888

                Leave the Rest Alone

Nginx Proxy Manager: Add a HTTP Redirection Host to 192.168.1.100:8888 from notes.mydomain.com

               WebSocket Support + Block Common Exploits + Cache
               SSL > Request New SSL Certificate

Firewall(s):

              NAT Forward port 80/443 to Nginx Proxy Manager

              If multiple firewalls / routers / layers to network, push port through to each until host reached

Access:

             For Internal Useage / Testing, 192.168.1.100:8888 will get to the site

             For Public Access / Useage, notes.mydomain.com should get to the site

             For User Management, 192.168.1.100:8888/uc/admin/auth/user/

                            NOTE: USER MUST HAVE LISTED EMAIL ADDRESS OR SIGN-IN WILL FAIL

In this current state, photos will fail to upload anywhere. Within the docker-compose.yml,

  wk-outline:
    image: outlinewiki/outline:${OUTLINE_VERSION}
    command: sh -c "yarn db:migrate --env production-ssl-disabled && yarn start"
    environment:
      - DATABASE_URL=postgres://user:pass@wk-postgres:5432/outline
      - DATABASE_URL_TEST=postgres://user:pass@wk-postgres:5432/outline-test
      - REDIS_URL=redis://wk-redis:6379
      - AWS_S3_UPLOAD_BUCKET_NAME=outline-bucket
    env_file:
      - ./env.outline
      - ./env.oidc
    volumes:
      - ./data/outline:/var/lib/outline/data
    user: 0:0 // add this line <---------------------------- This line does not exist, add it to wk-outline
    restart: unless-stopped
    depends_on:
      - wk-postgres
      - wk-redis
##BEGIN MINIO 
      - wk-minio
##END


I wrote an entire document on Outline for how to host Outline, sorry if the formatting isn't great, but this is basically every step I took

What you'll need to do is set the config.sh outline URL to the PUBLIC FACING URL:443 or :80, depending on if HTTP or HTTPS, if using LetsEncrypt with your NGINX Proxy Manager, set it to your notes.yourdomain.com:443. Leave the PORT option at 3000

Then, for the NGINX config, I have it hosted on 0.0.0.0, to ensure that if you navigate to the local domain, 192.168.1.100:8888, it still works and still redirects fine, so that the 127.0.0.1 cannot access issue is gone, but with the outline url set to notes.yourdomain.com:443 PORT3000 you should be able to redirect through Proxy Manager to it just fine without needing advanced flags or location flags

The only thing I am now working on is blocking access to the /uc/admin site through proxy manager, and though I am struggling to figure that out, this is not an NGINX Proxy Manager Github, so I'll figure that one out

@giovannipollo @Codename-11 @hardingCheng 
7ekhed commented 9 months ago

Please ping me if anyone has issues with understanding that, I just copy pasted from my Outline page

sheepvs5 commented 9 months ago

Thanks it works! Following the documents of @7ekhed , I did the following things.

clone git

git clone https://github.com/vicalloy/outline-docker-compose.git
cd outline-docker-compose
cp scripts/config.sh.sample scripts/config.sh

Change configuration

nano scripts/config.sh

URL=:8888 HTTP_IP=0.0.0.0

Change configuration - 2

nano scripts/templates/docker-compose.yml

volumes:

  • ./data/outline:/var/lib/outline/data user: 0:0 // add this line <---------------------------- This line does not exist, add it to wk-outline restart: unless-stopped

Install and run

make install
pathavyer commented 8 months ago

Anyone has tried this approach with traefik? I tried numbers on configuration to use traefik as reverse proxy but it would only work temporarily then nginx would result in worker process 23 exited with code 0

y3sp3r commented 8 months ago

Thank you all, especially @7ekhed & @sheepvs5 ! I spend several hours to try to fix it. Got it to work now. 🤝🏼