Skip to content

Conversation

@binamkayastha
Copy link
Member

@binamkayastha binamkayastha commented May 11, 2020

Description

Added a new lerna package for documentation with docusaurus. Generally docusaurus creates two folders: docs and website. I decided to extract everything from the website folder into the lerna package.

This is just the boilerplate stuff that doesn't have actual documentation yet.

We might want to consider putting a top level docs folder that is a soft link to packages/documentation/docs. LMK what you think.

What's not working

The commits that are marked WIP (Work in Progress) are the commits that aren't working and I need help to fix

  • The NGINX doesn't work. The /docs command for some reason just routes to the client.
  • The lerna command fails due to some permission issue.

Update siteConfig.js with updated docs folder location.
Remove lerna README.md boilderplate and replace with docusaurus
README.md
Remove lerna boilerplate in package.json and replace with docusaurus
package.json
Update package.json with `"name": "unitednepali-documentation"`

Now docusaurus files are in the lerna /documentation folder instead of
being in the /documentation/website folder.
Delete docusaurus docker-compose.yml file
Modify the Dockerfile and docker-compose.yml to use the new folder
structure instead of the old website folder.
This does not work
Running documentation through docker via the root docker-compose
currently works.
@binamkayastha binamkayastha linked an issue May 11, 2020 that may be closed by this pull request
Copy link
Member

@sonalranjit sonalranjit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably add a simple cypress test to test the docs endpoint to be running

- 35729:35729
volumes:
- './packages/documentation:/documentation'

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should also add a volume mount for ./documentation/node_modules, this is cleaner than copying over the whole folder as you have in the Dockerfile

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you suggesting

  1. remove COPY . /documentation from the Dockerfile
  2. remove ./package/documentation:/documentation from the docker-compose.yaml and add ./documentation/node_modules:/documenation/node_moudles to the docker-compose.yml
  3. Just add ./documenation/node_modules:/documenation/node_modules

Or some other combination of things

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • remove COPY . /documentation
  • add /documentation/node_modules

- unitednepali-server


unitednepali-documentation:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should include a conatiner name, it'll be easier to understand when debugging, because if you don't give a name docker will assign one, which can be hard to keep track of.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohhh that's what that does! Should I add the env_file: docker/.env as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, docker/.env are just to store environment variables to pass on to the container.

dockerfile: Dockerfile
ports:
- 3009:3000
- 35729:35729
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no point exposing the livereload port because you'll have to rebuild the container, if you made changes to the src files in documentation

}

location /docs {
proxy_pass http://unitednepali-documentation:3000;
Copy link
Member

@sonalranjit sonalranjit May 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you just have to add / after 3000, but you'll probably also have to resolve all the static file urls.

Copy link
Member

@sonalranjit sonalranjit May 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you'll have to update baseUrl in siteConfig.js inside docusaurus to match the forwarding endpoint of /docs. you'll have to update the links for all assets to match the that baseUrl unfortunately 😬
facebook/docusaurus#861

# Docusaurus uses the top folder (documentation) to find the docs foler
WORKDIR /documentation

EXPOSE 3000 35729
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think we need to expose the live reload port

# The dockerfile folder has to match the documentation folder name as
# Docusaurus uses the top folder (documentation) to find the docs foler
WORKDIR /documentation

Copy link
Member

@sonalranjit sonalranjit May 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might have to export your node_modules bin to container's $PATH. see the client container's Dockerfile. I think it's needed to get the docusaurus commands i'm not too sure. try it with a clean. if this works then it's fine.

@sonalranjit
Copy link
Member

sonalranjit commented May 11, 2020

npm run start-documentation ran fine for me, not sure what permissions issue you are referring to?

  • You just have to make sure the dependencies are synched, if you updated a package, always run npm run bootstrap after npm install to sync all the npm packages across the different packages managed by lerna

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Docs

3 participants