2013-10-19 18:57:48 +02:00
|
|
|
TP_REPO ?= https://bitbucket.org/marduk/teamplayer
|
|
|
|
TP_BRANCH ?= default
|
I learned a lot about Makefiles :D
So, basically I re-architeched things a bit:
The appliance/Makefile.inc fiels are now appliance/Makefile (again). The
main Makefile will call "make -C appliance preinstall" and "postinstall"
(and in future "clean"). So I got rid of the ugly make variables/include
thing. Some of the main Makefile's variables are exported to the
sub-makes. Appliances don't really need $(APPLIANCE) anymore as the
appliance directory is their CWD.
Added some new targets and smarter targets. I can do more with this, but
it's a big improvment from last time. Still learning a lot of Makefile
magic (been reading other people's Makefiles).
Verified that "make -j3" works (at least on the base appliance) but will
kill your hard drive :D
Introduced "profiles" Which are files with variables you want to override.
The file will be "include"ed by the main Makefile. For example, I have a
file, "local.cfg" that looks like this:
--- 8< -----------------------------
CHROOT = /var/scratch/marduk/vabuild
HEADLESS = YES
PRUNE_CRITICAL = NO
VIRTIO = YES
TIMEZONE = EST5EDT
DISK_SIZE = 60.0G
SWAP_SIZE = 48
PKGDIR = /var/scratch/packages
NBD_DEV = /dev/nbd8
all: qcow
--- 8< ------------------------------
Then, e.g. i can run "make PROFILE=local APPLIANCE=kde". If you don't
specify a PROFILE variable, then it will default to the empty string, which
means the main Makefile will attempt to include .cfg
So, for example i have:
$ ln -s local.cfg .cfg
$ make APPLIANCE=kde
Don't set PROFILE inside your .cfg file (why would you?). Also, if the
[pro]file does not exist, the include fails silently.
I will put this info in the wiki eventually...
2010-11-14 00:22:18 +01:00
|
|
|
TP_USER = teamplayer
|
|
|
|
TP_HOME = /opt/teamplayer
|
|
|
|
TP_DB = /var/lib/teamplayer
|
2016-10-19 14:49:58 +02:00
|
|
|
PGVER = 9.6
|
2010-11-21 01:52:00 +01:00
|
|
|
INSTALL = install
|
2011-02-25 05:35:34 +01:00
|
|
|
AVAHI := NO
|
I learned a lot about Makefiles :D
So, basically I re-architeched things a bit:
The appliance/Makefile.inc fiels are now appliance/Makefile (again). The
main Makefile will call "make -C appliance preinstall" and "postinstall"
(and in future "clean"). So I got rid of the ugly make variables/include
thing. Some of the main Makefile's variables are exported to the
sub-makes. Appliances don't really need $(APPLIANCE) anymore as the
appliance directory is their CWD.
Added some new targets and smarter targets. I can do more with this, but
it's a big improvment from last time. Still learning a lot of Makefile
magic (been reading other people's Makefiles).
Verified that "make -j3" works (at least on the base appliance) but will
kill your hard drive :D
Introduced "profiles" Which are files with variables you want to override.
The file will be "include"ed by the main Makefile. For example, I have a
file, "local.cfg" that looks like this:
--- 8< -----------------------------
CHROOT = /var/scratch/marduk/vabuild
HEADLESS = YES
PRUNE_CRITICAL = NO
VIRTIO = YES
TIMEZONE = EST5EDT
DISK_SIZE = 60.0G
SWAP_SIZE = 48
PKGDIR = /var/scratch/packages
NBD_DEV = /dev/nbd8
all: qcow
--- 8< ------------------------------
Then, e.g. i can run "make PROFILE=local APPLIANCE=kde". If you don't
specify a PROFILE variable, then it will default to the empty string, which
means the main Makefile will attempt to include .cfg
So, for example i have:
$ ln -s local.cfg .cfg
$ make APPLIANCE=kde
Don't set PROFILE inside your .cfg file (why would you?). Also, if the
[pro]file does not exist, the include fails silently.
I will put this info in the wiki eventually...
2010-11-14 00:22:18 +01:00
|
|
|
|
2015-09-23 05:35:47 +02:00
|
|
|
M4_DEFS += -D TP_USER=$(TP_USER) -D TP_HOME=$(TP_HOME) -D TP_DB=$(TP_DB) -D HOSTNAME=$(HOSTNAME) -D PGVER=$(PGVER)
|
I learned a lot about Makefiles :D
So, basically I re-architeched things a bit:
The appliance/Makefile.inc fiels are now appliance/Makefile (again). The
main Makefile will call "make -C appliance preinstall" and "postinstall"
(and in future "clean"). So I got rid of the ugly make variables/include
thing. Some of the main Makefile's variables are exported to the
sub-makes. Appliances don't really need $(APPLIANCE) anymore as the
appliance directory is their CWD.
Added some new targets and smarter targets. I can do more with this, but
it's a big improvment from last time. Still learning a lot of Makefile
magic (been reading other people's Makefiles).
Verified that "make -j3" works (at least on the base appliance) but will
kill your hard drive :D
Introduced "profiles" Which are files with variables you want to override.
The file will be "include"ed by the main Makefile. For example, I have a
file, "local.cfg" that looks like this:
--- 8< -----------------------------
CHROOT = /var/scratch/marduk/vabuild
HEADLESS = YES
PRUNE_CRITICAL = NO
VIRTIO = YES
TIMEZONE = EST5EDT
DISK_SIZE = 60.0G
SWAP_SIZE = 48
PKGDIR = /var/scratch/packages
NBD_DEV = /dev/nbd8
all: qcow
--- 8< ------------------------------
Then, e.g. i can run "make PROFILE=local APPLIANCE=kde". If you don't
specify a PROFILE variable, then it will default to the empty string, which
means the main Makefile will attempt to include .cfg
So, for example i have:
$ ln -s local.cfg .cfg
$ make APPLIANCE=kde
Don't set PROFILE inside your .cfg file (why would you?). Also, if the
[pro]file does not exist, the include fails silently.
I will put this info in the wiki eventually...
2010-11-14 00:22:18 +01:00
|
|
|
M4C = $(M4) $(M4_DEFS)
|
|
|
|
|
2011-05-13 12:51:24 +02:00
|
|
|
rcdefault := /etc/runlevels/default
|
2011-02-25 05:35:34 +01:00
|
|
|
|
2016-11-20 18:31:23 +01:00
|
|
|
post_files = bash_profile settings.py teamplayer-pre.service
|
2015-09-23 05:35:47 +02:00
|
|
|
post_files += teamplayer-wsgi.service teamplayer-spindoctor.service
|
|
|
|
post_files += issue nginx.conf teamplayer.service
|
I learned a lot about Makefiles :D
So, basically I re-architeched things a bit:
The appliance/Makefile.inc fiels are now appliance/Makefile (again). The
main Makefile will call "make -C appliance preinstall" and "postinstall"
(and in future "clean"). So I got rid of the ugly make variables/include
thing. Some of the main Makefile's variables are exported to the
sub-makes. Appliances don't really need $(APPLIANCE) anymore as the
appliance directory is their CWD.
Added some new targets and smarter targets. I can do more with this, but
it's a big improvment from last time. Still learning a lot of Makefile
magic (been reading other people's Makefiles).
Verified that "make -j3" works (at least on the base appliance) but will
kill your hard drive :D
Introduced "profiles" Which are files with variables you want to override.
The file will be "include"ed by the main Makefile. For example, I have a
file, "local.cfg" that looks like this:
--- 8< -----------------------------
CHROOT = /var/scratch/marduk/vabuild
HEADLESS = YES
PRUNE_CRITICAL = NO
VIRTIO = YES
TIMEZONE = EST5EDT
DISK_SIZE = 60.0G
SWAP_SIZE = 48
PKGDIR = /var/scratch/packages
NBD_DEV = /dev/nbd8
all: qcow
--- 8< ------------------------------
Then, e.g. i can run "make PROFILE=local APPLIANCE=kde". If you don't
specify a PROFILE variable, then it will default to the empty string, which
means the main Makefile will attempt to include .cfg
So, for example i have:
$ ln -s local.cfg .cfg
$ make APPLIANCE=kde
Don't set PROFILE inside your .cfg file (why would you?). Also, if the
[pro]file does not exist, the include fails silently.
I will put this info in the wiki eventually...
2010-11-14 00:22:18 +01:00
|
|
|
|
|
|
|
preinstall:
|
|
|
|
|
2013-07-22 15:33:36 +02:00
|
|
|
postinstall: $(post_files) $(SCROBBLER_AUTH) urls.py
|
2018-10-27 20:04:00 +02:00
|
|
|
RUN passwd -d postgres
|
2018-10-05 06:29:30 +02:00
|
|
|
rm -rf $(CHROOT)/var/lib/postgresql/$(PGVER)/data
|
2018-10-27 20:04:00 +02:00
|
|
|
RUN eselect postgresql unset
|
|
|
|
RUN eselect postgresql set $(PGVER)
|
|
|
|
RUN bash -c "echo y |$(EMERGE) --config postgresql:$(PGVER)"
|
2011-02-25 05:35:34 +01:00
|
|
|
ifeq ($(AVAHI),YES)
|
2018-10-27 20:04:00 +02:00
|
|
|
RUN $(EMERGE) --noreplace $(USEPKG) net-dns/avahi
|
|
|
|
RUN rm -f /etc/avahi/services/*
|
|
|
|
COPY teamplayer.service /etc/avahi/services
|
|
|
|
RUN systemctl enable avahi-daemon.service
|
2011-02-25 05:35:34 +01:00
|
|
|
endif
|
2018-10-27 20:04:00 +02:00
|
|
|
RUN $(EMERGE) --oneshot --noreplace $(USEPKG) dev-python/setuptools dev-python/virtualenv dev-vcs/mercurial
|
|
|
|
RUN getent passwd $(TP_USER) || \
|
|
|
|
RUN useradd -c "Teamplayer Server" -G postgres -U -d $(TP_HOME) $(TP_USER)
|
I learned a lot about Makefiles :D
So, basically I re-architeched things a bit:
The appliance/Makefile.inc fiels are now appliance/Makefile (again). The
main Makefile will call "make -C appliance preinstall" and "postinstall"
(and in future "clean"). So I got rid of the ugly make variables/include
thing. Some of the main Makefile's variables are exported to the
sub-makes. Appliances don't really need $(APPLIANCE) anymore as the
appliance directory is their CWD.
Added some new targets and smarter targets. I can do more with this, but
it's a big improvment from last time. Still learning a lot of Makefile
magic (been reading other people's Makefiles).
Verified that "make -j3" works (at least on the base appliance) but will
kill your hard drive :D
Introduced "profiles" Which are files with variables you want to override.
The file will be "include"ed by the main Makefile. For example, I have a
file, "local.cfg" that looks like this:
--- 8< -----------------------------
CHROOT = /var/scratch/marduk/vabuild
HEADLESS = YES
PRUNE_CRITICAL = NO
VIRTIO = YES
TIMEZONE = EST5EDT
DISK_SIZE = 60.0G
SWAP_SIZE = 48
PKGDIR = /var/scratch/packages
NBD_DEV = /dev/nbd8
all: qcow
--- 8< ------------------------------
Then, e.g. i can run "make PROFILE=local APPLIANCE=kde". If you don't
specify a PROFILE variable, then it will default to the empty string, which
means the main Makefile will attempt to include .cfg
So, for example i have:
$ ln -s local.cfg .cfg
$ make APPLIANCE=kde
Don't set PROFILE inside your .cfg file (why would you?). Also, if the
[pro]file does not exist, the include fails silently.
I will put this info in the wiki eventually...
2010-11-14 00:22:18 +01:00
|
|
|
rm -rf $(CHROOT)/$(TP_HOME)
|
2013-07-22 15:33:36 +02:00
|
|
|
mkdir -p $(CHROOT)/$(TP_HOME)
|
2018-10-27 20:04:00 +02:00
|
|
|
COPY bash_profile $(TP_HOME)/.bash_profile
|
|
|
|
RUN virtualenv $(TP_HOME)
|
|
|
|
#RUN bash -c ". $(TP_HOME)/bin/activate ; LANG=en_US.utf8 pip install --no-cache-dir hg+$(TP_REPO)@$(TP_BRANCH)"
|
|
|
|
RUN --setenv=LANG=en_US.utf8 $(PYTHON) -m pip install --no-cache-dir hg+$(TP_REPO)@$(TP_BRANCH)
|
|
|
|
RUN $(PYTHON) -m pip install --no-cache-dir psycopg2 uwsgi Whoosh setproctitle
|
|
|
|
#RUN bash -c ". $(TP_HOME)/bin/activate ; pip install --no-cache-dir psycopg2 uwsgi Whoosh setproctitle"
|
|
|
|
#RUN bash -c ". $(TP_HOME)/bin/activate ; django-admin.py startproject project $(TP_HOME)"
|
|
|
|
RUN $(TP_HOME)/bin/django-admin startproject project $(TP_HOME)
|
2013-07-22 15:33:36 +02:00
|
|
|
chmod +x $(CHROOT)/$(TP_HOME)/manage.py
|
2018-10-27 20:04:00 +02:00
|
|
|
RUN ln -sf ../manage.py $(TP_HOME)/bin/manage
|
|
|
|
COPY urls.py $(TP_HOME)/project/urls.py
|
2016-11-20 18:31:23 +01:00
|
|
|
$(M4C) settings.py >> $(CHROOT)/$(TP_HOME)/project/settings.py
|
2011-07-07 03:41:28 +02:00
|
|
|
ifdef SCROBBLER_AUTH
|
2016-11-20 18:31:23 +01:00
|
|
|
cat $(SCROBBLER_AUTH) >> $(CHROOT)/$(TP_HOME)/project/settings.py
|
2011-07-07 03:41:28 +02:00
|
|
|
endif
|
2018-10-27 20:04:00 +02:00
|
|
|
RUN bash -c ". $(TP_HOME)/bin/activate; cd $(TP_HOME); DJANGO_SETTINGS_MODULE=project.settings $(TP_HOME)/manage.py collectstatic --noinput"
|
|
|
|
RUN $(INSTALL) -d -o $(TP_USER) -g $(TP_USER) $(TP_DB)
|
|
|
|
RUN $(INSTALL) -d -o $(TP_USER) -g $(TP_USER) $(TP_DB)/songs
|
|
|
|
RUN mkdir -p $(TP_HOME)/library
|
|
|
|
RUN chown -R $(TP_USER):$(TP_USER) $(TP_HOME)
|
|
|
|
RUN $(INSTALL) -d -o $(TP_USER) -g $(TP_USER) $(TP_DB)/mpd
|
2015-09-23 05:35:47 +02:00
|
|
|
$(M4C) teamplayer-pre.service > $(CHROOT)/etc/systemd/system/teamplayer-pre.service
|
|
|
|
$(M4C) teamplayer-wsgi.service > $(CHROOT)/etc/systemd/system/teamplayer-wsgi.service
|
|
|
|
$(M4C) teamplayer-spindoctor.service > $(CHROOT)/etc/systemd/system/teamplayer-spindoctor.service
|
2018-10-27 20:04:00 +02:00
|
|
|
COPY issue /etc/issue
|
2014-01-06 04:14:53 +01:00
|
|
|
$(M4C) nginx.conf > $(CHROOT)/etc/nginx/nginx.conf
|
2018-10-27 20:04:00 +02:00
|
|
|
RUN gpasswd -a nginx teamplayer
|
|
|
|
RUN systemctl enable teamplayer-wsgi.service
|
|
|
|
RUN systemctl enable teamplayer-spindoctor.service
|
|
|
|
RUN $(EMERGE) --depclean --with-bdeps=n
|
2011-04-10 05:45:35 +02:00
|
|
|
|
I learned a lot about Makefiles :D
So, basically I re-architeched things a bit:
The appliance/Makefile.inc fiels are now appliance/Makefile (again). The
main Makefile will call "make -C appliance preinstall" and "postinstall"
(and in future "clean"). So I got rid of the ugly make variables/include
thing. Some of the main Makefile's variables are exported to the
sub-makes. Appliances don't really need $(APPLIANCE) anymore as the
appliance directory is their CWD.
Added some new targets and smarter targets. I can do more with this, but
it's a big improvment from last time. Still learning a lot of Makefile
magic (been reading other people's Makefiles).
Verified that "make -j3" works (at least on the base appliance) but will
kill your hard drive :D
Introduced "profiles" Which are files with variables you want to override.
The file will be "include"ed by the main Makefile. For example, I have a
file, "local.cfg" that looks like this:
--- 8< -----------------------------
CHROOT = /var/scratch/marduk/vabuild
HEADLESS = YES
PRUNE_CRITICAL = NO
VIRTIO = YES
TIMEZONE = EST5EDT
DISK_SIZE = 60.0G
SWAP_SIZE = 48
PKGDIR = /var/scratch/packages
NBD_DEV = /dev/nbd8
all: qcow
--- 8< ------------------------------
Then, e.g. i can run "make PROFILE=local APPLIANCE=kde". If you don't
specify a PROFILE variable, then it will default to the empty string, which
means the main Makefile will attempt to include .cfg
So, for example i have:
$ ln -s local.cfg .cfg
$ make APPLIANCE=kde
Don't set PROFILE inside your .cfg file (why would you?). Also, if the
[pro]file does not exist, the include fails silently.
I will put this info in the wiki eventually...
2010-11-14 00:22:18 +01:00
|
|
|
clean:
|
|
|
|
|