Planned downtime from 11:00 UTC to 11:30 UTC. We try to keep it as short as possible!

#47 Improve Automated Deployment

Closed
opened 4 months ago by davidak · 9 comments
davidak commented 4 months ago

We could setup a CI to build and deploy the latest state.

So changes will be online ASAP after a PR was reviewed and merged.

This also saves time for more important tasks, like adding content or features.

Would you consider this?

We could setup a CI to build and deploy the latest state. So changes will be online ASAP after a PR was reviewed and merged. This also saves time for more important tasks, like adding content or features. Would you consider this?
brickup commented 4 months ago
Owner

There is an automated CI in place, but I haven’t documented it - thanks for pointing out! :) It basically works by a webhook in this repository, that calls this file on the webserver if changes to develop/primary occur.

I’ll add this as a todo in #45 and close this therefor.

There is an automated CI in place, but I haven't documented it - thanks for pointing out! :) It basically works by a webhook in this repository, that calls [this file](https://codeberg.org/swiso-en/website/src/branch/develop/deploy.php) on the webserver if changes to develop/primary occur. I'll add this as a todo in #45 and close this therefor.
brickup closed this issue 4 months ago
brickup commented 4 months ago
Owner

Just as a side note: There is nothing similiar to preview a pull request currently - but I also don’t know how to implement this.

Just as a side note: There is nothing similiar to preview a pull request currently - but I also don't know how to implement this.
davidak commented 4 months ago
Owner

Netlify has that feature but i think that part is not open source.

(isn’t a static site to not have PHP on the server?)

I just use rsync for manual deployment, but a CI could also do that when it has the SSH key configured.

331fc38677/conf.py (L500)

When the CI builds all PRs it could also deploy via rsync/SSH, create a folder with the PR number and add comment to PR with URL. Sounds quiet simple. Have i missed anything?

(which CI do you use?)

Netlify has that feature but i think that part is not open source. (isn't a static site to not have PHP on the server?) I just use rsync for manual deployment, but a CI could also do that when it has the SSH key configured. https://github.com/davidak/davidak.de/blob/331fc38677712dbbdd55ed33ada30a1182acd409/conf.py#L500 When the CI builds all PRs it could also deploy via rsync/SSH, create a folder with the PR number and add comment to PR with URL. Sounds quiet simple. Have i missed anything? (which CI do you use?)
brickup commented 4 months ago
Owner

I didn’t use Netlify because of it being not open source - I wanted to try it in the open first 😁

Here’s the current flow:

  1. A commit happens
  2. Codeberg triggers a webhook call to https://webhook.switching.software/deploy.php secured by a secret.
  3. This script checks the secret and change done...
  4. ... pulls the git repo (Authentication via Deploy Key setup in codeberg)...
  5. ... and rebuilds either the “develop” subdomain or the main website

No dedicated CI tool or something similiar. I did this based on a tutorial I found and kept it this way as it works fine and keeps external dependencies low.

I just discovered this DevOps list for gitea in the documentation, that might contain a good solution? I’m inexperienced concerning CI. Right now, I don’t want to dig deeper into all the options honestly. But a concrete proposal on a CI is appreciated :)

I didn't use Netlify because of it being not open source - I wanted to try it in the open first :grin: Here's the current flow: 1. A commit happens 1. Codeberg triggers a [webhook call](https://docs.gitea.io/en-us/webhooks/#event-information) to https://webhook.switching.software/deploy.php secured by a secret. 1. [This script](https://codeberg.org/swiso-en/website/src/branch/develop/deploy.php) checks the secret and change done... 1. ... pulls the git repo (Authentication via Deploy Key setup in codeberg)... 1. ... and rebuilds either the "develop" subdomain or the main website No dedicated CI tool or something similiar. I did this based on a tutorial I found and kept it this way as it works fine and keeps external dependencies low. I just discovered [this DevOps list for gitea](https://gitea.com/gitea/awesome-gitea/src/branch/master/README.md#user-content-devops) in the documentation, that might contain a good solution? I'm inexperienced concerning CI. Right now, I don't want to dig deeper into all the options honestly. But a concrete proposal on a CI is appreciated :)
brickup changed title from Automate deployment to Improve Automated Deployment 4 months ago
brickup reopened this issue 4 months ago
brickup added the
enhancement
label 4 months ago
brickup added the
help needed
label 4 months ago
davidak commented 4 months ago
Owner

I would like to use Drone CI for my projects. They offer free accounts for open source projects hosted on GitHub but i would rather use an instance hosted by Codeberg. Might happen someday Codeberg/Community#78

If it’s not important to have the history of all builds, one could just setup a server at home right now while waiting for Codeberg. I considered this...

Configuring it is easy and fun :)

http://plugins.drone.io/cbrgm/drone-hugo/
http://plugins.drone.io/drillster/drone-rsync/

When we have a CI instance i can create the config as i plan the same for my pages.

Update: This article actually explains in detail how to deploy a hugo site! It’s basically just starting two docker containers... i will see what i can do :)

https://thomas-leister.de/en/drone-ci-with-codeberg/

I would like to use [Drone CI](https://drone.io/) for my projects. They offer free accounts for open source projects hosted on GitHub but i would rather use an instance hosted by Codeberg. Might happen someday https://codeberg.org/Codeberg/Community/issues/78 If it's not important to have the history of all builds, one could just setup a server at home right now while waiting for Codeberg. I considered this... Configuring it is easy and fun :) http://plugins.drone.io/cbrgm/drone-hugo/ http://plugins.drone.io/drillster/drone-rsync/ When we have a CI instance i can create the config as i plan the same for my pages. **Update**: This article actually explains in detail how to deploy a hugo site! It's basically just starting two docker containers... i will see what i can do :) https://thomas-leister.de/en/drone-ci-with-codeberg/
brickup removed the
help needed
label 2 months ago
brickup added the
in progress
label 2 months ago
brickup commented 2 months ago
Owner

I set up a drone server and agent on our VPS. Works nicely but still needs some configuring - just quickly wrote this config today and switched the development domains to the CI result. For the main branch, I still would like to know how to force a specific hugo version on build. The current environment variable isn’t working.

I set up a drone server and agent on our VPS. Works nicely but still needs some configuring - just quickly wrote [this config](https://codeberg.org/swiso/website/src/branch/develop/.drone.yml) today and switched the development domains to the CI result. For the main branch, I still would like to know how to force a specific hugo version on build. The current environment variable isn't working.
davidak commented 2 months ago
Owner

Very good! I was able to log in using codeberg, not sure if i have the rights from this group of if any codeberg user could log in and build their projects there. I wasn’t able to see echo "$SSH_KEY" | ssh-add - which is good :)

Very good! I was able to log in using codeberg, not sure if i have the rights from this group of if any codeberg user could log in and build their projects there. I wasn't able to see `echo "$SSH_KEY" | ssh-add -` which is good :)
brickup commented 2 months ago
Owner

Thanks for pointing out - seemed to be open completely indeed. That’s the default configuration, see here - unbelievable. I wasn’t expecting that!

Turned the server off for now as I couldn’t easily fix this behaviour with this parameter.

EDIT: Fixed it. Now logging in should only work for me, see attachment.

EDIT 2: I also wrote this to the author of the Codeberg-Drone-tutorial. He wants to add this issue to the tutorial.

Thanks for pointing out - seemed to be open completely indeed. That's the default configuration, [see here](https://docs.drone.io/server/user/registration/) - unbelievable. I wasn't expecting that! Turned the server off for now as I couldn't easily fix this behaviour with this parameter. **EDIT:** Fixed it. Now logging in should only work for me, see attachment. **EDIT 2:** I also wrote this to the author of the Codeberg-Drone-tutorial. He wants to add this issue to the tutorial.
brickup commented 2 months ago
Owner

Fixed the issue with defining the Hugo version, so this is complete - can be merged to main branch soon

Fixed the issue with defining the Hugo version, so this is complete - can be merged to main branch soon
brickup closed this issue 2 months ago
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.