diff --git a/nfpm/agent.yaml b/nfpm/agent.yaml index 934dc7aab..fb3883d01 100644 --- a/nfpm/agent.yaml +++ b/nfpm/agent.yaml @@ -10,3 +10,7 @@ section: daemon/system contents: - src: ./dist/agent/linux_amd64/woodpecker-agent dst: /usr/local/bin/woodpecker-agent + - src: ./woodpecker-agent.service + dst: /usr/local/lib/systemd/system/ + - src: ./woodpecker-agent.env.example + dst: /etc/woodpecker/ diff --git a/nfpm/server.yaml b/nfpm/server.yaml index f125da291..66c8488d8 100644 --- a/nfpm/server.yaml +++ b/nfpm/server.yaml @@ -10,3 +10,7 @@ section: daemon/system contents: - src: ./dist/server/linux_amd64/woodpecker-server dst: /usr/local/bin/woodpecker-server + - src: ./woodpecker-server.service + dst: /usr/local/lib/systemd/system/ + - src: ./woodpecker-server.env.example + dst: /etc/woodpecker/ diff --git a/nfpm/woodpecker-agent.env.example b/nfpm/woodpecker-agent.env.example new file mode 100644 index 000000000..76d75d88a --- /dev/null +++ b/nfpm/woodpecker-agent.env.example @@ -0,0 +1,7 @@ +# Example for a woodpecker-agent.env file + +# Check the documentation for the agent: +# https://woodpecker-ci.org/docs/administration/agent-config + +# Add all required environment variables for your setup in the form of VARIABE=value +VARIABLE=value diff --git a/nfpm/woodpecker-agent.service b/nfpm/woodpecker-agent.service new file mode 100644 index 000000000..20d7db4d7 --- /dev/null +++ b/nfpm/woodpecker-agent.service @@ -0,0 +1,19 @@ +[Unit] +Description=WoodpeckerCI agent +Documentation=https://woodpecker-ci.org/docs/administration/agent-config +Requires=network.target +After=network.target +ConditionFileNotEmpty=/etc/woodpecker/woodpecker-agent.env +ConditionPathExists=/etc/woodpecker/woodpecker-agent.env + +[Service] +Type=simple +EnvironmentFile=/etc/woodpecker/woodpecker-agent.env +User=woodpecker +Group=woodpecker +ExecStart=/usr/local/bin/woodpecker-agent +WorkingDirectory=/var/lib/woodpecker/ +StateDirectory=woodpecker + +[Install] +WantedBy=multi-user.target diff --git a/nfpm/woodpecker-server.env.example b/nfpm/woodpecker-server.env.example new file mode 100644 index 000000000..b59bfd502 --- /dev/null +++ b/nfpm/woodpecker-server.env.example @@ -0,0 +1,7 @@ +# Example for a woodpecker-server.env file + +# Check the documentation for the server: +# https://woodpecker-ci.org/docs/administration/server-config + +# Add all required environment variables for your setup in the form of VARIABE=value +VARIABLE=value diff --git a/nfpm/woodpecker-server.service b/nfpm/woodpecker-server.service new file mode 100644 index 000000000..3968ee5d5 --- /dev/null +++ b/nfpm/woodpecker-server.service @@ -0,0 +1,19 @@ +[Unit] +Description=WoodpeckerCI server +Documentation=https://woodpecker-ci.org/docs/administration/server-config +Requires=network.target +After=network.target +ConditionFileNotEmpty=/etc/woodpecker/woodpecker-server.env +ConditionPathExists=/etc/woodpecker/woodpecker-server.env + +[Service] +Type=simple +EnvironmentFile=/etc/woodpecker/woodpecker-server.env +User=woodpecker +Group=woodpecker +ExecStart=/usr/local/bin/woodpecker-server +WorkingDirectory=/var/lib/woodpecker/ +StateDirectory=woodpecker + +[Install] +WantedBy=multi-user.target