39 Commits

Author SHA1 Message Date
James Valleroy
d7e06348db
vagrant: Enable EFI firmware
Tests:

- Bring up vagrant box version 25.16. Able to access the web interface
  after setup is complete.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2025-12-10 10:11:06 +05:30
Sunil Mohan Adapa
24d2d92ab5
Run service using systemd even for development
- This means that systemd sandbox will be in effect even during development. We
won't miss out on bugs in sandbox configuration.

- We won't have disable systemd sandbox features just because we can test
properly on development setup. Such as JoinsNamespaceOf=.

- This also leads to significant reduction in hacky code for setting up for
development and functional tests.

- One disadvantage is that first setup is run before user gets a chance to
interact with the started container/VM. However, this is okay since first setup
can be re-run easily by removing the /var/lib/plinth/plinth.sqlite3 file and
also the need for doing this is rare.

Tests:

- Start a fresh container and run functional tests with './container run-tests'
on it. The tests run as expected (succeed or fail).

- While first setup is in progress, running the command 'make
wait-while-first-setup' waits while printing dots. After the first setup is
done, it exists.

- Running the command freedombox-logs shows FreedomBox logs for both the web and
privileged services.

- Changing a source code file in the /freedombox directory (or on the host)
leads to a restart of the Plinth web service.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-11-03 13:54:00 +02:00
Sunil Mohan Adapa
ba55d8fe2e
Makefile: Move most of the provision process into build system
Tests:

- Performing a fresh container setup works.

- Performing a fresh VM setup works.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2024-02-12 19:17:14 -05:00
Sunil Mohan Adapa
812ed5d60d
*: Introduce make file based build, eliminate setup.py
- setuptools aims to a build library instead of being invoked by setup.py.
Launching setup tools using ./setup.py is deprecated. Launching it using
generic build tools that use pyproject.toml is recommended.

- With the new approach customizing the build is not possible to the earlier
extent. So, introduce is a simple and sufficient build system using 'make'.

Tests:

- Check the pyproject.toml using validate-pyproject tool.

- Run diffoscope on old and new packages and verify that no unexpected changes
were introduced by the build system change.

- None of the files part of .deb package have different file permissions
compared to before.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2024-02-12 19:17:09 -05:00
Sunil Mohan Adapa
7febdb16e3
vagrant: Hide the vagrant-script directory
- It is just a support script and not part of the main source.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2023-02-13 17:12:42 -05:00
Sunil Mohan Adapa
b013d010a4
vagrant: Drop unnecessary script that deletes sqlite file
We no longer store sqlite3 file the current directory when running --develop
mode. We always store it in /var/lib/plinth/plinth.sqlite3.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2023-02-13 17:12:40 -05:00
Sunil Mohan Adapa
24d2401e24
vagrant: Switch to /freedombox before running service with alias
Closes: #2319.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2023-02-13 17:12:37 -05:00
Sunil Mohan Adapa
e80f07250b
vagrant: Mount source in /freedombox instead of /vagrant
For uniformity with the more often used ./container script. Developers may have
to destroy and recreate their vagrant machines for this to take effect.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2023-02-13 17:12:35 -05:00
Sunil Mohan Adapa
66c1ddc404
upgrades: Use privileged decorator for actions
Tests:

- DONE: Functional tests work
- DONE: Initial setup works
  - DONE: Automatic upgrades are enable by default
  - DONE: apt preferences have been updated
- DONE: Enabling backports works
  - DONE: Configuration file is created
  - DONE: Correct status is shown in the app page
- DONE: Enabling/disabling automatic upgrades works
  - DONE: Configuration file is updated
  - DONE: Correct status is shown in the app page
- DONE: Manual triggering of updates work
  - DONE: Log is shown properly in the app page
- DONE: Checking for distribution upgrade works
- DONE: Distribution upgrade from stable to testing works
  - DONE: When running on btrfs distribution, snapshot is created before.
  - DONE: Snapshots will be disable before upgrade and re-enabled later.
  - DONE: When searx is enabled before upgrade, it's uwsgi will be disabled and
    re-enabled later.
  - Failures due to freedombox package not being the latest version (with the
    changes).
- DONE: Development Vagrant box
  - DONE: Automatic updates are disabled during development setup
- DONE: Development Container
  - DONE: Automatic updates are disabled during development setup
  - DONE: On stable, backports are enabled when running tests

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-10-08 18:53:33 -04:00
James Valleroy
b0592e7cd5
vagrant: Update box name
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
2021-08-15 21:12:44 -04:00
Sunil Mohan Adapa
bf7a9b8c7a
d/rules: vagrant: INSTALL.md: Fix installing dependencies
- Using ./run --develop ensures that the last list of dependencies are picked up
from current source directory instead of list of dependencies from system
configuration.

- Using sudo -u plinth ensures that even if any temporary files are created,
they belong to the plinth user instead of root user.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-06-28 21:02:05 -04:00
Sunil Mohan Adapa
80d67c2054
tests: functional: Merge into main source hierarchy
- Add pytest hooks to ignore all functional tests if pytest_bdd is not
installed.

- Update pytest hooks to skip tests in file named 'test_functional.py' if
--include-functional argument is not provided.

- Move functional_tests/install.py into plinth/tests/functional and update
reference in Vagrantfile.

- Move scenario files into individual app folders. Rename them after the app
they are testing. Merge TODO items listed in todo.org into corresponding feature
files.

- Add test_functional.py in each app to build tests from the features file using
pytest_bdd.

- Move all step_definitions, support and data into plinth/tests/functional/.
Include all step_definitions from conftest.py. Update to relative imports
instead of absolute imports.

Tests performed:

- Run py.test-3 --collect-only shows all functional tests and lists 574 tests.
No errors show that name of feature files are correct. The number says that all
functional test features are included.

- Remove pytest_bdd (or modify the import name) and run py.test-3 --collect-only
skips collecting all functional tests and shows only 300+ tests.

- Run functional tests for a few apps with py.test-3 --include-functional -m
app. For storage, deluge.

- Run unit tests with py.test-3. Functional tests are listed by skipped.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
2020-05-22 21:26:05 +05:30
Joseph Nuthalapati
7ed64c03fc
vagrant: Skip upgrading freedombox dependencies
Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-04-06 19:02:58 -04:00
Sunil Mohan Adapa
07180c2309
*: Update misc build related files to use SPDX license identifier
These files are not installed on the system and don't end up in the Debian
package. They pose not threat of causing a configuration file prompt.

Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2020-02-19 14:40:12 +02:00
Joseph Nuthalapati
a6b329fef4
vagrant: Allocate cpus equal to the no. of cores
Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-02-09 11:58:54 -05:00
Joseph Nuthalapati
1068c32759
vagrant: Add alias for run --develop
Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2020-01-30 13:41:16 -08:00
Veiko Aasa
3a202af843
samba: Add unit and functional tests
- Add functional tests
- Add unit tests for samba views
- New dependency for running functional tests: smbclient
- Make port configurable for the smbclient

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
2020-01-17 02:47:06 +05:30
Sunil Mohan Adapa
f447264547
vagrant: Fix dpkg command for recovering from broken state
Test: Ran vagrant provision and saw no errors.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-08-26 18:06:15 -04:00
James Valleroy
dec215851b
vagrant: Stop any ongoing unattended-upgrade
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
[sunil@medhas.org add lines for finishing interrupted apt process]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-08-25 08:52:21 -07:00
LoveIsGrief
d31b0ee3c7
functional_tests: Allow provisioning VM for functional tests
It's now possible to run the tests in the VM more easily
without copy-pasting too much from HACKING.md.
`vagrant provision --provisiion-with tests` will take care of the dependencies.

freedombox/plinth#1521 - Provision VM to run function functional tests

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-04-03 22:03:44 -04:00
Joseph Nuthalapati
fa4c807e82
vagrant: Run plinth as user plinth in development environment
Running plinth as root is causing preventable permission errors in production.
This commit makes the necessary changes to run plinth as the user plinth so that
permission errors can be caught early and prevented.

- Give ownership of all files in the mounted directory to plinth
- Add permissions in sudoers file so that plinth can run scripts in
  /vagrant/actions as superuser
- Move scripts that run on vagrant triggers to a separate directory

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-04-01 20:10:30 -04:00
James Valleroy
8b74f65f38
vagrant: Rearrange steps of provision script
- Disable automatic upgrades earlier in the script. This makes it more
  likely that unattended-upgrades will be disabled before it has a
  chance to run.

- Move apt commands to the end. In the event that unattended-upgrades
  is running anyway, these command can fail and cause further steps to
  be skipped.

Closes #1506

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-03-06 09:58:57 -08:00
Jag
57666b661b
vagrant: Use virtualbox linked clones / CoW to reduce startup times
Behaves more like docker now with Copy on Write. More documentation:

 - https://www.vagrantup.com/docs/virtualbox/configuration.html#linked-clones
   (https://archive.fo/Yy6A4)

 - https://www.virtualbox.org/manual/ch01.html (https://archive.fo/1rj4q)

Closes #1551

Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
2019-02-25 10:40:15 -08:00
James Valleroy
47366770c8
vagrant: Put hold on freedombox package during provision
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
2019-02-05 15:21:34 -08:00
Joseph Nuthalapati
573db44fc3
vagrant: clear logs and plinth database on destroying box
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-11-28 19:29:20 -05:00
Joseph Nuthalapati
56ee33793e
vagrant: Destroy Plinth development database when box is destroyed
Fixes #1424

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-11-17 13:10:09 -05:00
Joseph Nuthalapati
9367f9bcaf
vagrant: Increase number of CPUs to 2
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-10-14 15:16:18 -04:00
Joseph Nuthalapati
7c1197ba45
vagrant: Increase memory to 2GiB
Closes #1397

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-10-14 15:16:14 -04:00
Joseph Nuthalapati
8c89756b63
vagrant: Get rid of apt warning during provisioning
Use apt-get instead of apt as apt does not have stable command line API yet.

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-10-08 18:29:37 -04:00
Joseph Nuthalapati
7878ccde29
Install ncurses-term during vagrant file provision
The vagrant box after being destroyed and created doesn't have ncurses-term
installed. Proactively install it to avoid the problem.

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-09-01 16:44:45 -04:00
James Valleroy
27488575c7
vagrant: Clarify post-up message
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
2018-08-18 09:27:01 -04:00
Joseph Nuthalapati
8007289e57
vagrant: Vagrantfile changes for ease of development
Moved some frequently required operations to the Vagrantfile.

Newcomers to the project almost always face the issue of port 8000 not being
available. Disabling system Plinth and running only the development version
solves this issue.

Automatic upgrades are a frequent blocker for development and an unnecessary
annoyance on a development setup.

- Update documentation about vagrant file changes

- Remove plinth restart step

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-08-18 09:12:38 -04:00
Sunil Mohan Adapa
6bf5109108
Rename Plinth to FreedomBox in code messages
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-02-16 20:10:51 -05:00
Sunil Mohan Adapa
dea4af17fb
Rename Plinth to FreedomBox in license headers
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-02-16 20:10:09 -05:00
James Valleroy
a2997a0c70
vagrant: Avoid debconf prompts while provisioning
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2017-12-18 10:38:30 +05:30
Sunil Mohan Adapa
0af8175fd0
Install dependency packages during install/provisioning
This will not install all the dependencies of Plinth but will install the
dependencies required for essential modules to setup properly.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2017-11-03 12:41:11 +05:30
James Valleroy
2befa18c33
Switch to official vagrant box 2016-08-05 21:13:14 -04:00
Sunil Mohan Adapa
bdd903e0ca
Minor updates to Vagrantfile
- Add license header

- Let setup.py decide the Python interpreter to use

- Don't make a copy of the project directory making it easier to
  re-provision.

- Show a message on how to proceed after bringing up the VM
2016-08-03 22:18:38 +05:30
James Valleroy
eed0babb13
Add Vagrantfile. 2016-08-03 19:54:12 +05:30