Giter VIP home page Giter VIP logo

platformsh-docs's Introduction

Platform.sh User Documentation

This repository holds the public user documentation for Platform.sh.

The documentation site (docs.platform.sh) is itself hosted on Platform.sh and built using the powerful Platform.sh build-and-deploy system.

Every pull request (PR) is automatically built on Platform.sh and provided with a link to a fully built environment just for that request. Each PR against the default branch of this repository has a Platform.sh check. Click Details on an open PR to see a fully functional site based on the changes in the PR. (You can have the same functionality for your repository.)

Tools

The documentation site is build using Hugo, a Go static site generator. The build script is rerun on every deploy to produce a fresh static site instance.

The cross-site search in the documentation is built as a separate Platform.sh app from the files in the search directory using Meilisearch.

Contributing

Our documentation is public because we want your help in improving and maintaining it. See our contribution guidelines for how to make changes. All documentation is released under a Creative Commons Attribution license.

If you spot a problem, open a pull request to fix it! If you're not sure how, you can also open an issue and we can look into it.

Running locally

Requires:

  • Hugo >= 0.116.0
  • Node.js >= 16
  • Poetry

Steps

Running locally without search

The documentation and the Meilisearch search service are separate applications. It isn't necessary to run the Meilisearch app to build the docs locally, but if you don't, the search field doesn't appear in the sidebar.

  1. To run the docs alone, clone this repository and install dependencies:

    cd sites/platform # or cd sites/upsun
    npm install
  2. (Optional) The documentation website dynamically fetches example files from various locations.

You can run the site locally without retrieving those example files, keeping in mind that affected sections will display a **Heads up!** The file was not found message. To do so, jump to step 3.

To run the site with all example files retrieved, set a GitHub token as GITHUB_API_TOKEN in your shell. If you’re using the GitHub CLI tool, to avoid including your token’s value in your shell’s history, run the following command:

```bash
export GITHUB_API_TOKEN=$(gh auth token)
```
  1. To have Node update the registry and retrieve all the necessary example files (if applicable), run the following command:

    npm run dev
  2. Then build the site:

    hugo serve

Running locally with search

In addition to the above requirements, search also requires:

A development script using npm-run-all has been defined to run both applications simultaneously.

After cloning the repository, run the following command in your terminal:

npm run develop

Running tests locally

Before pushing, please duplicate the test suite locally by running:

npm run test -- platform
# OR
npm run test -- upsun

depending on which set of docs you've contributed to.

Cache of static assets

Given that the website itself isn't updated so often, static assets on the site such as CSS and JavaScript files have a long cache period set. If you are making a change to such files, bust the cache so users aren't served out-of-date files.

To clear the cache, update the version in docs/config/_default/params.yaml.

Managing white label documentation

Adding a white label documentation

To add a white label documentation using its own logo, styles, and wording, add a new white label folder in the sites/ directory.

Add all the files that differ from the main documentation site (sites/platform/src/ directory) to that white label folder. Make sure you keep the same file structure as in the existing sites/platform/src/ directory.

sites
├── whitelabel_name
│   ├── config
│   │   └── _defaults
│   │       ├── config.yaml <- white label configuration
│   │       └── params.yaml <- settings for vendorization and other features
│   ├── layouts     <- Layout of the white label website
│   ├── src         <- pages
│   ├── static      <- static files
│   ├── utils       <- Hugo scripts
│   └── ...         <- index.js and other Hugo files
└── platform <- main doc pages

sites/platform/src/ is the main documentation site and, by default, each white label site inherits data from it. To ensure that the changes you make to files in your white label folder are taken into account, you need to exclude the original page(s) or section located in sites/platform/src/ from the build.

For example, if you make changes to the sites/whitelabeldoc/src/overview.md file, add the following configuration in your sites/whitelabel_name/config/_default/config.yaml file:

module:
    _merge: deep
    mounts:
        - source: "../platform/src"
          target: "content"
          excludeFiles:
              - "overview.md"

Similarly, if you makes changes to all the pages in the create-apps section, add the following configuration in your sites/whitelabel_name/config/_default/config.yaml file:

module:
    _merge: deep
    mounts:
        - source: "../platform/src"
          target: "content"
          excludeFiles:
              - "create-apps/*"

You can exclude as many files as you want.

Configuring settings placeholders

When you add a white label documentation, you want vendor-specific values, such as the vendor and CLI names, to be easily substituted.

For example, if you add a white label documentation for a product called MyGreatProduct, you want every instance of Platform.sh and Platform.sh CLI to be automatically substituted by MyGreatProduct and MyGreatProduct CLI respectively. To achieve that result, use the settings placeholders defined in the sites/upsun/config/_default/params.yaml file:

# Vendorization
vendor:
    name: Upsun
    cli: upsun
    env_prefix: PLATFORM
    config_dir: .upsun

Each of them can be used in any templates (HTML or MarkDown) using shortcodes:

{{% vendor/name %}}
{{% vendor/cli %}}
...

Using a settings placeholder in a heading

If you need to use a settings placeholder in a heading, use the {{% my.settings %}} syntax.

If you use the {{< my.settings >}} syntax, the desired value isn't displayed in the on-page navigation menu. Instead, the placeholder is replaced by an unwanted reference to the shortcode, similar to HAHAHUGOSHORTCODEs3HBHB.

Changing the structure of the navigation sidebar

You might need to change the structure of the main navigation sidebar in your white label documentation.

For example, instead of having one migration tutorial (single migrating.md file) under the Tutorials section, you might want to create a nested migration section containing a few sub-pages, one for each hosting source users could migrate from.

In this case, you need to follow these steps:

  1. Exclude the migration tutorial (migrating.md file) from the content definition in your sites/whitelabel_name/config/_default/config.yaml file.
  2. Create the nested section in your sites/whitelabel/src directory.

Note: excludeFiles paths are defined from the src white label root directory.

To do so, you could implement the following file structure:

sites
├── upsun
│   └── src
│       └── tutorials
│           └── migrating
│               ├── _index.md
│               └── from_platformsh.md
└── platform
    └── src
        └── tutorials
            └── migrating.md

And the corresponding settings in the sites/whitelabel_name/config/_default/config.yaml file:

module:
    _merge: deep
    mounts:
        - source: "../platform/src"
          target: "content"
          excludeFiles:
              - "tutorials/migrating.md"
              - ...

platformsh-docs's People

Contributors

acervulus avatar anouckcolson avatar chadwcarlson avatar colliercz avatar crell avatar damz avatar dependabot[bot] avatar dudenhofer avatar erikabustamante avatar fabpot avatar flovntp avatar gilzow avatar guguss avatar jgrubb avatar kotnik avatar macweber avatar maria-at-platform avatar matthiaz avatar oripekelman avatar otaviojava avatar pjcdawkins avatar ralt avatar rinchen avatar robertdouglass avatar rudyweber avatar spk avatar sruggier avatar thomasdiluccio avatar trolologuy avatar xtfer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

platformsh-docs's Issues

Add a glossary of terms

I recall seeing a sentence somewhere in the platform.sh docs which said something like "If the project has a project file then the project will be built in project mode", which was very confusing.

Project seems to be used as a verb and an adjective, and in any case it's a standard English word which has broader meanings outside of platform.sh

If we had a glossary, project, project file, project mode could have their own entries.

Consider making this a Wiki

Given how often the docs change and how the docs have proliferated over the past few months, it would really make sense to put the docs in an environment that encouraged and made changes easier instead of harder.

So, please, let's put the docs in a Wiki. This would make contributions easier by not requiring knowledge of Git.

Redis setup missing some details

A few issues in one:

If i get it right, the redis server must also be enabled in .platform/services.yml

on https://docs.platform.sh/user_guide/reference/toolstacks/php/drupal/redis-drupal-7.html
in the settings.php section it's not totally clear how this works:
Currently there's one line before the settings.local include setting which connector to use,
And then some more lines after the include. Amongst it one about the connector too, but it does not say to adjust there to the used connector, which i think i should.

Can't i just as well put that code in settings.local.php to use redis eg. in production only?
The article only promotes using environment variables for that.

Also, the drupal-6 version tells how to check if redis is running, the D7 version is missing that.

Collapsible table of contents is hard to discover due to low contrast icon.

Developers over the age of 40 (or so) need to be able to read the user guide ;-)

The burger button in the top-left is coloured #ccc on a white background, so it's hard to know that a table of contents is available. Additionally it has a low-contrast focus outline (also #ccc).

Can we darken this to at least #757575 so it passes WCAG AA contrast requirements?

Document how to work with multilingual sites

Since each language has its specific URL on its specific subdomain, which is stored in the database, if you change the environment (branching or merging), you'll break URLs on that environment.

To bypass that, you can create a custom Drush command which you run in your post-deploy hook. This command could override the domain of each language to match:

  • [LANGUAGE_CODE]-[PLATFORM_ENVIRONMENT]-[PLATFORM_PROJECT].[CLUSTER].platform.sh

integration:set command does not return the Payload URL

on
https://github.com/platformsh/platformsh-docs/blob/blackfire/integration/webhooks.rst
we say "This command returns the Payload URL that you need to paste on your Github repository".
Current output:

platform integration:set --type=github --token=c84258....aa8e34 --repository=OriPekelman/apidays-2014-git-as-hypermedia
Integration mprqvhu5q756y created for github
Repository: OriPekelman/apidays-2014-git-as-hypermedia
Build PRs: yes
Fetch branches: yes

may be a CLI issue

shell-config.rc breaks Linux GUI login

Problem

After installing Platform CLI the user cannot login using the Linux GUI login screen. The X-server crash and return to the login screen.

Switching to a different tty and running startx works as a workaround.

Commenting the .profile lines that are added by the installation script allows the user to login on the Linux GUI again.

System which the problem was detected:

Linux distribution: Linux Mint Debian Edition
zsh is also installed, but I'm not sure if this is relevant to the issue.

Clarify how to contribute

The section in the README about conributing to the documentation doesn't make sense.

  • It talks about Symfony documentation
  • The link "Contributing to the Documentation" just leads to docs.platform.sh, and I can't find anything there about contributing.

PHP: mcrypt included by default or not?

Looking at https://docs.platform.sh/languages/php.html, it's indicated that mcrypt is "enabled by default". However, when tinkering with Platform.sh I found that I had to specify it explicitly (was using PHP 7.0) or I got an error when Composer ran about mcrypt not being available.

I'd be happy to correct the docs via a PR, but I'm not sure whether this is a bug in the platform or the docs.

Relevant tidbits:

          - cakephp/cakephp 2.8.6 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.

        To enable extensions, verify that they are enabled in those .ini files:
          - /etc/php/7.0/cli/php.ini
        You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

Fixed by adding the following to .platform.app.yaml

runtime:
    extensions:
        - mcrypt

Improve and update Drush documentation

  • You can sql-sync if you have Drush >= 7 locally and on Platform.sh, but it requires one extra step, e.g.: pjcdawkins/platformsh-examples@950f7cd
  • Drush 7.0.0-rc2 and 8 (beta) support Drupal 8. Drush <7 and Drush 7.0.0 do not support Drupal 8. Any version (above 5) supports Drupal 7. But you must have the same Drush version on both local and remote environments.
  • If you want to use YAML make files you will need to install Drush >=7.

Document how to work with multiple apps

Each app has its own name defined into .platform.app.yaml

name: phpsymfony
name: phpdrupal

Define the routes

In .platform/routes.yaml you define the upstream which will serve your app:

"http://{default}/symfony":
    type: upstream
    upstream: "phpsymfony:php"

"http://{default}/":
    type: upstream
    upstream: « phpdrupal:php"

Improve and Update Drupal Migration Docs

Hi,

I'm just going through the process of importing an existing Drupal site into platform and I think the the docs are a bit out of date:

Page Order

Since July 2016 you can't actually push your code to platform without having the configuration files already created and committed to the repo. However, this step in the tutorial comes before the configuration step which is going to be confusing for users following step-by-step (like me).

Additionally the image in the "Import your codebase" step does not quite match what I'm seeing. This isn't that big a deal but it did lead me to consider that maybe the documentation was out of date.

The "Public" or "Web" subdirectory

Initially reading through the docs (the drupal tutorial and the main docs), I was confused by various references to a "public" directory. As it turns out I think platform used to automatically move the application files into a public subdirectory, but that changed sometime earlier this year.

However, it's still required that your code be in a subdirectory which isn't actually mentioned in the "import your codebase" step. I think it should be mentioned earlier in the docs (maybe even as a prerequisite?) that your Drupal code cannot be at the root of the repository as many people's existing codebases may not be setup this way.

Thanks!

cron running on dash shell

l just found out that a command that worked fine on platform ssh was not working on cron, by looking at cron.log I found out that it was run on dash, so I fixed it accordingly.

This should be documented probably on the cron section, that is run with dash and that you can use that shell within the container to try it out.

Multi app config + git submodules

When testing git submodules with a multi application setup as described here I had several issues which were not easy to debug.
When I removed the git structure with submodules and commited all files to the main directory instead of submodules it was possible to push the application.

Maybe this is a bug or git submodules do not work with multi apps.
It is also possible that I did some configs wrong which would be odd since it works with the same configs when not using submodules.

The error:

Validating configuration files.
E: Error parsing configuration files:
   - http://docs.{default}/: Upstream 'docs:php' of route 'http://docs.{default}/' doesn't exist.
To [email protected]:63nps64z7mely.git

document_root implications

I was recently talking to support about why an application gets deployed into /app or sometimes /app/public

This is actually controlled by the document_root setting in the .platform.app.yaml. If the document_root is set to /, it will move the application to /app/public and use that as the root to allow for the private mounts to be kept private. In the case of your stats-tracking project it's doing this because there is no .platform.app.yaml so it is using the defaults.

Best,
Brad

This information should be added to: https://docs.platform.sh/user_guide/reference/platform-app-yaml.html

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.