├── doc ├── DESCRIPTION.md ├── DESCRIPTION_fr.md ├── screenshots │ └── GitLab_running_11.0_(2018-07).png ├── ADMIN.md └── ADMIN_fr.md ├── .gitlab-ci.yml ├── tests.toml ├── config_panel.toml ├── .github ├── PULL_REQUEST_TEMPLATE.md ├── workflows │ ├── updater.yml │ └── updater.sh └── ISSUE_TEMPLATE.md ├── conf └── nginx.conf ├── scripts ├── config ├── backup ├── remove ├── change_url ├── _common.sh ├── restore ├── install └── upgrade ├── README.md ├── upgrade-path.sh ├── manifest.toml ├── upgrade-versions.sh └── LICENSE /doc/DESCRIPTION.md: -------------------------------------------------------------------------------- 1 | Git-repository manager providing wiki, issue-tracking and CI/CD pipeline features -------------------------------------------------------------------------------- /doc/DESCRIPTION_fr.md: -------------------------------------------------------------------------------- 1 | Gestionnaire de dépôts Git proposant des fonctionnalités de wiki, suivi de bugs et de pipeline CI/CD -------------------------------------------------------------------------------- /doc/screenshots/GitLab_running_11.0_(2018-07).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YunoHost-Apps/gitlab_ynh/HEAD/doc/screenshots/GitLab_running_11.0_(2018-07).png -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | image: python:3.5-alpine 2 | test: 3 | script: 4 | - apk update 5 | - apk add git 6 | - git clone https://github.com/YunoHost/package_linter 7 | - python package_linter/package_linter.py . 8 | -------------------------------------------------------------------------------- /doc/ADMIN.md: -------------------------------------------------------------------------------- 1 | ### Configuration 2 | 3 | How to configure GitLab: 4 | 5 | - With the GitLab admin panel. 6 | - By editing the configuration file `/etc/gitlab/gitlab-persistent.rb` (use `sudo gitlab-ctl reconfigure` after any modification of this file). 7 | -------------------------------------------------------------------------------- /tests.toml: -------------------------------------------------------------------------------- 1 | test_format = 1.0 2 | 3 | [default] 4 | # ------------------------------- 5 | # Commits to test upgrade from 6 | # ------------------------------- 7 | 8 | test_upgrade_from.1945b0a4c957ceb48d66309de449180035342345.name = "Upgrade from 18.6.0" 9 | -------------------------------------------------------------------------------- /doc/ADMIN_fr.md: -------------------------------------------------------------------------------- 1 | ### Configuration 2 | 3 | Comment configurer GitLab : 4 | 5 | - Avec le panneau d'administration de GitLab. 6 | - En éditant le fichier de configuration `/etc/gitlab/gitlab-persistent.rb` et en éxécutant la commande `sudo gitlab-ctl reconfigure` pour réactualiser la configuration. 7 | -------------------------------------------------------------------------------- /config_panel.toml: -------------------------------------------------------------------------------- 1 | version = "1.0" 2 | 3 | [main] 4 | name = "GitLab configuration" 5 | 6 | [main.overwrite_files] 7 | name = "Overwriting config files" 8 | 9 | [main.overwrite_files.overwrite_nginx] 10 | ask = "Overwrite the NGINX config file?" 11 | type = "boolean" 12 | help = "If the file is overwritten, a backup will be created." 13 | 14 | [main.users] 15 | name = "External users" 16 | 17 | [main.users.use_web_account] 18 | ask = "Authorized external user creation?" 19 | type = "boolean" -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Problem 2 | 3 | - *Description of why you made this PR* 4 | 5 | ## Solution 6 | 7 | - *And how do you fix that problem* 8 | 9 | ## PR Status 10 | 11 | - [ ] Code finished and ready to be reviewed/tested 12 | - [ ] The fix/enhancement were manually tested (if applicable) 13 | 14 | ## Automatic tests 15 | 16 | Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization) 17 | -------------------------------------------------------------------------------- /conf/nginx.conf: -------------------------------------------------------------------------------- 1 | location __PATH__/ { 2 | # Adapted from https://gitlab.com/gitlab-org/gitlab-foss/-/blob/master/lib/support/nginx/gitlab-ssl 3 | 4 | client_max_body_size __CLIENT_MAX_BODY_SIZE__; 5 | gzip off; 6 | 7 | ## https://github.com/gitlabhq/gitlabhq/issues/694 8 | ## Some requests take more than 30 seconds. 9 | proxy_read_timeout 300; 10 | proxy_connect_timeout 300; 11 | proxy_redirect off; 12 | 13 | proxy_http_version 1.1; 14 | 15 | proxy_pass http://localhost:__PORT__; 16 | 17 | proxy_set_header Host $host; 18 | proxy_set_header X-Real-IP $remote_addr; 19 | proxy_set_header X-Forwarded-Ssl on; 20 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 21 | proxy_set_header X-Forwarded-Proto $scheme; 22 | proxy_set_header Upgrade $http_upgrade; 23 | proxy_set_header Connection $connection_upgrade; 24 | 25 | # Include SSOWAT user panel. 26 | include conf.d/yunohost_panel.conf.inc; 27 | } 28 | -------------------------------------------------------------------------------- /scripts/config: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source /usr/share/yunohost/helpers 4 | 5 | #REMOVEME? ynh_abort_if_errors 6 | 7 | #================================================= 8 | # RETRIEVE ARGUMENTS 9 | #================================================= 10 | 11 | #================================================= 12 | # SPECIFIC GETTERS FOR TOML SHORT KEY 13 | #================================================= 14 | 15 | #================================================= 16 | # SPECIFIC SETTERS FOR TOML SHORT KEYS 17 | #================================================= 18 | 19 | set__use_web_account() { 20 | if [ -n "${use_web_account}" ] 21 | then 22 | echo "ApplicationSetting.last.update(password_authentication_enabled_for_web: $use_web_account, signup_enabled: $use_web_account)" | gitlab-rails console 23 | 24 | # Update the config of the app 25 | ynh_app_setting_set --key=use_web_account --value=$use_web_account 26 | fi 27 | } 28 | 29 | #================================================= 30 | ynh_app_config_run $1 -------------------------------------------------------------------------------- /scripts/backup: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #================================================= 4 | # IMPORT GENERIC HELPERS 5 | #================================================= 6 | 7 | # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts 8 | source ../settings/scripts/_common.sh 9 | source /usr/share/yunohost/helpers 10 | 11 | ynh_print_info "Declaring files to be backed up..." 12 | 13 | #================================================= 14 | # BACKUP THE NGINX CONFIGURATION 15 | #================================================= 16 | 17 | ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" 18 | 19 | #================================================= 20 | # BACKUP GITLAB DATABASE 21 | #================================================= 22 | 23 | # See https://github.com/YunoHost-Apps/gitlab_ynh/issues/300 24 | 25 | chmod 755 $install_dir 26 | 27 | # Use gitlab-backup to backup 28 | # For the complete doc: https://docs.gitlab.com/ce/raketasks/backup_restore.html 29 | # For the filename: https://docs.gitlab.com/ce/raketasks/backup_restore.html#backup-filename 30 | gitlab-backup create BACKUP=last 31 | 32 | ynh_backup "/var/opt/$app/backups/last_gitlab_backup.tar" 33 | 34 | #================================================= 35 | # BACKUP CONF FILES 36 | #================================================= 37 | 38 | config_path=/etc/$app 39 | ynh_backup "$config_path/gitlab-secrets.json" 40 | ynh_backup "$config_path/gitlab.rb" 41 | ynh_backup "$config_path/gitlab-persistent.rb" 42 | 43 | #================================================= 44 | # END OF SCRIPT 45 | #================================================= 46 | 47 | ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." 48 | -------------------------------------------------------------------------------- /scripts/remove: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source _common.sh 4 | source /usr/share/yunohost/helpers 5 | 6 | #================================================= 7 | # REMOVE SERVICE FROM ADMIN PANEL 8 | #================================================= 9 | 10 | if yunohost service status "gitlab-runsvdir" >/dev/null 2>&1 11 | then 12 | ynh_script_progression "Removing $app service" 13 | yunohost service remove "gitlab-runsvdir" 14 | fi 15 | 16 | #================================================= 17 | # STOP GITLAB 18 | #================================================= 19 | ynh_script_progression "Stopping GitLab" 20 | 21 | # I use gitlab-ctl and not ynh_systemctl or systemctl to stop the service to avoid this error: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/common_installation_problems/README.md#reconfigure-freezes-at-ruby_blocksupervise_redis_sleep-action-run during the reinstall of the app 22 | gitlab-ctl stop 23 | 24 | #================================================= 25 | # REMOVE GITLAB 26 | #================================================= 27 | ynh_script_progression "Removing GitLab" 28 | 29 | dpkg --remove gitlab-ce 30 | 31 | #================================================= 32 | # REMOVE APP MAIN DIR 33 | #================================================= 34 | 35 | # Remove the app directory securely 36 | config_path=/etc/$app 37 | ynh_safe_rm "$config_path" 38 | 39 | #================================================= 40 | # REMOVE NGINX CONFIGURATION 41 | #================================================= 42 | ynh_script_progression "Removing NGINX web server configuration" 43 | 44 | # Remove the dedicated NGINX config 45 | ynh_config_remove_nginx 46 | 47 | #================================================= 48 | # REMOVE GITLAB FILES 49 | #================================================= 50 | 51 | ynh_safe_rm "/var/opt/$app" 52 | 53 | # Remove swap 54 | ynh_del_swap 55 | 56 | #================================================= 57 | # END OF SCRIPT 58 | #================================================= 59 | 60 | ynh_script_progression "Removal of GitLab completed" 61 | -------------------------------------------------------------------------------- /.github/workflows/updater.yml: -------------------------------------------------------------------------------- 1 | # This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected. 2 | # You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization. 3 | # This file should be enough by itself, but feel free to tune it to your needs. 4 | # It calls updater.sh, which is where you should put the app-specific update steps. 5 | name: Check for new upstream releases 6 | on: 7 | # Allow to manually trigger the workflow 8 | workflow_dispatch: 9 | # Run it every day at 6:00 UTC 10 | schedule: 11 | - cron: '0 6 * * *' 12 | jobs: 13 | updater: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - name: Fetch the source code 17 | uses: actions/checkout@v3 18 | with: 19 | token: ${{ secrets.GITHUB_TOKEN }} 20 | - name: Run the updater script 21 | id: run_updater 22 | run: | 23 | # Setting up Git user 24 | git config --global user.name 'yunohost-bot' 25 | git config --global user.email 'yunohost-bot@users.noreply.github.com' 26 | # Run the updater script 27 | /bin/bash .github/workflows/updater.sh 28 | - name: Commit changes 29 | id: commit 30 | if: ${{ env.PROCEED == 'true' }} 31 | run: | 32 | git commit -am "Upgrade to v$VERSION" 33 | - name: Create Pull Request 34 | id: cpr 35 | if: ${{ env.PROCEED == 'true' }} 36 | uses: peter-evans/create-pull-request@v4 37 | with: 38 | token: ${{ secrets.GITHUB_TOKEN }} 39 | commit-message: Update to version ${{ env.VERSION }} 40 | committer: 'yunohost-bot ' 41 | author: 'yunohost-bot ' 42 | signoff: false 43 | base: testing 44 | branch: ci-auto-update-v${{ env.VERSION }} 45 | delete-branch: true 46 | title: 'Upgrade to version ${{ env.VERSION }}' 47 | body: | 48 | Upgrade to v${{ env.VERSION }} 49 | draft: false -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 5 | 6 |

7 | Logo of GitLab 8 | GitLab, packaged for YunoHost 9 |

10 | 11 | Git-repository manager providing wiki, issue-tracking and CI/CD pipeline features 12 | 13 | [![🌐 Official app website](https://img.shields.io/badge/Official_app_website-darkgreen?style=for-the-badge)](https://gitlab.com) 14 | [![App Demo](https://img.shields.io/badge/App_Demo-blue?style=for-the-badge)](https://gitlab.com/explore) 15 | [![Version: 18.7.0~ynh1](https://img.shields.io/badge/Version-18.7.0~ynh1-rgb(18,138,11)?style=for-the-badge)](https://ci-apps.yunohost.org/ci/apps/gitlab/) 16 | 17 |
18 | 19 | 20 |
21 | 22 | 23 | ## Screenshots 24 | ![Screenshot of GitLab](./doc/screenshots/GitLab_running_11.0_(2018-07).png) 25 | 26 | ## 📦 Developer info 27 | 28 | [![Automatic tests level](https://apps.yunohost.org/badge/cilevel/gitlab)](https://ci-apps.yunohost.org/ci/apps/gitlab/) 29 | 30 | 🛠️ Upstream GitLab repository: 31 | 32 | Pull request are welcome and should target the [`testing` branch](https://github.com/YunoHost-Apps/gitlab_ynh/tree/testing). 33 | 34 | The `testing` branch can be tested using: 35 | ``` 36 | # fresh install: 37 | sudo yunohost app install https://github.com/YunoHost-Apps/gitlab_ynh/tree/testing 38 | 39 | # upgrade an existing install: 40 | sudo yunohost app upgrade gitlab -u https://github.com/YunoHost-Apps/gitlab_ynh/tree/testing 41 | ``` 42 | 43 | ### 📚 App packaging documentation 44 | 45 | Please see for more information. -------------------------------------------------------------------------------- /scripts/change_url: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source _common.sh 4 | source /usr/share/yunohost/helpers 5 | 6 | #================================================= 7 | # MODIFY URL IN NGINX CONF 8 | #================================================= 9 | ynh_script_progression "Updating NGINX web server configuration..." 10 | 11 | #doc in: https://docs.gitlab.com/omnibus/settings/configuration.html#configure-the-external-url-for-gitlab 12 | 13 | ynh_config_change_url_nginx 14 | 15 | #================================================= 16 | # CHECK IF KERNEL IS READ-ONLY 17 | #================================================= 18 | 19 | modify_kernel_parameters="true" 20 | 21 | for value_to_check in "kernel.shmall" "kernel.shmmax" "kernel.sem" "net.core.somaxconn" 22 | do 23 | if ! ynh_hide_warnings sysctl --write $value_to_check="$(sysctl --value $value_to_check)"; then 24 | modify_kernel_parameters="false" 25 | break 26 | fi 27 | done 28 | 29 | #================================================= 30 | # CONFIGURE GITLAB 31 | #================================================= 32 | ynh_script_progression "Configure GitLab..." 33 | 34 | config_path=/etc/$app 35 | mkdir -p $config_path 36 | ssh_port=$(grep -P "Port\s+\d+" /etc/ssh/sshd_config | grep -P -o "\d+") 37 | domain="$new_domain" 38 | path="$new_path" 39 | 40 | generated_external_url="https://$domain${path%/}" 41 | 42 | ynh_config_add --template="$YNH_APP_BASEDIR/conf/gitlab.rb" --destination="$config_path/gitlab.rb" 43 | 44 | #================================================= 45 | # RECONFIGURE GITLAB 46 | #================================================= 47 | 48 | ynh_hide_warnings gitlab-ctl reconfigure 49 | 50 | #================================================= 51 | # WAITING GITLAB 52 | #================================================= 53 | ynh_script_progression "Waiting for GitLab..." 54 | 55 | ynh_systemctl --action=restart --service="gitlab-runsvdir" --log_path="/var/log/$app/puma/current" --wait_until="Listening on http://127.0.0.1:$port_puma" --timeout=300 56 | 57 | #================================================= 58 | # END OF SCRIPT 59 | #================================================= 60 | 61 | ynh_script_progression "Change of URL completed for GitLab" 62 | -------------------------------------------------------------------------------- /.github/workflows/updater.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #================================================= 4 | # PACKAGE UPDATING HELPER 5 | #================================================= 6 | 7 | # This script is meant to be run by GitHub Actions 8 | # The YunoHost-Apps organisation offers a template Action to run this script periodically 9 | # Since each app is different, maintainers can adapt its contents so as to perform 10 | # automatic actions when a new upstream release is detected. 11 | 12 | #================================================= 13 | # FETCHING LATEST RELEASE AND ITS ASSETS 14 | #================================================= 15 | 16 | current_version=$(yq ".version" manifest.toml | cut -d '~' -f 1 -) 17 | 18 | # For the time being, let's assume the script will fail 19 | echo "PROCEED=false" >> $GITHUB_ENV 20 | 21 | /bin/bash ./upgrade-path.sh 16.9.0 22 | 23 | version=$(yq ".version" manifest.toml | cut -d '~' -f 1 -) 24 | 25 | echo "Current version: $current_version" 26 | echo "Latest release from upstream: $version" 27 | echo "VERSION=$version" >> "$GITHUB_ENV" 28 | echo "REPO=$repo" >> "$GITHUB_ENV" 29 | # For the time being, let's assume the script will fail 30 | echo "PROCEED=false" >> "$GITHUB_ENV" 31 | 32 | # Proceed only if the retrieved version is greater than the current one 33 | if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then 34 | echo "::warning ::No new version available" 35 | exit 0 36 | # Proceed only if a PR for this new version does not already exist 37 | elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then 38 | echo "::warning ::A branch already exists for this update" 39 | exit 0 40 | fi 41 | 42 | 43 | #================================================= 44 | # UPDATE SOURCE FILES 45 | #================================================= 46 | 47 | 48 | #================================================= 49 | # SPECIFIC UPDATE STEPS 50 | #================================================= 51 | 52 | # Any action on the app's source code can be done. 53 | # The GitHub Action workflow takes care of committing all changes after this script ends. 54 | 55 | #================================================= 56 | # GENERIC FINALIZATION 57 | #================================================= 58 | 59 | # No need to update the README, yunohost-bot takes care of it 60 | 61 | # The Action will proceed only if the PROCEED environment variable is set to true 62 | echo "PROCEED=true" >> $GITHUB_ENV 63 | exit 0 -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently. 4 | 5 | --- 6 | 7 | **How to post a meaningful bug report** 8 | 1. *Read this whole template first.* 9 | 2. *Determine if you are on the right place:* 10 | - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!* 11 | - *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.* 12 | - *When in doubt, post here and we will figure it out together.* 13 | 3. *Delete the italic comments as you write over them below, and remove this guide.* 14 | --- 15 | 16 | ### Describe the bug 17 | 18 | *A clear and concise description of what the bug is.* 19 | 20 | ### Context 21 | 22 | - Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...* 23 | - YunoHost version: x.x.x 24 | - I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...* 25 | - Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes* 26 | - If yes, please explain: 27 | - Using, or trying to install package version/branch: 28 | - If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`* 29 | 30 | ### Steps to reproduce 31 | 32 | - *If you performed a command from the CLI, the command itself is enough. For example:* 33 | ```sh 34 | sudo yunohost app install the_app 35 | ``` 36 | - *If you used the webadmin, please perform the equivalent command from the CLI first.* 37 | - *If the error occurs in your browser, explain what you did:* 38 | 1. *Go to '...'* 39 | 2. *Click on '...'* 40 | 3. *Scroll down to '...'* 41 | 4. *See error* 42 | 43 | ### Expected behavior 44 | 45 | *A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.* 46 | 47 | ### Logs 48 | 49 | *When an operation fails, YunoHost provides a simple way to share the logs.* 50 | - *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.* 51 | - *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.* 52 | 53 | *After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)* 54 | 55 | *If applicable and useful, add screenshots to help explain your problem.* 56 | -------------------------------------------------------------------------------- /scripts/_common.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Action to do in case of failure of the package_check 4 | package_check_action() { 5 | ynh_backup_if_checksum_is_different "$config_path/gitlab.rb" 6 | cat <> "$config_path/gitlab.rb" 7 | # Last chance to fix Gitlab 8 | package['modify_kernel_parameters'] = false 9 | EOF 10 | ynh_store_file_checksum "$config_path/gitlab.rb" 11 | } 12 | 13 | 14 | #================================================= 15 | # EXPERIMENTAL HELPERS 16 | #================================================= 17 | 18 | # Add swap 19 | # 20 | # usage: ynh_add_swap --size=SWAP in Mb 21 | # | arg: -s, --size= - Amount of SWAP to add in Mb. 22 | ynh_add_swap () { 23 | # Declare an array to define the options of this helper. 24 | declare -Ar args_array=( [s]=size= ) 25 | local size 26 | # Manage arguments with getopts 27 | ynh_handle_getopts_args "$@" 28 | 29 | local swap_max_size=$(( $size * 1024 )) 30 | 31 | local free_space=$(df --output=avail / | sed 1d) 32 | # Because we don't want to fill the disk with a swap file, divide by 2 the available space. 33 | local usable_space=$(( $free_space / 2 )) 34 | 35 | SD_CARD_CAN_SWAP=${SD_CARD_CAN_SWAP:-0} 36 | 37 | # Swap on SD card only if it's is specified 38 | if ynh_is_main_device_a_sd_card && [ "$SD_CARD_CAN_SWAP" == "0" ] 39 | then 40 | ynh_print_warn "The main mountpoint of your system '/' is on an SD card, swap will not be added to prevent some damage of this one, but that can cause troubles for the app $app. If you still want activate the swap, you can relaunch the command preceded by 'SD_CARD_CAN_SWAP=1'" 41 | return 42 | fi 43 | 44 | # Compare the available space with the size of the swap. 45 | # And set a acceptable size from the request 46 | if [ $usable_space -ge $swap_max_size ] 47 | then 48 | local swap_size=$swap_max_size 49 | elif [ $usable_space -ge $(( $swap_max_size / 2 )) ] 50 | then 51 | local swap_size=$(( $swap_max_size / 2 )) 52 | elif [ $usable_space -ge $(( $swap_max_size / 3 )) ] 53 | then 54 | local swap_size=$(( $swap_max_size / 3 )) 55 | elif [ $usable_space -ge $(( $swap_max_size / 4 )) ] 56 | then 57 | local swap_size=$(( $swap_max_size / 4 )) 58 | else 59 | echo "Not enough space left for a swap file" >&2 60 | local swap_size=0 61 | fi 62 | 63 | # If there's enough space for a swap, and no existing swap here 64 | if [ $swap_size -ne 0 ] && [ ! -e /swap_$app ] 65 | then 66 | # Preallocate space for the swap file, fallocate may sometime not be used, use dd instead in this case 67 | if ! fallocate -l ${swap_size}K /swap_$app 68 | then 69 | dd if=/dev/zero of=/swap_$app bs=1024 count=${swap_size} 70 | fi 71 | chmod 0600 /swap_$app 72 | # Create the swap 73 | mkswap /swap_$app 74 | # And activate it 75 | swapon /swap_$app 76 | # Then add an entry in fstab to load this swap at each boot. 77 | echo -e "/swap_$app swap swap defaults 0 0 #Swap added by $app" >> /etc/fstab 78 | fi 79 | } 80 | 81 | ynh_del_swap () { 82 | # If there a swap at this place 83 | if [ -e /swap_$app ] 84 | then 85 | # Clean the fstab 86 | sed -i "/#Swap added by $app/d" /etc/fstab 87 | # Desactive the swap file 88 | swapoff /swap_$app 89 | # And remove it 90 | rm /swap_$app 91 | fi 92 | } 93 | 94 | # Check if the device of the main mountpoint "/" is an SD card 95 | # 96 | # [internal] 97 | # 98 | # return 0 if it's an SD card, else 1 99 | ynh_is_main_device_a_sd_card () { 100 | local main_device=$(lsblk --output PKNAME --noheadings $(findmnt / --nofsroot --uniq --output source --noheadings --first-only)) 101 | 102 | if echo $main_device | grep --quiet "mmc" && [ $(tail -n1 /sys/block/$main_device/queue/rotational) == "0" ] 103 | then 104 | return 0 105 | else 106 | return 1 107 | fi 108 | } 109 | -------------------------------------------------------------------------------- /scripts/restore: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #================================================= 4 | # IMPORT GENERIC HELPERS 5 | #================================================= 6 | 7 | #Keep this path for calling _common.sh inside the execution's context of backup and restore scripts 8 | source ../settings/scripts/_common.sh 9 | source /usr/share/yunohost/helpers 10 | 11 | #================================================= 12 | # RESTORE THE NGINX CONFIGURATION 13 | #================================================= 14 | 15 | ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf" 16 | 17 | #================================================= 18 | # ADD SWAP IF NEEDED 19 | #================================================= 20 | 21 | total_ram=$(ynh_get_ram --total) 22 | swap_needed=0 23 | 24 | # https://docs.gitlab.com/ce/install/requirements.html#memory 25 | # Need at least 2Go of swap 26 | if [ $total_ram -lt 4096 ]; then 27 | swap_needed=2048 28 | fi 29 | 30 | if [ $swap_needed -gt 0 ]; then 31 | ynh_script_progression "Adding $swap_needed Mo to swap..." 32 | if ! ynh_add_swap --size=$swap_needed; then 33 | ynh_print_warn "Please add $swap_needed Mo to swap to make GitLab work properly" 34 | fi 35 | fi 36 | 37 | #================================================= 38 | # RESTORE CONF FILES 39 | #================================================= 40 | ynh_script_progression "Restoring configuration files of GitLab..." 41 | 42 | config_path=/etc/$app 43 | chmod 755 $install_dir 44 | ynh_restore "$config_path/gitlab-secrets.json" 45 | ynh_restore "$config_path/gitlab.rb" 46 | ynh_restore "$config_path/gitlab-persistent.rb" 47 | 48 | #================================================= 49 | # RESTORE THE APP MAIN DIR 50 | #================================================= 51 | ynh_script_progression "Reinstalling GitLab..." 52 | 53 | tempdir="$(mktemp -d)" 54 | 55 | ynh_setup_source --dest_dir=$tempdir --source_id="latest_$(lsb_release -sc)" 56 | 57 | chmod 755 $install_dir 58 | # https://docs.gitlab.com/omnibus/settings/configuration.html#specify-the-external-url-at-the-time-of-installation 59 | if ! ynh_hide_warnings dpkg -i $tempdir/gitlab-ce.deb; then # This command will fail in lxc env 60 | package_check_action 61 | ynh_hide_warnings dpkg --configure gitlab-ce 62 | fi 63 | 64 | ynh_safe_rm "$tempdir" 65 | 66 | #================================================= 67 | # RESTORE GITLAB DATABASE 68 | #================================================= 69 | ynh_script_progression "Restoring GitLab..." 70 | 71 | ynh_restore "/var/opt/$app/backups/last_gitlab_backup.tar" 72 | chown git:git "/var/opt/$app/backups/last_gitlab_backup.tar" 73 | 74 | last_backup="last" 75 | 76 | gitlab-ctl stop puma 77 | gitlab-ctl stop sidekiq 78 | 79 | # Use gitlab-rake to backup 80 | # Doc: https://docs.gitlab.com/ce/raketasks/backup_restore.html#restore-for-omnibus-gitlab-installations 81 | ynh_hide_warnings gitlab-backup restore force=yes BACKUP=$last_backup 82 | 83 | # https://docs.gitlab.com/ce/raketasks/backup_restore.html#container-registry-push-failures-after-restoring-from-a-backup 84 | if ynh_system_user_exists --username="registry" && [ -d "/var/opt/gitlab/gitlab-rails/shared/registry/docker" ]; then 85 | chown -R registry:registry /var/opt/gitlab/gitlab-rails/shared/registry/docker 86 | fi 87 | 88 | #================================================= 89 | # ADVERTISE SERVICE IN ADMIN PANEL 90 | #================================================= 91 | 92 | yunohost service add "gitlab-runsvdir" --log "/var/log/$app/gitlab-rails/application.log" "/var/log/$app/gitlab-rails/api_json.log" "/var/log/$app/gitlab-rails/production.log" "/var/log/$app/gitlab-rails/production_json.log" "/var/log/$app/gitlab-rails/sidekiq.log" "/var/log/$app/puma/puma_stderr.log" "/var/log/$app/puma/current" "/var/log/$app/alertmanager/current" "/var/log/$app/gitaly/current" "/var/log/$app/gitlab-monitor/current" "/var/log/$app/gitlab-shell/gitlab-shell.log" "/var/log/$app/gitlab-workhorse/current" "/var/log/$app/logrotate/current" "/var/log/$app/nginx/current" "/var/log/$app/nginx/access.log" "/var/log/$app/nginx/error.log" "/var/log/$app/nginx/gitlab_access.log" "/var/log/$app/nginx/gitlab_error.log" "/var/log/$app/node-exporter/current" "/var/log/$app/postgres-exporter/current" "/var/log/$app/postgresql/current" "/var/log/$app/prometheus/current" "/var/log/$app/redis/current" "/var/log/$app/redis-exporter/current" 93 | 94 | #================================================= 95 | # WAITING GITLAB 96 | #================================================= 97 | ynh_script_progression "Waiting for GitLab..." 98 | 99 | ynh_systemctl --action=restart --service="gitlab-runsvdir" --log_path="/var/log/$app/puma/current" --wait_until="Listening on http://127.0.0.1:$port_puma" --timeout=300 100 | 101 | #================================================= 102 | # CHECK THE RESTORED DATA 103 | #================================================= 104 | 105 | gitlab-rake gitlab:check SANITIZE=true 106 | 107 | # Allow ssh for git 108 | usermod -a -G "ssh.app" "git" 109 | 110 | #================================================= 111 | # RELOAD NGINX 112 | #================================================= 113 | ynh_script_progression "Reloading NGINX web server..." 114 | 115 | ynh_systemctl --action=reload --service=nginx 116 | 117 | #================================================= 118 | # END OF SCRIPT 119 | #================================================= 120 | 121 | ynh_script_progression "Restoration completed for GitLab" 122 | -------------------------------------------------------------------------------- /upgrade-path.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Script to process a full GitLab upgrade path 4 | # Usage: ./upgrade-path.sh 5 | # Example: ./upgrade-path.sh 16.11.10 6 | 7 | set -e 8 | 9 | if [ -z "$1" ]; then 10 | echo "Usage: $0 " 11 | echo "" 12 | echo "Example: $0 16.11.10" 13 | echo "" 14 | echo "This fetches the upgrade path from https://gitlab-com.gitlab.io/support/toolbox/upgrade-path/" 15 | exit 1 16 | fi 17 | 18 | STARTING_VERSION="$1" 19 | 20 | # Fetch the upgrade path JSON 21 | echo "Fetching upgrade path data..." 22 | JSON_URL="https://gitlab-com.gitlab.io/support/toolbox/upgrade-path/path.json" 23 | 24 | # Check if jq is available 25 | if ! command -v jq &> /dev/null; then 26 | echo "Error: jq is required but not installed. Please install jq first." 27 | exit 1 28 | fi 29 | 30 | # Fetch and parse JSON to build the upgrade path 31 | # We use the "all" field to get all versions >= starting version 32 | JSON_DATA=$(curl -s "$JSON_URL") 33 | 34 | if [ -z "$JSON_DATA" ]; then 35 | echo "Error: Failed to fetch upgrade path data from $JSON_URL" 36 | exit 1 37 | fi 38 | 39 | # Find the first available version >= starting version 40 | # If exact version exists, use it; otherwise find the next higher version 41 | echo "Looking for upgrade path from version $STARTING_VERSION..." 42 | 43 | # Get all available versions 44 | mapfile -t all_available_versions < <(echo "$JSON_DATA" | jq -r '.all[]') 45 | 46 | # Find first version >= STARTING_VERSION using version comparison 47 | actual_start_version="" 48 | for ver in "${all_available_versions[@]}"; do 49 | # Use sort -V to compare versions properly 50 | if printf '%s\n%s' "$STARTING_VERSION" "$ver" | sort -V -C 2>/dev/null; then 51 | actual_start_version="$ver" 52 | break 53 | fi 54 | done 55 | 56 | # Check if we found a valid starting version 57 | if [ -z "$actual_start_version" ]; then 58 | echo "Error: No available version found >= $STARTING_VERSION" 59 | echo "Latest available version is: ${all_available_versions[-1]}" 60 | exit 1 61 | fi 62 | 63 | # Inform user if we're using a different version than requested 64 | if [ "$actual_start_version" != "$STARTING_VERSION" ]; then 65 | echo "Version $STARTING_VERSION not found in available versions." 66 | echo "Using next available version: $actual_start_version" 67 | echo "" 68 | fi 69 | 70 | # Build upgrade path: 71 | # 1. Get all versions from "all" field 72 | # 2. Find the index of actual starting version 73 | # 3. Take all versions after (and including) that version 74 | mapfile -t versions_array < <(echo "$JSON_DATA" | jq -r --arg v "$actual_start_version" ' 75 | .all as $all | 76 | ($all | index($v)) as $start_idx | 77 | $all[$start_idx:] | .[] 78 | ') 79 | 80 | # If no versions found in upgrade path, error 81 | if [ ${#versions_array[@]} -eq 0 ]; then 82 | echo "Error: No upgrade path found from version $STARTING_VERSION" 83 | echo "Starting version may already be the latest." 84 | exit 1 85 | fi 86 | 87 | echo "========================================" 88 | echo "Processing upgrade path from GitLab Upgrade Path Tool" 89 | echo "https://gitlab-com.gitlab.io/support/toolbox/upgrade-path/" 90 | echo "=========================================" 91 | echo "" 92 | echo "Versions in path:" 93 | for v in "${versions_array[@]}"; do 94 | echo " - $v" 95 | done 96 | echo "" 97 | 98 | # Get script directory 99 | SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 100 | MANIFEST_FILE="$SCRIPT_DIR/manifest.toml" 101 | 102 | echo "Cleaning up old versioned sources from manifest.toml..." 103 | # Remove all versioned sources (v*_*_*) from manifest, keeping only latest_* entries 104 | # Find the line with the first versioned source comment 105 | first_versioned_line=$(grep -n "^\s*# GitLab [0-9]" "$MANIFEST_FILE" | head -n1 | cut -d: -f1) 106 | 107 | if [ -n "$first_versioned_line" ]; then 108 | # Keep everything before the first versioned source comment 109 | head -n $((first_versioned_line - 1)) "$MANIFEST_FILE" > "${MANIFEST_FILE}.tmp" 110 | mv "${MANIFEST_FILE}.tmp" "$MANIFEST_FILE" 111 | echo "Removed all versioned sources" 112 | else 113 | echo "No versioned sources to remove" 114 | fi 115 | echo "" 116 | 117 | # Process all versions 118 | total=${#versions_array[@]} 119 | for i in "${!versions_array[@]}"; do 120 | ver="${versions_array[$i]}" 121 | 122 | if [ $i -eq $((total - 1)) ]; then 123 | # Last version: update latest 124 | echo "=========================================" 125 | echo "[$((i+1))/$total] Processing final version: $ver (updating latest)" 126 | echo "=========================================" 127 | "$SCRIPT_DIR/upgrade-versions.sh" "$ver" 128 | else 129 | # Intermediate version: add-only 130 | echo "=========================================" 131 | echo "[$((i+1))/$total] Processing intermediate version: $ver (add-only)" 132 | echo "=========================================" 133 | "$SCRIPT_DIR/upgrade-versions.sh" "$ver" --add-only 134 | fi 135 | 136 | echo "" 137 | done 138 | 139 | echo "=========================================" 140 | echo "✓ Upgrade path processing complete!" 141 | echo "=========================================" 142 | echo "" 143 | echo "All versions have been processed:" 144 | for v in "${versions_array[@]}"; do 145 | echo " ✓ $v" 146 | done 147 | echo "" 148 | echo "Please review the changes:" 149 | echo " git diff manifest.toml conf/gitlab.rb" 150 | -------------------------------------------------------------------------------- /scripts/install: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source _common.sh 4 | source /usr/share/yunohost/helpers 5 | 6 | #================================================= 7 | # INITIALIZE AND STORE SETTINGS 8 | #================================================= 9 | ynh_script_progression "Storing installation settings..." 10 | 11 | config_path=/etc/$app 12 | 13 | # Could be an option? 14 | client_max_body_size="250m" 15 | 16 | ynh_app_setting_set --key=client_max_body_size --value=$client_max_body_size 17 | ynh_app_setting_set --key=overwrite_nginx --value="1" 18 | ynh_app_setting_set --key=protect_against_basic_auth_spoofing --value=false 19 | 20 | #================================================= 21 | # ADD SWAP IF NEEDED 22 | #================================================= 23 | 24 | total_ram=$(ynh_get_ram --total) 25 | swap_needed=0 26 | 27 | # https://docs.gitlab.com/ce/install/requirements.html#memory 28 | # Need at least 2Go of swap 29 | if [ $total_ram -lt 4096 ]; then 30 | swap_needed=2048 31 | fi 32 | 33 | if [ $swap_needed -gt 0 ]; then 34 | ynh_script_progression "Adding $swap_needed Mo to swap..." 35 | if ! ynh_add_swap --size=$swap_needed; then 36 | ynh_print_warn "Please add $swap_needed Mo to swap to make GitLab work properly" 37 | fi 38 | fi 39 | 40 | #================================================= 41 | # CHECK IF KERNEL IS READ-ONLY 42 | #================================================= 43 | 44 | modify_kernel_parameters="true" 45 | 46 | for value_to_check in "kernel.shmall" "kernel.shmmax" "kernel.sem" "net.core.somaxconn" 47 | do 48 | if ! ynh_hide_warnings sysctl --write $value_to_check="$(sysctl --value $value_to_check)"; then 49 | modify_kernel_parameters="false" 50 | break 51 | fi 52 | done 53 | 54 | #================================================= 55 | # PRECONFIGURE GITLAB 56 | #================================================= 57 | ynh_script_progression "Preconfigure GitLab..." 58 | 59 | mkdir -p $config_path 60 | 61 | touch "$config_path/gitlab-persistent.rb" 62 | chown root:root "$config_path/gitlab-persistent.rb" 63 | chmod 640 "$config_path/gitlab-persistent.rb" 64 | 65 | ssh_port=$(grep -P "Port\s+\d+" /etc/ssh/sshd_config | grep -P -o "\d+") 66 | 67 | generated_external_url="https://$domain${path%/}" 68 | 69 | ynh_config_add --template="$YNH_APP_BASEDIR/conf/gitlab.rb" --destination="$config_path/gitlab.rb" 70 | 71 | #================================================= 72 | # DOWNLOAD, CHECK AND UNPACK SOURCE 73 | #================================================= 74 | ynh_script_progression "Setting up source files..." 75 | 76 | tempdir="$(mktemp -d)" 77 | 78 | ynh_setup_source --dest_dir=$tempdir --source_id="latest_$(lsb_release -sc)" 79 | 80 | chmod 755 $install_dir 81 | # https://docs.gitlab.com/omnibus/settings/configuration.html#specify-the-external-url-at-the-time-of-installation 82 | if ! EXTERNAL_URL="$generated_external_url" ynh_hide_warnings dpkg -i $tempdir/gitlab-ce.deb; then 83 | package_check_action 84 | EXTERNAL_URL="$generated_external_url" ynh_hide_warnings dpkg --configure gitlab-ce 85 | fi 86 | 87 | ynh_safe_rm "$tempdir" 88 | 89 | #================================================= 90 | # NGINX CONFIGURATION 91 | #================================================= 92 | ynh_script_progression "Configuring NGINX web server..." 93 | 94 | # Create a dedicated NGINX config 95 | ynh_config_add_nginx client_max_body_size 96 | 97 | #================================================= 98 | # SPECIFIC SETUP 99 | #================================================= 100 | # ADD USER AND CONFIGURE SIGN IN SYSTEM 101 | #================================================= 102 | ynh_script_progression "Creating an administrator user..." 103 | 104 | mailAdmin=$(ynh_user_get_info --username=$admin --key=mail) 105 | fullnameAdmin=$(ynh_user_get_info --username=$admin --key=fullname) 106 | rdmPass=$(ynh_string_random --length=30) 107 | 108 | gitlab-rails runner "newuser = User.new(username: \"$admin\", email: \"$mailAdmin\", name: \"$fullnameAdmin\", password: \"$rdmPass\", admin: true, skip_confirmation: true);\ 109 | newuser.assign_personal_namespace(Organizations::Organization.default_organization);\ 110 | newuser.save!;\ 111 | ApplicationSetting.last.update(password_authentication_enabled_for_web: $use_web_account, signup_enabled: $use_web_account);" 112 | 113 | #================================================= 114 | # RECONFIGURE TO TAKE INTO ACCOUNT CHANGES 115 | #================================================= 116 | ynh_script_progression "Reconfigure GitLab..." 117 | 118 | ynh_hide_warnings gitlab-ctl reconfigure 119 | 120 | # Allow ssh for git 121 | usermod -a -G "ssh.app" "git" 122 | 123 | #================================================= 124 | # ADVERTISE SERVICE IN ADMIN PANEL 125 | #================================================= 126 | 127 | yunohost service add "gitlab-runsvdir" --log "/var/log/$app/gitlab-rails/application.log" "/var/log/$app/gitlab-rails/api_json.log" "/var/log/$app/gitlab-rails/production.log" "/var/log/$app/gitlab-rails/production_json.log" "/var/log/$app/gitlab-rails/sidekiq.log" "/var/log/$app/puma/puma_stderr.log" "/var/log/$app/puma/current" "/var/log/$app/alertmanager/current" "/var/log/$app/gitaly/current" "/var/log/$app/gitlab-monitor/current" "/var/log/$app/gitlab-shell/gitlab-shell.log" "/var/log/$app/gitlab-workhorse/current" "/var/log/$app/logrotate/current" "/var/log/$app/nginx/current" "/var/log/$app/nginx/access.log" "/var/log/$app/nginx/error.log" "/var/log/$app/nginx/gitlab_access.log" "/var/log/$app/nginx/gitlab_error.log" "/var/log/$app/node-exporter/current" "/var/log/$app/postgres-exporter/current" "/var/log/$app/postgresql/current" "/var/log/$app/prometheus/current" "/var/log/$app/redis/current" "/var/log/$app/redis-exporter/current" 128 | 129 | #================================================= 130 | # RELOAD NGINX 131 | #================================================= 132 | 133 | ynh_systemctl --action=reload --service=nginx 134 | 135 | #================================================= 136 | # RESTART GITLAB 137 | #================================================= 138 | ynh_script_progression "Restarting GitLab..." 139 | 140 | ynh_systemctl --action=restart --service="gitlab-runsvdir" --log_path="/var/log/$app/puma/current" --wait_until="Listening on http://127.0.0.1:$port_puma" --timeout=300 141 | 142 | #================================================= 143 | # END OF SCRIPT 144 | #================================================= 145 | 146 | ynh_script_progression "Installation of GitLab completed" 147 | -------------------------------------------------------------------------------- /scripts/upgrade: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source _common.sh 4 | source /usr/share/yunohost/helpers 5 | 6 | #================================================= 7 | # ENSURE DOWNWARD COMPATIBILITY 8 | #================================================= 9 | 10 | config_path=/etc/$app 11 | chmod 755 $install_dir 12 | 13 | # If client_max_body_size doesn't exist, create it 14 | if [ -z "$client_max_body_size" ]; then 15 | client_max_body_size="250m" 16 | ynh_app_setting_set --key=client_max_body_size --value=$client_max_body_size 17 | fi 18 | 19 | ynh_app_setting_set --key=protect_against_basic_auth_spoofing --value=false 20 | 21 | if ynh_app_upgrading_from_version_before 16.9.0~ynh1 22 | then 23 | ynh_die "Upgrading from Gitlab < 16.9 is not supported anymore. You should first upgrade using: yunohost app upgrade gitlab -u https://github.com/YunoHost-Apps/gitlab_ynh/commit/07e234db66c9c2b58cf378f87746af3f968140f1" 24 | fi 25 | 26 | #================================================= 27 | # ADD SWAP IF NEEDED 28 | #================================================= 29 | 30 | total_ram=$(ynh_get_ram --total) 31 | swap_needed=0 32 | 33 | # https://docs.gitlab.com/ce/install/requirements.html#memory 34 | # Need at least 2Go of swap 35 | if [ $total_ram -lt 4096 ]; then 36 | swap_needed=2048 37 | fi 38 | 39 | if [ $swap_needed -gt 0 ]; then 40 | ynh_script_progression "Adding $swap_needed Mo to swap..." 41 | if ! ynh_add_swap --size=$swap_needed; then 42 | ynh_print_warn "Please add $swap_needed Mo to swap to make GitLab work properly" 43 | fi 44 | fi 45 | 46 | #================================================= 47 | # CHECK IF KERNEL IS READ-ONLY 48 | #================================================= 49 | 50 | modify_kernel_parameters="true" 51 | 52 | for value_to_check in "kernel.shmall" "kernel.shmmax" "kernel.sem" "net.core.somaxconn" 53 | do 54 | if ! ynh_hide_warnings sysctl --write $value_to_check="$(sysctl --value $value_to_check)"; then 55 | modify_kernel_parameters="false" 56 | break 57 | fi 58 | done 59 | 60 | # For gitlab rb 61 | 62 | mkdir -p $config_path 63 | ssh_port=$(grep -P "Port\s+\d+" /etc/ssh/sshd_config | grep -P -o "\d+") 64 | 65 | generated_external_url="https://$domain${path%/}" 66 | 67 | #================================================= 68 | # DOWNLOAD, CHECK AND UNPACK SOURCE 69 | #================================================= 70 | 71 | ynh_script_progression "Setting up source files..." 72 | 73 | # To avoid the automatic backup, already performed by YunoHost: https://docs.gitlab.com/omnibus/update/#updating-methods 74 | touch $config_path/skip-auto-backup 75 | 76 | current_version=$(grep gitlab-ce /opt/gitlab/version-manifest.txt | cut -d' ' -f2) 77 | 78 | # Get Debian version 79 | gitlab_debian_version="$(lsb_release -sc)" 80 | 81 | 82 | # Function to get version from a source_id in manifest 83 | get_version_from_source_id() { 84 | local source_id=$1 85 | local debian_version=$2 86 | 87 | # Try to read from manifest for this Debian version 88 | local section="resources.sources.${source_id}_${debian_version}" 89 | 90 | if grep -q "\[${section}\]" "$YNH_APP_BASEDIR/manifest.toml"; then 91 | # Extract URL to get version 92 | local url=$(grep -A 10 "\[${section}\]" "$YNH_APP_BASEDIR/manifest.toml" | grep "amd64.url" | cut -d'"' -f2) 93 | gitlab_version=$(echo "$url" | sed -n 's/.*gitlab-ce_\([0-9.]*\)-ce.0.*/\1/p') 94 | gitlab_source_id="${source_id}_${debian_version}" 95 | return 0 96 | fi 97 | 98 | return 1 99 | } 100 | 101 | # Function to get latest version 102 | get_latest_version() { 103 | local debian_version=$1 104 | get_version_from_source_id "latest" "$debian_version" 105 | } 106 | 107 | # Function to list all available versions for upgrade path 108 | list_upgrade_versions() { 109 | local major_version=$1 110 | 111 | # List all version IDs matching the pattern v{major}_* 112 | grep -o "\[resources\.sources\.v${major_version}_[^]]*\]" "$YNH_APP_BASEDIR/manifest.toml" | \ 113 | sed 's/\[resources\.sources\.v//;s/\]//' | \ 114 | grep "^${major_version}_" | \ 115 | sed 's/_[^_]*$//' | \ 116 | sort -Vu | \ 117 | sed 's/_/\./g' 118 | } 119 | 120 | # Function to find and load next version in upgrade path 121 | source_next_version() { 122 | local current_major=${current_version%%.*} 123 | 124 | # Get all versions for this major release 125 | local versions=$(list_upgrade_versions "$current_major") 126 | 127 | # Find the next version greater than current 128 | local next_version="" 129 | for ver in $versions; do 130 | if dpkg --compare-versions "$ver" "gt" "$current_version"; then 131 | next_version=$ver 132 | break 133 | fi 134 | done 135 | 136 | if [ -n "$next_version" ]; then 137 | # Load this version 138 | local version_id="v$(echo "$next_version" | tr '.' '_')" 139 | if get_version_from_source_id "$version_id" "$gitlab_debian_version"; then 140 | return 0 141 | fi 142 | fi 143 | 144 | # If no next version found in current major, try next major 145 | local next_major=$((current_major + 1)) 146 | versions=$(list_upgrade_versions "$next_major") 147 | 148 | if [ -n "$versions" ]; then 149 | # Get first version of next major 150 | next_version=$(echo "$versions" | head -n1) 151 | local version_id="v$(echo "$next_version" | tr '.' '_')" 152 | if get_version_from_source_id "$version_id" "$gitlab_debian_version"; then 153 | return 0 154 | fi 155 | fi 156 | 157 | # Otherwise use latest 158 | get_latest_version "$gitlab_debian_version" 159 | } 160 | 161 | # Get the latest version from manifest 162 | get_latest_version "$gitlab_debian_version" 163 | last_version=$gitlab_version 164 | 165 | # To upgrade GitLab from a major version A to a major version B, 166 | # we need to follow a specific path described here https://gitlab-com.gitlab.io/support/toolbox/upgrade-path/ 167 | # A.last -> B.first -> -> B.X -> B.Y -> B.last 168 | 169 | # While the current version is not the last version, do an upgrade 170 | while [ "$last_version" != "$current_version" ] 171 | do 172 | # https://docs.gitlab.com/ee/update/background_migrations.html 173 | checkBatchedBackgroundMigration=1 174 | 175 | counter=0 176 | while [ $checkBatchedBackgroundMigration -eq 1 ] 177 | do 178 | counter=$((counter + 1)) 179 | if [ $counter -gt 1200 ] 180 | then 181 | ynh_print_warn "Timeout: a background migration runs for at least 20min !" 182 | break 183 | fi 184 | 185 | if [ $checkBatchedBackgroundMigration -eq 1 ] && gitlab-psql -c "SELECT job_class_name, table_name, column_name, job_arguments FROM batched_background_migrations WHERE status NOT IN(3, 6);" | grep -q -w 0 186 | then 187 | checkBatchedBackgroundMigration=0 188 | fi 189 | ynh_print_info "Wait for the migration in the background to finish" 190 | sleep 1 191 | done 192 | 193 | source_next_version 194 | 195 | ynh_print_info "Upgrade from ${current_version} to ${gitlab_version}" 196 | 197 | tempdir="$(mktemp -d)" 198 | 199 | # Download using YunoHost's automatic architecture detection 200 | ynh_setup_source --dest_dir=$tempdir --source_id="$gitlab_source_id" 201 | 202 | if ! ynh_hide_warnings dpkg -i $tempdir/gitlab-ce.deb; then # This command will fail in lxc env 203 | package_check_action 204 | ynh_hide_warnings dpkg --configure gitlab-ce 205 | fi 206 | 207 | ynh_safe_rm "$tempdir" 208 | 209 | current_version=$(grep gitlab-ce /opt/gitlab/version-manifest.txt | cut -d' ' -f2) 210 | 211 | # Sometimes we need to update the gitlab.rb configuration file in order to migrate to the next version. 212 | current_major_version=${current_version%%.*} 213 | if [ -e "$YNH_APP_BASEDIR/conf/gitlab.$current_major_version.rb" ]; then 214 | ynh_config_add --template="$YNH_APP_BASEDIR/conf/gitlab.$current_major_version.rb" --destination="$config_path/gitlab.rb" 215 | 216 | touch "$config_path/gitlab-persistent.rb" 217 | chown root:root "$config_path/gitlab-persistent.rb" 218 | chmod 640 "$config_path/gitlab-persistent.rb" 219 | 220 | # During large migrations, the logs are too big to be sent to paste.yunohost.org 221 | # Send the reconfigure logs in a file, and if the process succeeds, just delete it. 222 | gitlab-ctl reconfigure > "/tmp/gitlab_upgrade_$current_version.log" 223 | ynh_safe_rm "/tmp/gitlab_upgrade_$current_version.log" 224 | fi 225 | done 226 | 227 | #================================================= 228 | # RECONFIGURE GITLAB 229 | #================================================= 230 | ynh_script_progression "Reconfigure GitLab..." 231 | 232 | ynh_config_add --template="$YNH_APP_BASEDIR/conf/gitlab.rb" --destination="$config_path/gitlab.rb" 233 | 234 | touch "$config_path/gitlab-persistent.rb" 235 | chown root:root "$config_path/gitlab-persistent.rb" 236 | chmod 640 "$config_path/gitlab-persistent.rb" 237 | 238 | ynh_hide_warnings gitlab-ctl reconfigure 239 | 240 | # Allow ssh for git 241 | usermod -a -G "ssh.app" "git" 242 | 243 | #================================================= 244 | # NGINX CONFIGURATION 245 | #================================================= 246 | 247 | # Overwrite the nginx configuration only if it's allowed 248 | if [ $overwrite_nginx -eq 1 ] 249 | then 250 | ynh_script_progression "Configuring NGINX web server..." 251 | # Create a dedicated nginx config 252 | ynh_config_add_nginx client_max_body_size 253 | fi 254 | 255 | #================================================= 256 | # ADVERTISE SERVICE IN ADMIN PANEL 257 | #================================================= 258 | 259 | yunohost service add "gitlab-runsvdir" --log "/var/log/$app/gitlab-rails/application.log" "/var/log/$app/gitlab-rails/api_json.log" "/var/log/$app/gitlab-rails/production.log" "/var/log/$app/gitlab-rails/production_json.log" "/var/log/$app/gitlab-rails/sidekiq.log" "/var/log/$app/puma/puma_stderr.log" "/var/log/$app/puma/current" "/var/log/$app/alertmanager/current" "/var/log/$app/gitaly/current" "/var/log/$app/gitlab-monitor/current" "/var/log/$app/gitlab-shell/gitlab-shell.log" "/var/log/$app/gitlab-workhorse/current" "/var/log/$app/logrotate/current" "/var/log/$app/nginx/current" "/var/log/$app/nginx/access.log" "/var/log/$app/nginx/error.log" "/var/log/$app/nginx/gitlab_access.log" "/var/log/$app/nginx/gitlab_error.log" "/var/log/$app/node-exporter/current" "/var/log/$app/postgres-exporter/current" "/var/log/$app/postgresql/current" "/var/log/$app/prometheus/current" "/var/log/$app/redis/current" "/var/log/$app/redis-exporter/current" 260 | 261 | #================================================= 262 | # WAITING GITLAB 263 | #================================================= 264 | ynh_script_progression "Restarting GitLab..." 265 | 266 | ynh_systemctl --action=restart --service="gitlab-runsvdir" --log_path="/var/log/$app/puma/current" --wait_until="Listening on http://127.0.0.1:$port_puma" --timeout=300 267 | 268 | #================================================= 269 | # RELOAD NGINX 270 | #================================================= 271 | 272 | ynh_systemctl --action=reload --service=nginx 273 | 274 | #================================================= 275 | # END OF SCRIPT 276 | #================================================= 277 | 278 | ynh_script_progression "Upgrade of GitLab completed" 279 | -------------------------------------------------------------------------------- /manifest.toml: -------------------------------------------------------------------------------- 1 | packaging_format = 2 2 | 3 | id = "gitlab" 4 | name = "GitLab" 5 | description.en = "Git-repository manager providing wiki, issue-tracking and CI/CD pipeline features" 6 | description.fr = "Gestionnaire de dépôts Git proposant des fonctionnalités de wiki, suivi de bugs et de pipeline CI/CD" 7 | 8 | version = "18.7.0~ynh1" 9 | 10 | maintainers = ["kay0u"] 11 | 12 | [upstream] 13 | license = "MIT" 14 | website = "https://gitlab.com" 15 | demo = "https://gitlab.com/explore" 16 | admindoc = "https://docs.gitlab.com/" 17 | code = "https://gitlab.com/gitlab-org/gitlab" 18 | cpe = "cpe:2.3:a:gitlab:gitlab" 19 | 20 | [integration] 21 | yunohost = ">= 12.0.9" 22 | helpers_version = "2.1" 23 | architectures = ["amd64", "arm64"] 24 | multi_instance = false 25 | 26 | ldap = true 27 | sso = false 28 | 29 | disk = "500M" 30 | ram.build = "3000M" 31 | ram.runtime = "2000M" 32 | 33 | [install] 34 | [install.domain] 35 | type = "domain" 36 | 37 | [install.path] 38 | type = "path" 39 | default = "/gitlab" 40 | 41 | [install.admin] 42 | type = "user" 43 | 44 | [install.init_main_permission] 45 | help.en = "If your GitLab instance is set to visitors, anyone can see your public repositories." 46 | help.fr = "Si votre instance GitLab est définie sur visiteurs, tout le monde pourra voir vos dépôts publics." 47 | type = "group" 48 | default = "visitors" 49 | 50 | [install.use_web_account] 51 | ask.en = "Authorize account creation from GitLab web interface" 52 | ask.fr = "Autoriser la création de compte depuis l'interface web de GitLab ?" 53 | type = "boolean" 54 | default = false 55 | 56 | [resources] 57 | [resources.system_user] 58 | 59 | [resources.install_dir] 60 | dir = "/opt/__APP__" 61 | owner = "root:rwx" 62 | group = "root:rx" 63 | 64 | [resources.permissions] 65 | main.url = "/" 66 | # Fix #264 and #267 67 | main.auth_header = false 68 | 69 | [resources.ports] 70 | main.default = 8080 71 | puma.default = 8081 72 | sidekiq.default = 8082 73 | 74 | [resources.apt] 75 | packages = "openssh-server" 76 | 77 | [resources.sources] 78 | [resources.sources.latest_bookworm] 79 | extract = false 80 | rename = "gitlab-ce.deb" 81 | amd64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bookworm/gitlab-ce_18.7.0-ce.0_amd64.deb/download.deb" 82 | amd64.sha256 = "b7215bdf07ecc61cc869ef0779cdef30fa03edb89a565aa5a84da6ad71bef21e" 83 | arm64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bookworm/gitlab-ce_18.7.0-ce.0_arm64.deb/download.deb" 84 | arm64.sha256 = "bb4476a3f0564a6db6ee9c525f707f0df9766faf76098f251beb01f05c260634" 85 | 86 | [resources.sources.latest_bullseye] 87 | extract = false 88 | rename = "gitlab-ce.deb" 89 | amd64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bullseye/gitlab-ce_18.7.0-ce.0_amd64.deb/download.deb" 90 | amd64.sha256 = "d687d74ce3c30e91f8ed460a6787a32011892475b50bdb863c1310505fbb54ae" 91 | arm64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bullseye/gitlab-ce_18.7.0-ce.0_arm64.deb/download.deb" 92 | arm64.sha256 = "fcaff690fb2ad50939ca1bf048b22a4d9d41f355930381c1ed510aeb688b0667" 93 | 94 | [resources.sources.latest_trixie] 95 | extract = false 96 | rename = "gitlab-ce.deb" 97 | amd64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/trixie/gitlab-ce_18.7.0-ce.0_amd64.deb/download.deb" 98 | amd64.sha256 = "28751b810521bc1ae78d29477e3fef050b063b2600ae447fa76331ce76582f2c" 99 | arm64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/trixie/gitlab-ce_18.7.0-ce.0_arm64.deb/download.deb" 100 | arm64.sha256 = "d1db67f028a625bfc781e5429ccbd2305409edc9d8a54fe879083cc865f653ad" 101 | 102 | # GitLab 18.5.4 103 | [resources.sources.v18_5_4_bullseye] 104 | prefetch = false 105 | extract = false 106 | rename = "gitlab-ce.deb" 107 | amd64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bullseye/gitlab-ce_18.5.4-ce.0_amd64.deb/download.deb" 108 | amd64.sha256 = "f283107847f151b8c15e428a8fb0b5bbd0cad2079b698621227aa2b674fcce25" 109 | arm64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bullseye/gitlab-ce_18.5.4-ce.0_arm64.deb/download.deb" 110 | arm64.sha256 = "1f4476f0fd5458015915aff8a5457675f56a4b7fac7c8dd67b375b53f920538d" 111 | 112 | [resources.sources.v18_5_4_bookworm] 113 | prefetch = false 114 | extract = false 115 | rename = "gitlab-ce.deb" 116 | amd64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bookworm/gitlab-ce_18.5.4-ce.0_amd64.deb/download.deb" 117 | amd64.sha256 = "1c59b604f41fc76392d3fa3842f6b81898a4f628c16dd7ad75173dc1aa370709" 118 | arm64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bookworm/gitlab-ce_18.5.4-ce.0_arm64.deb/download.deb" 119 | arm64.sha256 = "b1556ca4cfa1cd39aa5c203f709d8f96429d52fc2dab8b03c0faa193497e5853" 120 | 121 | [resources.sources.v18_5_4_trixie] 122 | prefetch = false 123 | extract = false 124 | rename = "gitlab-ce.deb" 125 | amd64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/trixie/gitlab-ce_18.5.4-ce.0_amd64.deb/download.deb" 126 | amd64.sha256 = "d971359dea71ef9987a8e7381e0981384d6251070b650b8b3ce21d04f57a9b84" 127 | arm64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/trixie/gitlab-ce_18.5.4-ce.0_arm64.deb/download.deb" 128 | arm64.sha256 = "03ea061a7b49ed305e2ee67a7a551e2c22c14cafe1b1341cceded6f0a91c02d4" 129 | 130 | # GitLab 18.2.8 131 | [resources.sources.v18_2_8_bullseye] 132 | prefetch = false 133 | extract = false 134 | rename = "gitlab-ce.deb" 135 | amd64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bullseye/gitlab-ce_18.2.8-ce.0_amd64.deb/download.deb" 136 | amd64.sha256 = "12113a6681b54475eba340d383f618485fc96285ae8480db8ac57b476b62fc2b" 137 | arm64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bullseye/gitlab-ce_18.2.8-ce.0_arm64.deb/download.deb" 138 | arm64.sha256 = "a8e861a3c635c15698367561b0397e5a175a0c06fe333be9af6ff73ea3d8dfd4" 139 | 140 | [resources.sources.v18_2_8_bookworm] 141 | prefetch = false 142 | extract = false 143 | rename = "gitlab-ce.deb" 144 | amd64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bookworm/gitlab-ce_18.2.8-ce.0_amd64.deb/download.deb" 145 | amd64.sha256 = "417da6fb09c1c4bc46123d9aac564bc6f10faf8e1cfa50e6bb9fe54ec9e8b111" 146 | arm64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bookworm/gitlab-ce_18.2.8-ce.0_arm64.deb/download.deb" 147 | arm64.sha256 = "47340403d3052a96d96312552287982f827b69435bb5c846ee154fee4706a78d" 148 | 149 | # GitLab 17.11.7 150 | [resources.sources.v17_11_7_bullseye] 151 | prefetch = false 152 | extract = false 153 | rename = "gitlab-ce.deb" 154 | amd64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bullseye/gitlab-ce_17.11.7-ce.0_amd64.deb/download.deb" 155 | amd64.sha256 = "ab220bf229c521fe7c3896df9b29affa13104296d087c33fd662090de82e7af7" 156 | arm64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bullseye/gitlab-ce_17.11.7-ce.0_arm64.deb/download.deb" 157 | arm64.sha256 = "cee043aec23d520731dddfadf784a70171064e351ededa64ced966959491723e" 158 | 159 | [resources.sources.v17_11_7_bookworm] 160 | prefetch = false 161 | extract = false 162 | rename = "gitlab-ce.deb" 163 | amd64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bookworm/gitlab-ce_17.11.7-ce.0_amd64.deb/download.deb" 164 | amd64.sha256 = "8579324f987f5539743e01a12a062d798c2b03f177cfc85fed3cb7c7f2e80822" 165 | arm64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bookworm/gitlab-ce_17.11.7-ce.0_arm64.deb/download.deb" 166 | arm64.sha256 = "c37707697a3313c5ed58c90152bbe286e94bb15e7925e23fc703062f1bb78df9" 167 | 168 | # GitLab 17.8.7 169 | [resources.sources.v17_8_7_bullseye] 170 | prefetch = false 171 | extract = false 172 | rename = "gitlab-ce.deb" 173 | amd64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bullseye/gitlab-ce_17.8.7-ce.0_amd64.deb/download.deb" 174 | amd64.sha256 = "f89b639420a28a4249a82f0ba56d244dbc8e6a6df3f06c6e44c86ee366222e99" 175 | arm64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bullseye/gitlab-ce_17.8.7-ce.0_arm64.deb/download.deb" 176 | arm64.sha256 = "9190058d823f2295ed4632cb5fa2227e128e354254d80500838d10635e4bd704" 177 | 178 | [resources.sources.v17_8_7_bookworm] 179 | prefetch = false 180 | extract = false 181 | rename = "gitlab-ce.deb" 182 | amd64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bookworm/gitlab-ce_17.8.7-ce.0_amd64.deb/download.deb" 183 | amd64.sha256 = "b79063815bbf25f6461c55614f8ca1c2addc5f2b1a5dc6f8935d6af678c2f892" 184 | arm64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bookworm/gitlab-ce_17.8.7-ce.0_arm64.deb/download.deb" 185 | arm64.sha256 = "851d75bbc1f60d3e6a22d0e7f2f3135ae0dcac4d44a32edab30ca9607a6df6ad" 186 | 187 | # GitLab 17.5.5 188 | [resources.sources.v17_5_5_bullseye] 189 | prefetch = false 190 | extract = false 191 | rename = "gitlab-ce.deb" 192 | amd64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bullseye/gitlab-ce_17.5.5-ce.0_amd64.deb/download.deb" 193 | amd64.sha256 = "b0f40eb8a2d55634cff59125304df1fa1fda1601dec1bf3547a4351aabd81221" 194 | arm64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bullseye/gitlab-ce_17.5.5-ce.0_arm64.deb/download.deb" 195 | arm64.sha256 = "8b9e8722e064889f9e20f781e61356ce8035cec5fe4cbe255b6aba97e7a7067c" 196 | 197 | [resources.sources.v17_5_5_bookworm] 198 | prefetch = false 199 | extract = false 200 | rename = "gitlab-ce.deb" 201 | amd64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bookworm/gitlab-ce_17.5.5-ce.0_amd64.deb/download.deb" 202 | amd64.sha256 = "cce4ebff28a0b76152922b09a2cb67fd4bc0cfdff22185654135bb93ce658bcf" 203 | arm64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bookworm/gitlab-ce_17.5.5-ce.0_arm64.deb/download.deb" 204 | arm64.sha256 = "51c8ca34a1c2d24b209b74f6f5dbf4e446d61cbe85de51f56c010e116c2468b3" 205 | 206 | # GitLab 17.3.7 207 | [resources.sources.v17_3_7_bullseye] 208 | prefetch = false 209 | extract = false 210 | rename = "gitlab-ce.deb" 211 | amd64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bullseye/gitlab-ce_17.3.7-ce.0_amd64.deb/download.deb" 212 | amd64.sha256 = "e78c276952c6202c23b9baac8afe05ebcaf1c5f2639e51865157e5ebddbb9554" 213 | arm64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bullseye/gitlab-ce_17.3.7-ce.0_arm64.deb/download.deb" 214 | arm64.sha256 = "f22a39ea10275d7be6b0abe02728ae92f99afdcce2220d1d6cf802332375b1f8" 215 | 216 | [resources.sources.v17_3_7_bookworm] 217 | prefetch = false 218 | extract = false 219 | rename = "gitlab-ce.deb" 220 | amd64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bookworm/gitlab-ce_17.3.7-ce.0_amd64.deb/download.deb" 221 | amd64.sha256 = "26ad3fd4533e648d8a0e393ef95c761da486aca6d84295c8ba99d0ee6afa989e" 222 | arm64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bookworm/gitlab-ce_17.3.7-ce.0_arm64.deb/download.deb" 223 | arm64.sha256 = "7fc3fc2b589f7f270f04d03bf0286d0b271f33346f521dc1174ced9d9b4d2561" 224 | 225 | # GitLab 17.1.8 226 | [resources.sources.v17_1_8_bullseye] 227 | prefetch = false 228 | extract = false 229 | rename = "gitlab-ce.deb" 230 | amd64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bullseye/gitlab-ce_17.1.8-ce.0_amd64.deb/download.deb" 231 | amd64.sha256 = "4aeefcae5fc886a83a5bca02f96b9ea15390d19f3dd5e60f43971d8e373830b3" 232 | arm64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bullseye/gitlab-ce_17.1.8-ce.0_arm64.deb/download.deb" 233 | arm64.sha256 = "fbbcad2475101deb46c2bdba3cf5cac01ac0816b23f0e1dea682912ce85d5b30" 234 | 235 | [resources.sources.v17_1_8_bookworm] 236 | prefetch = false 237 | extract = false 238 | rename = "gitlab-ce.deb" 239 | amd64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bookworm/gitlab-ce_17.1.8-ce.0_amd64.deb/download.deb" 240 | amd64.sha256 = "6a0c4466d43692491d3bd63a66f411ede7114ed73cc0d71649c0def1d1768e6b" 241 | arm64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bookworm/gitlab-ce_17.1.8-ce.0_arm64.deb/download.deb" 242 | arm64.sha256 = "64d92f60b00079f40f62dd5248e1bc6a1da0938b0e6fb22c921c4907e93b8b9c" 243 | 244 | # GitLab 16.11.10 245 | [resources.sources.v16_11_10_bullseye] 246 | prefetch = false 247 | extract = false 248 | rename = "gitlab-ce.deb" 249 | amd64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bullseye/gitlab-ce_16.11.10-ce.0_amd64.deb/download.deb" 250 | amd64.sha256 = "f069370fd9d8a893a628a66a1ea4e4d857440ab0fea43d289d2177182b65e0da" 251 | arm64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bullseye/gitlab-ce_16.11.10-ce.0_arm64.deb/download.deb" 252 | arm64.sha256 = "3da28c1d1d4f88e39bfc546a621aee984f5a90072f3dd8756587fa7b9c70aa40" 253 | 254 | [resources.sources.v16_11_10_bookworm] 255 | prefetch = false 256 | extract = false 257 | rename = "gitlab-ce.deb" 258 | amd64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bookworm/gitlab-ce_16.11.10-ce.0_amd64.deb/download.deb" 259 | amd64.sha256 = "4312fe0d2be18beaf3af927ed6e34cb5a4048275315c5415922adc600650c52f" 260 | arm64.url = "https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bookworm/gitlab-ce_16.11.10-ce.0_arm64.deb/download.deb" 261 | arm64.sha256 = "5bc3c67dad538665ba11269fc7d1eb21234171822381f11d0d17b242fe5c8067" 262 | 263 | 264 | -------------------------------------------------------------------------------- /upgrade-versions.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Script to upgrade GitLab version in manifest.toml 4 | # Usage: ./upgrade-versions.sh [--add-only] 5 | # Example: ./upgrade-versions.sh 18.6.0 6 | # Example: ./upgrade-versions.sh 18.4.0 --add-only (add old version without updating latest) 7 | 8 | set -e 9 | 10 | # Function to compare versions (returns 0 if v1 > v2, 1 otherwise) 11 | version_gt() { 12 | local v1=$1 13 | local v2=$2 14 | 15 | # Use sort -V (version sort) to compare 16 | if [ "$(printf '%s\n%s\n' "$v1" "$v2" | sort -V | tail -n1)" = "$v1" ] && [ "$v1" != "$v2" ]; then 17 | return 0 18 | else 19 | return 1 20 | fi 21 | } 22 | 23 | if [ -z "$1" ]; then 24 | echo "Usage: $0 [--add-only]" 25 | echo "" 26 | echo "Options:" 27 | echo " GitLab version to add/update (e.g., 18.6.0)" 28 | echo " --add-only Add version sources without updating latest_* entries" 29 | echo "" 30 | echo "Examples:" 31 | echo " $0 18.6.0 # Update to latest version" 32 | echo " $0 18.4.0 --add-only # Add old version for upgrade path" 33 | exit 1 34 | fi 35 | 36 | version=$1 37 | add_only=false 38 | 39 | if [ "$2" = "--add-only" ]; then 40 | add_only=true 41 | fi 42 | current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 43 | manifest_file="$current_dir/manifest.toml" 44 | 45 | # Create version identifier for TOML section name (e.g., "18.6.0" -> "v18_5_1") 46 | version_id="v$(echo "$version" | tr '.' '_')" 47 | 48 | debian_versions=("bullseye" "bookworm" "trixie") 49 | architectures=("amd64" "arm64") 50 | 51 | if [ "$add_only" = true ]; then 52 | echo "=========================================" 53 | echo "Adding GitLab version $version to sources" 54 | echo "(without updating latest)" 55 | echo "=========================================" 56 | else 57 | echo "=========================================" 58 | echo "Upgrading GitLab to version $version" 59 | echo "=========================================" 60 | fi 61 | echo "" 62 | 63 | # Function to fetch SHA256 from GitLab packages website (silently) 64 | fetch_sha256() { 65 | local debian_version=$1 66 | local architecture=$2 67 | local url="https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/${debian_version}/gitlab-ce_${version}-ce.0_${architecture}.deb" 68 | 69 | local sha256=$(curl -s "$url" | sed -n '/SHA256$/,/<\/tr>$/{ /SHA256$/d; /<\/tr>$/d; p; }' | cut -d$'\n' -f3 | xargs) 70 | 71 | # Return empty string if not found (for optional versions like trixie on older releases) 72 | echo "$sha256" 73 | } 74 | 75 | # Fetch all SHA256s 76 | declare -A sha256_map 77 | 78 | echo "Fetching SHA256 checksums..." 79 | echo "" 80 | 81 | for debian_version in "${debian_versions[@]}"; do 82 | for arch in "${architectures[@]}"; do 83 | echo -n " $debian_version/$arch ... " 84 | key="${debian_version}_${arch}" 85 | sha256_map[$key]=$(fetch_sha256 "$debian_version" "$arch") 86 | 87 | if [ -z "${sha256_map[$key]}" ]; then 88 | echo "NOT AVAILABLE (skipping $debian_version for this version)" 89 | else 90 | echo "${sha256_map[$key]}" 91 | fi 92 | done 93 | done 94 | 95 | echo "" 96 | echo "Updating manifest.toml..." 97 | echo "" 98 | 99 | if [ "$add_only" = false ]; then 100 | # Update version 101 | sed -i "s/^version = \"[0-9.]*~ynh[0-9]*\"/version = \"${version}~ynh1\"/" "$manifest_file" 102 | 103 | # Update all latest_* sections for each debian version 104 | for debian_version in "${debian_versions[@]}"; do 105 | # Skip if SHA256 not available (e.g., trixie for older versions) 106 | if [ -z "${sha256_map[${debian_version}_amd64]}" ]; then 107 | continue 108 | fi 109 | 110 | # Add missing latest_* section if it doesn't exist 111 | if ! grep -q "\[resources\.sources\.latest_${debian_version}\]" "$manifest_file"; then 112 | # Find where to insert - after the last latest_* section but before system_user or versioned sources 113 | last_latest_line=$(grep -n "\[resources\.sources\.latest_" "$manifest_file" | tail -n1 | cut -d: -f1) 114 | if [ -n "$last_latest_line" ]; then 115 | # Find empty line or next section after last latest_* to get the end of that section 116 | insert_line=$(tail -n +$((last_latest_line + 1)) "$manifest_file" | grep -n "^$" | head -n1 | cut -d: -f1) 117 | if [ -n "$insert_line" ]; then 118 | insert_line=$((last_latest_line + insert_line)) 119 | else 120 | # If no empty line found, just add after 5 lines (approximate section length) 121 | insert_line=$((last_latest_line + 5)) 122 | fi 123 | 124 | # Insert debian version section 125 | { 126 | head -n "$insert_line" "$manifest_file" 127 | echo " [resources.sources.latest_${debian_version}]" 128 | echo " extract = false" 129 | echo " rename = \"gitlab-ce.deb\"" 130 | for arch in "${architectures[@]}"; do 131 | echo " ${arch}.url = \"https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/${debian_version}/gitlab-ce_${version}-ce.0_${arch}.deb/download.deb\"" 132 | echo " ${arch}.sha256 = \"${sha256_map[${debian_version}_${arch}]}\"" 133 | done 134 | echo "" 135 | tail -n +$((insert_line + 1)) "$manifest_file" 136 | } > "${manifest_file}.tmp" 137 | mv "${manifest_file}.tmp" "$manifest_file" 138 | fi 139 | fi 140 | 141 | # Update URLs and SHA256s for this debian version 142 | for arch in "${architectures[@]}"; do 143 | sed -i "/\[resources\.sources\.latest_${debian_version}\]/,/\[resources\.sources\./ { 144 | s|${arch}\.url = \"https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/${debian_version}/gitlab-ce_[^\"]*\"|${arch}.url = \"https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/${debian_version}/gitlab-ce_${version}-ce.0_${arch}.deb/download.deb\"| 145 | s|${arch}\.sha256 = \"[^\"]*\"|${arch}.sha256 = \"${sha256_map[${debian_version}_${arch}]}\"| 146 | }" "$manifest_file" 147 | done 148 | done 149 | fi 150 | 151 | # Add new versioned sources only if --add-only is used 152 | if [ "$add_only" = true ]; then 153 | # Check if this version already exists (any debian version) 154 | if ! grep -q "\\[resources.sources.${version_id}_" "$manifest_file"; then 155 | # Find where to insert based on version comparison 156 | # Parse all existing versions and find the right position 157 | insert_line="" 158 | 159 | # Get all existing GitLab version comments with their line numbers 160 | existing_versions=$(grep -n "^\s*# GitLab [0-9]" "$manifest_file" || true) 161 | 162 | if [ -n "$existing_versions" ]; then 163 | # Find the first version that is less than our new version 164 | while IFS=: read -r line_num version_line; do 165 | existing_ver=$(echo "$version_line" | grep -oP "GitLab \K[0-9.]+") 166 | 167 | # Compare versions: if new version is greater, insert before this one 168 | if version_gt "$version" "$existing_ver"; then 169 | insert_line=$((line_num - 1)) 170 | break 171 | fi 172 | done <<< "$existing_versions" 173 | fi 174 | 175 | # If no position found yet, insert after the last latest_* section 176 | if [ -z "$insert_line" ]; then 177 | # Find the last latest_* section and insert right after it (6 lines: header + 5 properties) 178 | last_latest_line=$(grep -n "^\s*\[resources\.sources\.latest_" "$manifest_file" | tail -n1 | cut -d: -f1) 179 | if [ -n "$last_latest_line" ]; then 180 | insert_line=$((last_latest_line + 6)) 181 | fi 182 | fi 183 | 184 | if [ -n "$insert_line" ]; then 185 | # Create temp file with new content 186 | { 187 | head -n "$insert_line" "$manifest_file" 188 | 189 | # Add an empty line before the comment if this is the first version 190 | # (when inserting after latest_*, there's no empty line yet) 191 | if [ -z "$existing_versions" ]; then 192 | echo "" 193 | fi 194 | 195 | # Add comment 196 | echo " # GitLab $version" 197 | 198 | # Add a section for each debian version that has SHA256 values 199 | for debian_version in "${debian_versions[@]}"; do 200 | # Skip if SHA256 not available 201 | if [ -z "${sha256_map[${debian_version}_amd64]}" ]; then 202 | continue 203 | fi 204 | 205 | echo " [resources.sources.${version_id}_${debian_version}]" 206 | echo " prefetch = false" 207 | echo " extract = false" 208 | echo " rename = \"gitlab-ce.deb\"" 209 | for arch in "${architectures[@]}"; do 210 | echo " ${arch}.url = \"https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/${debian_version}/gitlab-ce_${version}-ce.0_${arch}.deb/download.deb\"" 211 | echo " ${arch}.sha256 = \"${sha256_map[${debian_version}_${arch}]}\"" 212 | done 213 | echo "" 214 | done 215 | 216 | tail -n +$((insert_line + 1)) "$manifest_file" 217 | } > "${manifest_file}.tmp" 218 | 219 | mv "${manifest_file}.tmp" "$manifest_file" 220 | fi 221 | fi 222 | fi 223 | 224 | echo "✓ manifest.toml updated" 225 | echo "" 226 | 227 | if [ "$add_only" = false ]; then 228 | echo "=========================================" 229 | echo "Updating gitlab.rb configuration..." 230 | echo "=========================================" 231 | echo "" 232 | 233 | # Update gitlab.rb 234 | conf_file="$current_dir/conf/gitlab.rb" 235 | url="https://gitlab.com/gitlab-org/omnibus-gitlab/-/raw/${version}+ce.0/files/gitlab-config-template/gitlab.rb.template" 236 | 237 | header="################################################################################ 238 | ################################################################################ 239 | ## FOR YUNOHOST USERS ## 240 | ################################################################################ 241 | ################################################################################ 242 | 243 | # Please do not modify this file, it will be reset with the next update. 244 | # You can create or modify the file: 245 | # /etc/gitlab/gitlab-persistent.rb 246 | # and add all the configuration you want. 247 | # Options you add in gitlab-presistent.rb will overide these one, 248 | # but you can use options and documentations in this file to know what 249 | # is it possible to do. 250 | 251 | ################################################################################ 252 | ################################################################################ 253 | " 254 | 255 | footer=" 256 | from_file '/etc/gitlab/gitlab-persistent.rb'" 257 | 258 | echo "$header" > "$conf_file" 259 | 260 | echo "Downloading GitLab config template from upstream..." 261 | if ! curl -s "$url" >> "$conf_file"; then 262 | echo "ERROR: Failed to download gitlab.rb template" 263 | exit 1 264 | fi 265 | 266 | echo "$footer" >> "$conf_file" 267 | 268 | # Apply YunoHost-specific modifications 269 | echo "Applying YunoHost-specific modifications..." 270 | 271 | # Change external url 272 | sed -i "s/external_url 'GENERATED_EXTERNAL_URL'/external_url '__GENERATED_EXTERNAL_URL__'/" "$conf_file" 273 | 274 | # Activate ldap 275 | sed -i "s/# gitlab_rails\['ldap_enabled'\] = .*/gitlab_rails['ldap_enabled'] = true/" "$conf_file" 276 | 277 | ldap_conf=" 278 | gitlab_rails['ldap_servers'] = YAML.load <<-'EOS' # remember to close this block with 'EOS' below 279 | main: # 'main' is the GitLab 'provider ID' of this LDAP server 280 | label: 'YunoHost LDAP' 281 | host: 'localhost' 282 | port: 389 283 | uid: 'uid' 284 | encryption: 'plain' # 'start_tls' or 'simple_tls' or 'plain' 285 | bind_dn: 'ou=users,dc=yunohost,dc=org' 286 | password: '' 287 | active_directory: false 288 | allow_username_or_email_login: false 289 | block_auto_created_users: false 290 | base: 'dc=yunohost,dc=org' 291 | user_filter: '(&(objectClass=posixAccount)(permission=cn=gitlab.main,ou=permission,dc=yunohost,dc=org))' 292 | timeout: 10 293 | attributes: { 294 | username: ['uid', 'sAMAccountName'], 295 | name: 'cn', 296 | first_name: 'givenName', 297 | last_name: 'sn' 298 | } 299 | EOS" 300 | 301 | # Add ldap conf 302 | sed -i "/^# EOS/r "<(echo "$ldap_conf") "$conf_file" 303 | 304 | # Change ssh port 305 | sed -i "s/# gitlab_rails\['gitlab_shell_ssh_port'\] = 22/gitlab_rails['gitlab_shell_ssh_port'] = __SSH_PORT__/" "$conf_file" 306 | 307 | # Change puma settings 308 | sed -i "s/# puma\['port'\] = .*/puma['port'] = __PORT_PUMA__/" "$conf_file" 309 | 310 | # Change sidekiq settings 311 | sed -i "s/# sidekiq\['listen_port'\] = .*/sidekiq['listen_port'] = __PORT_SIDEKIQ__/" "$conf_file" 312 | 313 | # Change nginx settings 314 | sed -i "s/# nginx\['client_max_body_size'\] = .*/nginx['client_max_body_size'] = '__CLIENT_MAX_BODY_SIZE__'/" "$conf_file" 315 | sed -i "s/# nginx\['listen_port'\] = .*/nginx['listen_port'] = __PORT__/" "$conf_file" 316 | sed -i "s/# nginx\['listen_https'\] = .*/nginx['listen_https'] = false/" "$conf_file" 317 | 318 | # Change modify kernel parameters settings 319 | sed -i "s/# package\['modify_kernel_parameters'\] = .*/package['modify_kernel_parameters'] = __MODIFY_KERNEL_PARAMETERS__/" "$conf_file" 320 | fi 321 | 322 | echo "" 323 | echo "=========================================" 324 | echo "✓ Update complete!" 325 | echo "=========================================" 326 | echo "" 327 | if [ "$add_only" = true ]; then 328 | echo "Summary:" 329 | echo " - Added new source entries: ${version_id}_bookworm, ${version_id}_trixie and ${version_id}_bullseye" 330 | echo " - latest_bookworm, latest_trixie and latest_bullseye were NOT modified" 331 | echo " - Package version was NOT modified" 332 | echo "" 333 | echo "Please review the changes and commit if everything looks good:" 334 | echo " git diff manifest.toml" 335 | echo " git add manifest.toml" 336 | echo " git commit -m \"Add GitLab $version sources for upgrade path\"" 337 | else 338 | echo "Summary:" 339 | echo " - Updated latest_bookworm, latest_trixie and latest_bullseye to version $version" 340 | echo " - Updated package version to ${version}~ynh1" 341 | echo " - Updated conf/gitlab.rb from upstream" 342 | echo " - No new versioned sources were added" 343 | echo "" 344 | echo "Please review the changes and commit if everything looks good:" 345 | echo " git diff manifest.toml conf/gitlab.rb" 346 | echo " git add manifest.toml conf/gitlab.rb" 347 | echo " git commit -m \"Upgrade to GitLab $version\"" 348 | fi 349 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | --------------------------------------------------------------------------------