Skip to content
Snippets Groups Projects
Commit ebbe7860 authored by Kamil Trzcinski's avatar Kamil Trzcinski
Browse files

Update the OSX service instruction

parent 2cd7f4f4
No related branches found
No related tags found
No related merge requests found
......@@ -212,7 +212,7 @@ func (mr *RunCommand) Start(s service.Service) error {
err := mr.loadConfig()
if err != nil {
panic(err)
return err
}
// Start should not block. Do the actual work async.
......
......@@ -90,7 +90,7 @@ func runServiceStatus(displayName string, s service.Service, c *cli.Context) err
return nil
}
func getServiceArguments(c *cli.Context, isUserService bool) (arguments []string) {
func getServiceArguments(c *cli.Context) (arguments []string) {
if wd := c.String("working-directory"); wd != "" {
arguments = append(arguments, "--working-directory", wd)
}
......@@ -103,53 +103,48 @@ func getServiceArguments(c *cli.Context, isUserService bool) (arguments []string
arguments = append(arguments, "--service", sn)
}
if user := c.String("user"); !isUserService && user != "" {
arguments = append(arguments, "--user", user)
}
arguments = append(arguments, "--syslog")
return
}
func createServiceConfig(c *cli.Context) (svcConfig *service.Config) {
// detect whether we want to install as user service or system service
isUserService := os.Getuid() != 0
if runtime.GOOS == "windows" {
isUserService = true
}
// when installing service as system wide service don't specify username for service
serviceUserName := c.String("user")
if !isUserService {
serviceUserName = ""
}
if isUserService && runtime.GOOS == "linux" {
logrus.Fatal("Please run the commands as root")
}
svcConfig = &service.Config{
Name: c.String("service"),
DisplayName: c.String("service"),
Description: defaultDescription,
Arguments: []string{"run"},
UserName: serviceUserName,
}
svcConfig.Arguments = append(svcConfig.Arguments, getServiceArguments(c, isUserService)...)
svcConfig.Arguments = append(svcConfig.Arguments, getServiceArguments(c)...)
switch runtime.GOOS {
case "linux":
if os.Getuid() != 0 {
logrus.Fatal("Please run the commands as root")
}
if user := c.String("user"); user != "" {
svcConfig.Arguments = append(svcConfig.Arguments, "--user", user)
}
case "darwin":
svcConfig.Option = service.KeyValue{
"KeepAlive": true,
"RunAtLoad": true,
"SessionCreate": true,
"UserService": isUserService,
"KeepAlive": true,
"RunAtLoad": true,
"UserService": os.Getuid() == 0,
}
if user := c.String("user"); user != "" {
if os.Getuid() == 0 {
svcConfig.Arguments = append(svcConfig.Arguments, "--user", user)
} else {
logrus.Fatalln("The --user is not supported for non-root users")
}
}
case "windows":
svcConfig.Option = service.KeyValue{
"Password": c.String("password"),
}
svcConfig.UserName = c.String("user")
}
return
}
......
......@@ -127,3 +127,36 @@ See [an example of a user issue][1105].
[omnibus-ext-nginx]: http://doc.gitlab.com/omnibus/settings/nginx.html#using-a-non-bundled-web-server
[recipes]: https://gitlab.com/gitlab-org/gitlab-recipes/tree/master/web-server
[1105]: https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/issues/1105
## 11. Runner cannot be installed on OSX, because of `"launchctl" failed: exit status 112, Could not find domain for`:
Make sure that you manage GitLab Runner service from the GUI Terminal application, not the SSH connection.
## 12. Runner is stuck on `Failed to authorize rights (0x1) with status: -60007.` when using OSX:
There are two problems why this happens:
1. Make sure that your user can do UI interactions.
```
DevToolsSecurity -enable
sudo security authorizationdb remove system.privilege.taskport is-developer
```
The first command enables access to developer tools for your user.
Second command allows the user, member of developer group to do UI interactions, ex. run iOS simulator.
2. Make sure that your runner service doesn't use `SessionCreate = true`.
Previously when running GitLab Runner as an service we were creating the `LaunchAgents` with `SessionCreate`.
At that point (`Mavericks`) it was the only solution to make Code Signing work,
but recently with introduction of `El Capitan` OSX introduced a lot of new security features which did change this behaviour.
Since GitLab Runner 1.1 when creating a `LaunchAgent` we don't set the `SessionCreate`.
However, in order to upgrade you need to manually reinstall the `LaunchAgent` script:
```
gitlab-ci-multi-runner uninstall
gitlab-ci-multi-runner install
gitlab-ci-multi-runner start
```
Then you can verify that `~/Library/LaunchAgents/gitlab-runner.plist` have `SessionCreate` set to `false`.
......@@ -62,6 +62,8 @@ running already the config should be automatically reloaded!
The runner should is started already and you are ready to build your projects!
Make sure that you read the [FAQ](../faq/README.md) section which describes most common problems with the GitLab Runner.
### Update
Pull the latest version:
......
......@@ -42,4 +42,6 @@ gitlab-ci-multi-runner run
Voila! Runner is currently running, but it will not start automatically after system reboot because BSD startup service is not supported.
**The FreeBSD version is also availble from [Bleeding edge](bleeding-edge.md)**
\ No newline at end of file
**The FreeBSD version is also available from [Bleeding edge](bleeding-edge.md)**
Make sure that you read the [FAQ](../faq/README.md) section which describes most common problems with the GitLab Runner.
......@@ -66,3 +66,5 @@ Start the service:
```bash
sudo gitlab-ci-multi-runner start
```
Make sure that you read the [FAQ](../faq/README.md) section which describes most common problems with the GitLab Runner.
......@@ -50,6 +50,8 @@ running already the config should be automatically reloaded!
The runner should be started already and you are ready to build your projects!
Make sure that you read the [FAQ](../faq/README.md) section which describes most common problems with the GitLab Runner.
### Update
Simply execute to install latest version:
......
......@@ -69,4 +69,35 @@ Start the service:
```bash
gitlab-ci-multi-runner start
```
\ No newline at end of file
```
Make sure that you read the [FAQ](../faq/README.md) section which describes most common problems with the GitLab Runner.
### Limitations on OSX
Currently the only proven to work mode for OSX is running service in user-mode.
**The service needs to be installed from Terminal running GUI interface as your user.
Only then you will be able to manage the service.**
Since the service will be running only when the user is logged in you should enable auto-logging on your OSX machine.
The service will be launched as one of `LaunchAgents`.
By using `LaunchAgents` the builds will be able to do UI interactions,
making it possible to run and test on iOS simulator and also do process instrumentations.
Worth to note is that OSX also have the `LaunchDaemons`, the services running completely in background.
The `LaunchDaemons` are run on system startup, but they don't have the same access to UI interactions as `LaunchAgents`.
You can try to run service as `LaunchDaemon`, but this mode of operation as of now is not supported.
You can verify that runner created service configuration after the executing `install` command
by checking the `~user/Library/LaunchAgents/gitlab-runner.plist` file.
### Upgrade the service file
In order to upgrade the `LaunchAgent` configuration you need to uninstall and install the service:
```
gitlab-ci-multi-runner uninstall
gitlab-ci-multi-runner install
gitlab-ci-multi-runner start
```
......@@ -60,6 +60,8 @@ Start service:
gitlab-ci-multi-runner start
```
Make sure that you read the [FAQ](../faq/README.md) section which describes most common problems with the GitLab Runner.
[x86]: https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-ci-multi-runner-windows-386.exe
[amd64]: https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-ci-multi-runner-windows-amd64.exe
[prompt]: http://pcsupport.about.com/od/windows-8/a/elevated-command-prompt-windows-8.htm
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment