Comments (29)
Thanks to you!
from madness.
Its not only assets. Everything in the code assumes /
is the root.
I will take a look, see if it is feasible.
from madness.
The assets where faster to spot in browser developer tools that were called from root /.
Thanks!
from madness.
I think I can make it happen. Will you be able to test it? Are you using the gem version or the Docker version?
from madness.
I think I can test it. I am using the Docker version.
from madness.
Ok - I will prepare a docker edge release shortly.
from madness.
Ok, thanks.
from madness.
I am having some difficulties with testing the new functionality due to how Sinatra works.
In the meantime, there is an edge docker image, which you can test like this:
# Pull the image
$ docker pull dannyben/madness:edge
# Create a madness_edge alias
$ alias madness_edge='docker run --rm -it --user $(id -u):$(id -g) --publish 3000:3000 --volume "$PWD:/app" dannyben/madness:edge'
# Create a .madness.yml file in the root of your documentation dir with this:
base_uri: /docs # or whatever the proxy path is, no trailing slash.
then you should be able to run madness_edge server
and have all documents and assets served from this path.
from madness.
Hi,
I tried to pull the new Docker image but it appears to be missing, shows error of manifest unknown. I checked at Docker Hub but I cannot see the tag.
Regards.
from madness.
You are right. I fixed it now.
from madness.
But wait with the test - I found out it is not ready yet when I started implementing specs.
I will post again when ready.
from madness.
I was trying with some setups in Caddy and was not working yet.
No hurries, whenever you can.
Thanks
from madness.
If you have a simple docker-compose file with a caddy setup, it would be nice if you can share it so I can also test with a proxy.
I only tested without proxy, and never used caddy.
from madness.
Hi, sure.
This compose.yml for both Caddy and Madness:
services:
caddy-md:
image: caddy
container_name: caddy-md
restart: unless-stopped
environment:
- PUID
- PGID
command: caddy run --config "/etc/caddy/Caddyfile" --adapter "caddyfile"
expose:
- "80"
- "443"
ports:
- "80:80"
- "443:443"
volumes:
- ./data:/data
- ./Caddyfile:/etc/caddy/Caddyfile
- ./config:/config
- ./docs:/usr/share/caddy
- ./log:/var/log
markdownserver:
container_name: markdownserver
image: dannyben/madness
volumes: ["./docs:/docs"]
ports: ["3000:3000"] # external port, not required when using reverse proxy
expose: ["3000"] # expose port to internal docker network to be used by the reverse proxy
command: server
This is the Caddyfile:
{
debug
}
(webconf) {
encode gzip
header Permissions-Policy "interest-cohort=()" # Disable FLoC (Google)
}
http://fqdn {
handle /handle_docs/* {
reverse_proxy markdownserver:3000
import webconf
}
handle_path /handle_path_docs/* {
reverse_proxy markdownserver:3000
import webconf
}
route /route_docs/* {
reverse_proxy markdownserver:3000
import webconf
}
route /route_strip_docs/* {
uri strip_prefix /route_strip_docs
reverse_proxy markdownserver:3000
import webconf
}
}
http://subdomain.fqdn {
reverse_proxy markdownserver:3000
import webconf
}
Replace fqdn with your own FQDN of the server or even the IP address, those are without SSL but one of the ideas to use the reverse proxy is to place under SSL, but that will not affect madness.
The file contains a domain plus 4 subpaths, those are different directives of Caddy with uri stripping and ones without but I think that using base_uri in Madness the valid ones will be route_docs and handle, because those maintain the subpath when requesting to the service, but included the others just in case.
You can download the files here:
Caddyfile
compose.yml
from madness.
Ok - I managed to test it with a proxy, using the automated nginx reverse proxy, which I am more familiar with.
I have created a sample repo to demonstrate: https://github.com/DannyBen/dual-madness-sample
Note that the new edge docker uses the /docs
folder to hold the docs, not /app
. I did this so it is the same as the stable madness docker.
More info here
from madness.
Wow - caddy is much less user friendly.
I have implemented with nginx before I saw your caddy config. So, I will skip caddy testing for now, as I see it is working properly with nginx - it should work with caddy if you follow the same principles.
Thanks for sharing in any case.
from madness.
Yes I know it is not the most user friendly reverse proxy.
Of course, keep using nginx that is far more easy. As you say, if it works in nginx then it should work with Caddy.
from madness.
Cool. So I think the implementation is done, I will be waiting for your "real world test" results.
from madness.
So, I can try with Caddy? Pulling latest edge Docker image right?
from madness.
Yes you can.
from madness.
See my example repo, for reference on the important bits (see the docker compose file and the two .madness.yml files).
from madness.
Yes, I was looking at your example repo.
I tried with Caddy and is working as expected, with the handle directive and the base_uri at .madness.yml:
handle /docs/* { reverse_proxy markdownserver:3000 import webconf }
If you want to test anything else with Caddy let me know.
Thanks a lot.
from madness.
Excellent.
Well - this was a bigger change than expected, and involved prepending the prefix URI in:
- Breadcrumbs
- Navigation bar links
- Search
- Assets
It also required completely changing how static assets are served.
So - if you can verify any/all of these are working for you as advertised, it can help in increasing the confidence in this release.
from madness.
Hi.
I've tested for a while and so far no problems found.
Only thing I found and is not related to the application is that when I tried your sample of md files, the TOC file contained the links with / and that when clicking the links it tried to load from root and not from subpath.
The fix was easy, just remove the / from the links at the TOC, leaving the links not starting with / worked perfectly.
from madness.
I am unable to reproduce the problem. TOC - both on-page and the full site generated .md file - received the same treatment of prepended base_uri.
Which one are you talking about?
If you are talking about your own manually generated TOC, then yes - I am not handling any existing links, you will have to prepend the /docs
prefix or make it relative - but I recommend letting madness generate site-wide toc with toc: Table of Contents
in your settings.
from madness.
I mean the file from your sample folder (https://github.com/DannyBen/madness/blob/master/sample/Table%20of%20Contents.md).
So yes, it is a manually created one.
I tried with the madness generated one and it works flawlessly, and yes I will let madness create it.
from madness.
This is not related to that issue, but the Table of Contents that madness generates it is only updated when the container is restarted. I tried to add a subfolder and some more md files TOC only refreshed when restarted the container.
from madness.
Oh - I forgot this sample exists. This is not manually generated, but rather generated with the toc: Table of Contents
option.
But it is understandable that it does not work, since it was generated for a sample without a base_uri.
Ok - I will make a few more tweaks later and release.
from madness.
Version 1.1.0 is released with this change.
Thanks for the suggestion and participation.
from madness.
Related Issues (20)
- Howto set an "alias" in Windows Powershell? HOT 3
- Mobile Search HOT 6
- Support for Obsidian-style [[links]] and information about backlinks HOT 5
- .madness.yml not being read? HOT 2
- Settings cannot take effect HOT 3
- Allow to automatically add a link from every page to the corresponding source file HOT 16
- Create JSON schema for config HOT 6
- Add JSON schema test
- Allow to optionally decouple file and directory names from display names HOT 7
- HTML ids are generated without diacritics and links do not work HOT 9
- An option to highlight a "Note" and "Warning" using blockquote HOT 3
- Docker version 1.1.3 fails to start missing gem HOT 7
- Escape characters in a table HOT 4
- Help ordering file and folder HOT 5
- Markdown files with a name overlapping that of a folder don't open via links HOT 25
- Madness and Github pages HOT 3
- TOC generation (1.1.4) looks inside code blocks HOT 4
- Breadcrumbs are problematic HOT 7
- ToC levels for not autogenerated ToC are not honored HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from madness.