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

All applications and listeners lost after restarting unitd #16

Closed
k4ml opened this issue Sep 7, 2017 · 11 comments
Closed

All applications and listeners lost after restarting unitd #16

k4ml opened this issue Sep 7, 2017 · 11 comments
Assignees

Comments

@k4ml
Copy link

k4ml commented Sep 7, 2017

sudo curl --unix-socket /var/run/control.unit.sock http://localhost/
{
	"listeners": {
		"*:8300": {
			"application": "hello"
		}
	},

	"applications": {
		"hello": {
			"type": "python",
			"workers": 2,
			"module": "wsgi",
			"user": "ubuntu",
			"group": "ubuntu",
			"path": "/home/ubuntu/unit/hello"
		}
	}
}

After restarting with sudo systemctl restart unitd:-

sudo curl --unix-socket /var/run/control.unit.sock http://localhost/
{
	"listeners": {},
	"applications": {}
}

So I have to add it again:-

sudo curl -X PUT -d @hello.json --unix-socket /var/run/control.unit.sock http://localhost/

This is on Ubuntu Xenial and unit install through apt.

apt show unit
Package: unit
Version: 0.1-1~xenial
Priority: extra
Section: admin
Maintainer: Andrei Belov <defan@nginx.com>
Installed-Size: 504 kB
Depends: lsb-base, curl, libc6 (>= 2.15), libpython2.7 (>= 2.7), libphp-embed
Homepage: https://www.nginx.com
Download-Size: 128 kB
APT-Manual-Installed: yes
APT-Sources: http://nginx.org/packages/mainline/ubuntu xenial/nginx amd64 Packages
@gummiboll
Copy link

I have the same issue, also on ubuntu xenial and unit installed from apt.

@boiler
Copy link

boiler commented Sep 9, 2017

You should manually save and restore unitd configuration by call "dumpconfig" and "restoreconfig" service subcommands.
If you do not want to lose configuration after restart, try this:

sudo service unitd dumpconfig
sudo service unitd restart
sudo service unitd restoreconfig

Configuration stores in /etc/unit/config

@VBart
Copy link
Contributor

VBart commented Sep 11, 2017

Currently configuration is not persistent across reloads and expected to be loaded each time. The patches to make it persistent is on review.

@VBart VBart self-assigned this Sep 11, 2017
@VBart
Copy link
Contributor

VBart commented Sep 14, 2017

Implemented in 4953e5b.

@ghost
Copy link

ghost commented Sep 20, 2017

your document should update .

@docteurklein
Copy link

so do we still have to use dumpconfig and restoreconfig after 4953e5b ? or is running unitd --state enough?

@binnn6
Copy link

binnn6 commented Oct 3, 2017

Now the config is persistent through restart. --state is just for where u want to store the config file ,if
no -- state, it will be stored as build/conf.json by default.

@docteurklein
Copy link

docteurklein commented Oct 3, 2017

thanks. and this config.json structure is exactly the same as the one you PUT on the control socket?

@binnn6
Copy link

binnn6 commented Oct 3, 2017

Yes.

@VBart
Copy link
Contributor

VBart commented Oct 3, 2017

@docteurklein While currently it's the same, it doesn't have to in the future. The content of "store" directory doesn't supposed to be editable by user. It's an internal storage for unit daemon.

@docteurklein
Copy link

ok, that's good to know, thanks! I'm currently trying to make a docker container that starts a ready to go unitd, without having to curl the config at runtime. it's not very immutable infra otherwise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants