Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add init file for Ubuntu #23362

Merged
merged 3 commits into from Mar 9, 2023
Merged

Conversation

Lycolia
Copy link
Contributor

@Lycolia Lycolia commented Mar 7, 2023

Created an init file for Ubuntu that will be useful when running it on WSL.

@wolfogre
Copy link
Member

wolfogre commented Mar 8, 2023

I'm not familiar with WSL. Could you please show me more context?

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Mar 8, 2023
@codecov-commenter

This comment was marked as off-topic.

@Lycolia
Copy link
Contributor Author

Lycolia commented Mar 8, 2023

WSL stands for Windows Subsystem for Linux, a convenient tool that allows native Linux command-line tools to be run directly on Windows and is utilized by many developers. Ubuntu is generally the preferred distribution for WSL, and solution for such users. Since the use of systemd can cause problems in this environment, I chose as a solution to create an init file that can be used more simply as a daemon. It should also work fine on native Ubuntu.

@silverwind
Copy link
Member

Is there a difference between the debian file and this one?

@Lycolia
Copy link
Contributor Author

Lycolia commented Mar 8, 2023

Yep has difference.
The method of set environment variables at start is different.

diff
--- debian	2023-03-09 00:44:10.810176200 +0900
+++ ubuntu	2023-03-09 00:44:25.400832800 +0900
@@ -1,7 +1,8 @@
 do_start()
 {
-    $USERBIND $DAEMON
-    sh -c "USER=$USER HOME=/home/$USER GITEA_WORK_DIR=$WORKINGDIR start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile \\
+    GITEA_ENVS="USER=$USER GITEA_WORK_DIR=$WORKINGDIR HOME=/home/$USER"
+    GITEA_EXEC="$DAEMON -- $DAEMON_ARGS"
+    sh -c "start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile \\
         --background --chdir $WORKINGDIR --chuid $USER \\
-        --exec $DAEMON -- $DAEMON_ARGS"
+        --exec /bin/bash -- -c '/usr/bin/env $GITEA_ENVS $GITEA_EXEC'"
 }

Environment variables are not setled correctly with the Debian file, and I get the following error.

…s/setting/setting.go:656:loadFromConf() [F] Failed to get home directory: cannot get home directory

FYI: Debian files may not work on Debian.
#9541

Also I'm an Ubuntu user so I made it as Ubuntu file.

@silverwind
Copy link
Member

OK I guess we can leave the debian script, those two OS do sometimes work differently.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Mar 8, 2023
@yardenshoham yardenshoham modified the milestones: 1.19.0, 1.20.0 Mar 8, 2023
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Mar 9, 2023
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Mar 9, 2023
@jolheiser
Copy link
Member

🎺 🤖

@jolheiser jolheiser merged commit 79af6e3 into go-gitea:main Mar 9, 2023
@jolheiser jolheiser removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Mar 9, 2023
@Lycolia Lycolia deleted the add-init-d-for-ubuntu branch March 10, 2023 00:02
zjjhot added a commit to zjjhot/gitea that referenced this pull request Mar 10, 2023
* giteaofficial/main:
  Improve squash merge commit author and co-author with private emails (go-gitea#22977)
  Fix broken Chroma CSS styles (go-gitea#23174)
  Add gradle samples in maven doc of packages (go-gitea#23374)
  Fix and move "Use this template" button (go-gitea#23398)
  [skip ci] Updated translations via Crowdin
  Add init file for Ubuntu (go-gitea#23362)
  Rename `canWriteUnit` to `canWriteProjects` (go-gitea#23386)
  Fix pull request update showing too many commits with multiple branches (go-gitea#22856)
  Fix incorrect NotFound conditions in org/projects.go (go-gitea#23384)
  Refactor merge/update git command calls (go-gitea#23366)
  Redirect to project again after editing it (go-gitea#23326)
  Add Gitea Community Code of Conduct (go-gitea#23188)
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. topic/deployment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants