[TOC]
-
Install nodejs (comes with npm)
-
Install Poetry:
-
Install docker and docker-compose: https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/#install-docker-ce https://docs.docker.com/compose/install/
-
Install docker buildx
-
Build dependencies
sudo apt-get install -y jq
-
Install the rest:
sudo apt-get install -y lftp python3-dev rar
git clone [email protected]:ipsingh06/seedsync.git
cd seedsync
cd src/python
poetry install
cd src/angular
npm install
cd src/e2e
npm install
-
Set up docker buildx for multi-arch builds
docker buildx create --name mybuilder --driver docker-container --driver-opt image=moby/buildkit:master,network=host docker buildx use mybuilder docker run --rm --privileged multiarch/qemu-user-static --reset -p yes docker buildx inspect --bootstrap # Make sure the following architectures are listed: linux/amd64, linux/arm64, linux/arm/v7
-
Multi-arch docker images can only be stored in a registry. Create local docker registry to store multi-arch images
docker run -d -p 5000:5000 --restart=always --name registry registry:2
-
Run these commands inside the root directory.
make clean make
-
The .deb package will be generated inside
build
directory. The docker image will be pushed to the local registry asseedsync:latest
. See if using:curl -X GET http://localhost:5000/v2/_catalog
To inspect the architectures of image:
docker buildx imagetools inspect localhost:5000/seedsync:latest
To use a different registry during the build process, use
STAGING_REGISTRY=
. For example:make STAGING_REGISTRY=another-registry:5000
To build a tag other than
latest
, useSTAGING_VERSION=
. For example:make STAGING_VERSION=0.0.1
make scanfs
cd src/python
mkdir -p build/config
poetry run python seedsync.py -c build/config --html ../angular/dist --scanfs build/scanfs
cd src/angular
node_modules/@angular/cli/bin/ng build
node_modules/@angular/cli/bin/ng serve
Dev build will be served at http://localhost:4200
cd src/python
poetry run mkdocs serve
Preview will be served at http://localhost:8000
poetry run mkdocs gh-deploy
git push github gh-pages
-
Set project root to top-level
seedsync
directory -
Switch interpreter to virtualenv
-
Mark src/python as 'Sources Root'
-
Add run configuration
Config Value Name seedsync Script path seedsync.py Parameters -c ./build/config --html ../angular/dist --scanfs ./build/scanfs
Create a new user account for python tests, and add the current user to its authorized keys. Also add the test account to the current user group so it may access any files created by the current user. Note: the current user must have SSH keys already generated.
sudo adduser -q --disabled-password --disabled-login --gecos 'seedsynctest' seedsynctest
sudo bash -c "echo seedsynctest:seedsyncpass | chpasswd"
sudo -u seedsynctest mkdir /home/seedsynctest/.ssh
sudo -u seedsynctest chmod 700 /home/seedsynctest/.ssh
cat ~/.ssh/id_rsa.pub | sudo -u seedsynctest tee /home/seedsynctest/.ssh/authorized_keys
sudo -u seedsynctest chmod 664 /home/seedsynctest/.ssh/authorized_keys
sudo usermod -a -G $USER seedsynctest
Run from PyCharm
OR
Run from terminal
cd src/python
poetry run pytest
cd src/angular
node_modules/@angular/cli/bin/ng test
# Python tests
make run-tests-python
# Angular tests
make run-tests-angular
# E2E Tests
# Docker image (arch=amd64,arm64,arm/v7)
make run-tests-e2e STAGING_VERSION=latest SEEDSYNC_ARCH=<arch code>
# Debian package (os=ubu1604,ubu1804,ubu2004)
make run-tests-e2e SEEDSYNC_DEB=`readlink -f build/*.deb` SEEDSYNC_OS=<os code>
By default images are pulled from localhost:5000
. To test image from a registry other than the local, use STAGING_REGISTRY=
.
For example:
make run-tests-e2e STAGING_VERSION=latest SEEDSYNC_ARCH=arm64 STAGING_REGISTRY=ipsingh06
This method uses Github Action to post releases.
- Do all of these in one change
- Version update in
src/angular/package.json
- Version update and changelog in
src/debian/changelog
. Use commandLANG=C date -R
to get the date. - Update
src/e2e/tests/about.page.spec.ts
- Update Copyright date in
about-page.component.html
- Version update in
- Tag the commit as vX.X.X
- Push tag to Github
This manual method is deprecated in favour of the Github Actions based CI.
- Do all of these in one change
- Version update in
src/angular/package.json
- Version update and changelog in
src/debian/changelog
. Use commandLANG=C date -R
to get the date. - Update
src/e2e/tests/about.page.spec.ts
- Update Copyright date in
about-page.component.html
- Version update in
- Tag the commit as vX.X.X
- Deploy documentation to github
- make clean && make
- Run all tests
- Upload deb file to github
- Tag and upload image to Dockerhub (see below)
make docker-image-release RELEASE_VERSION=<version> RELEASE_REGISTRY=ipsingh06
make docker-image-release RELEASE_VERSION=latest RELEASE_REGISTRY=ipsingh06
Use the following command to run the docker image for the remote server for development testing. This is the same image used by the end-to-end tests.
make run-remote-server
The connection parameters for the remote server are:
Option | Value |
---|---|
Remote Address | localhost or host.docker.internal |
Remote Port | 1234 |
Username | remoteuser |
Pass | remotepass |
Remote Path | /home/remoteuser/files |
Use the following command to run the docker image locally:
docker run --rm -p 8800:8800 localhost:5000/seedsync:latest