Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow docs pull requests to trigger staging deploys #120

Open
jwage opened this issue Apr 17, 2018 · 7 comments
Open

Allow docs pull requests to trigger staging deploys #120

jwage opened this issue Apr 17, 2018 · 7 comments
Labels
Enhancement New feature or request

Comments

@jwage
Copy link
Member

jwage commented Apr 17, 2018

Right now a docs PR won't work with staging deploys.

@stof
Copy link
Member

stof commented Apr 18, 2018

Shouldn't we have separate deployments per PR ? Otherwise, the staging site always corresponds to the latest updated PR, which may not be the one you are interested in currently.

@jwage
Copy link
Member Author

jwage commented Apr 18, 2018

Yes, eventually I would love to have it work that way. Just requires work.

@stof
Copy link
Member

stof commented Apr 18, 2018

what is the hosting being used currently ?

@jwage
Copy link
Member Author

jwage commented Apr 18, 2018

Github pages.

https://github.com/doctrine/doctrine-website-build-staging
https://github.com/doctrine/doctrine-website-build-prod

This would have to change for at least staging or we have multiple deploys stored in the repo. Each one in a sub folder.

@jwage
Copy link
Member Author

jwage commented Apr 18, 2018

I want to do it all with gh pages and without any custom hosting or vms for hooks. But I realize we are fairly limited in what we can do by having that restriction. The reason is we don't want to have to maintain any servers that require updates, access control, etc.

Right now we have a vm that receives web hooks, triggers the build and pushes to the gh pages build repository.

@stof
Copy link
Member

stof commented Apr 24, 2018

so, how do you plan to trigger website build for updates in each projects ?

@jwage
Copy link
Member Author

jwage commented Apr 24, 2018

@stof My current thought is to enhance the webhook script https://github.com/doctrine/doctrine-website/blob/master/hooks/deploy.php to store a JSON document for the last webhook received. I think it would just store the project and the sha. This script could be refactored and cleaned up in general too. It should just be using some classes in app/src instead of a standalone script.

Example JSON:

{
    "project":"mongodb-odm",
    "sha":"1234"
}

Then we enhance https://github.com/doctrine/doctrine-website/blob/master/app/src/Doctrine/Website/Docs/BuildDocs.php#L77 to allow you to sync git for a specific project & sha.

Then we can use that enhancement in https://github.com/doctrine/doctrine-website/blob/master/app/src/Doctrine/Website/Deployer.php#L80 to get the JSON document that we write from the github webhook and then dynamically build the commands to build the docs for that project and sha, rebuild the website and publish:

./doctrine build-docs --project={{ lastHook.project }} --sha={{ lastHook.sha }}
./doctrine build-website --env=staging --publish

Just for more context. On the server that receives the webhooks from github we have the following crons:

* * * * *  cd /data/doctrine-website-prod && ./doctrine deploy --env=prod --verbose >> /var/log/deployer-prod.log 2>&1
* * * * *  cd /data/doctrine-website-staging && ./doctrine deploy --env=staging --verbose >> /var/log/deployer-staging.log 2>&1

Every minute the deploy command is ran and it looks for the file written by the webhook script and checks if a deploy is required.

Even though it only supports deploying the last thing that was pushed, I think the frequency will be low enough initially for it to work fine. We could enhance staging later to have directories for each branch with some kind of cleanup process. Then you can go to https://staging.doctrine-project.org/branch-name and view your changes.

@jwage jwage added the Enhancement New feature or request label Apr 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants