Skip to content

Commit

Permalink
Migrating codebase to public github repo
Browse files Browse the repository at this point in the history
  • Loading branch information
genox committed Mar 20, 2023
1 parent 07a86c1 commit 4fd5226
Show file tree
Hide file tree
Showing 731 changed files with 66,720 additions and 2 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/build_backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build & test backend application

on:
workflow_call:
pull_request:
push:
paths:
- 'backend/**'
branches:
- '**'
tags-ignore:
- '**'

jobs:
Build-Backend:
name: Build & test backend application
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup JDK
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: 17
- name: Build backend
working-directory: ./backend
run: sbt clean update compile test dist
31 changes: 31 additions & 0 deletions .github/workflows/build_frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build frontend application
on:
workflow_call:
workflow_dispatch:
pull_request:
push:
paths:
- 'frontend/**'
branches:
- '**'
tags-ignore:
- '**'

jobs:
build-frontend:
name: Build frontend application for amd64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: build frontend
working-directory: ./frontend
run: |
npm --version
yarn --version
node ./scripts/updatePackageJsonVersion.js $CI_COMMIT_SHORT_SHA
yarn workspaces focus
yarn run lint
yarn run build
54 changes: 54 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build & publish docker images

on:
workflow_dispatch:
push:
tags:
- '**'

jobs:
frontend:
name: Build & push frontend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build & push frontend image to docker hub
uses: docker/build-push-action@v3
with:
context: "{{defaultContext}}:frontend"
push: true
tags: tegonal/lasius-frontend:${{github.ref_name}}

backend:
name: Build & push backend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Setup JDK
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: 17
- name: Build backend
working-directory: ./backend
run: sbt clean update compile test dist
- name: Build & push backend image to docker hub
uses: docker/build-push-action@v3
with:
context: ./backend
push: true
tags: tegonal/lasius-backend:${{github.ref_name}}
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# misc global
.bsp
target
.vscode
.idea
.history
**/common_old.json
.DS_Store
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -633,8 +633,8 @@ the "copyright" line and a pointer to where the full notice is found.
Copyright (C) <year> <name of author>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
Expand Down
142 changes: 142 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# Lasius open-source time tracking

Lasius is an open source time tracking solution that includes a comprehensive set of features, with a particular focus on team collaboration.

**Public Beta**: We welcome your feedback! Please use the issue tracker of this repository.

Lasius is a modern web application with a backend written in Scala and a NextJS React frontend.

# Features

## Time Tracking

* Start-Stop tracking: Record time spent on a task in real-time
* Labels & Tags: Assign labels to each booking and edit labels on project level
* Favorites: Save your most used bookings as favorites and start booking with one click
* Progressive Web App: Use Lasius on your mobile device as a PWA and add it to your homescreen
* Dark-mode: Switch between light and dark mode
* Statistics & Reports: See your organisation, project or personal statistics for a given time period
* Export: Export organisation, project or personal bookings using various filters as CSV for a given time period
* ACL: Assign roles to users in a project or organisation to allow or restrict access to certain features

## Team Features

* Organisations: Be a member of multiple organisations and invite users with an invitation link, switch between them
anytime and see only organisation specific data
* Projects: Create projects, assign them to organisations and invite users with an invitation link
* Team View: See what everybody is currently working on and book on the same task with one click

## Integrations

* Issue trackers: Connect your issue tracker to Lasius and use issue numbers as labels. Currently supported:
* GitLab
* Jira

## Personal Time Management

* Set your personal hourly target per weekday and organisation
* See your progress in real-time

# Roadmap

We plan to implement the following features in the near future (no specific order, no ETA):

* [ ] Make GitLab and Jira integration configurable in the frontend (currently hardcoded)
* [ ] Add support for other GitHub issue tracker
* [ ] Make tags and labels configuration configurable in the frontend (currently hardcoded)
* [ ] Add support for sending E-Mails via SMTP for password reset, invitation links, etc.
* [ ] Quick onboarding for new users with basic usage instructions
* [ ] Special project to book sick days, holidays, etc. per organization

If you plan to use Lasius for your company or organisation, and you depend on one of the above features, we are happy to discuss sponsoring the development.

Follow the repository to get notified about new releases.

# History

The development of Lasius started in 2015. It is the exclusive time tracking tool of Tegonal, an experienced software development team based in Bern (Switzerland). We developed Lasius because there was no tool available in 2015 and, to be honest, because we just wanted to build something new and nice :-)

Our time tracker had to be based on open source components, meet our high privacy standards and be able to be hosted wherever we wanted. The feature set of Lasius has been continuously adapted to our needs in everyday project work. As is often the case with internal tools, we got the tool to the point where it was usable for us internally, with limitations that could be identified and transferred internally. For a long time, we didn't find the time to complete the tool to the point where we could release it alongside our day-to-day work for our customers. When a large customer project ended unexpectedly, we suddenly had a lot of time to work on internal projects. We seized the opportunity, rewrote the entire front-end code and released Lasius to the public.

# Development
## Requirements

* mongoDB >= 5.0.9

## Environment Variables

This is only necessary if you sping up the containers manually or with your own compose file. For your convenience,
check out the [lasius-docker-compose](https://github.com/tegonal/lasius-docker-compose) companion repo.
Please see the `docker-compose.yml` file for container specific environment variables.

The following variables are suggested to be used in an `.env` file alongside docker-compose and could be used by all
containers, containing secrets that only might be available during CI/CD.

| Variable name | Description | Default value |
|----------------------------|-------------------------------------------------------------------------------------------------------------------------|--------------------------|
| LASIUS_HOSTNAME | Hostname (i.e. localhost, domain.com, ...) | localhost |
| LASIUS_VERSION | The current version, corresponds with docker image tags. We suggest using specific versions in production, not `latest` | latest |
| MONGODB_URI | Override connection to mongodb | see `docker-compose.yml` |
| MONGO_INITDB_PASSWORD | Password of mongoDB user | lasius |
| MONGO_INITDB_ROOT_PASSWORD | Password of root user of mongoDB | admin |
| MONGO_INITDB_ROOT_USERNAME | Username of root user of mongoDB | admin |
| MONGO_INITDB_USERNAME | Username of mongoDB user | lasius |
| NEXT_AUTH_SECRET | Hash for next-auth session salting, e.g. the output of `openssl rand -base64 32` | random string |
| TRAEFIK_CERT_EMAIL | E-mail address to use when fetching a certificate from LE | ssladmin@lasius.ch |
| TRAEFIK_CERT_RESOLVER | LetsEncrypt resolver, use `letsencrpyt` in production, empty value for testing (mind the LE rate limit) | letsencrypt |
| TZ | Your desired timezone | CET |

Specific to `backend` container:

| Variable name | Description | Default value |
|----------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------|
| LASIUS_CLEAN_DATABASE_ON_STARTUP | If true, drop on startup all data | 'false' |
| LASIUS_INITIALIZE_DATA | `'true'` if database should automatically get initialized in case no user accounts are configured | 'true' |
| LASIUS_INITIAL_USER_EMAIL | Username of initial admin user to login. Only used when `LASIUS_INITIALIZE_DATA` is set to `'true'` and no users where found in the database. | admin@lasius.ch |
| LASIUS_INITIAL_USER_KEY | Initial internal user key for to the intial user account. Only used when `LASIUS_INITIALIZE_DATA` is set to `'true'` and no users where found in the database. | admin |
| LASIUS_INITIAL_USER_PASSWORD | Password of initial admin user to login. Only used when `LASIUS_INITIALIZE_DATA` is set to `true` and no users where found in the database. | admin |
| LASIUS_START_PARAMS | Provide special start arguments to the play server. Might be used to inject a different `application.conf` to the server. | see `docker-compose.yml` |
| LASIUS_SUPPORTS_TRANSACTIONS | To be able to benefit of transactions in MongoDB you need a replica set first. | 'false' |

Specific to `frontend` container:

| Variable name | Description | Default value |
|------------------|---------------------------------------------------------------------------------------|---------------|
| ENVIRONMENT | `production` - any other value runs NextJS in dev mode. Not suggested in deployments. | production |
| NEXT_AUTH_SECRET | Hash for next-auth session salting, e.g. the output of `openssl rand -base64 32` | random string |

We suggest you use a `.env` file and save it in the same directory as the `docker-compose.yml` for build dependent configuration and edit all other variables in the `docker-compose.yml` file directly if they are not dependent on CI/CD variables.

## Dev Environment

To bring up a local dev Environment please install:

- sbt
- docker
- node

Start the backend with `yarn run backend` and the frontend with `yarn run dev` from the `frontend` directory.

## Test Environment

To simply bring up a test environment, check out
the [lasius-docker-compose](https://github.com/tegonal/lasius-docker-compose) companion repo.

## Production Environment

To bring up a production environment, check out
the [lasius-docker-compose](https://github.com/tegonal/lasius-docker-compose) companion repo.

The docker-compose setup above comes with single mongoDB instance and therefore without support of transactions. To use Lasius in production, you should use transactions and therefore run mongoDB in a replicaset. To benefit from transactions in Mongo DB you need to set `LASIUS_SUPPORTS_TRANSACTIONS=true` and configure an external access to the mongodb replicaset through `MONGODB_URI`.

Lasius' docker-compose.yml supports LetsEncrypt certificates out of the box, thanks to Traefik reverse proxy. If you decide to run Lasius behind another reverse proxy or SSL termination point, you can look at `docker-compose-no-https.yml`. However, we strongly suggest using secure connections.

# License

As we are strongly committed to open source software, we make Lasius available to the community under [AGPLv3](https://www.gnu.org/licenses/agpl-3.0.en.html) license. The code in this repo is provided without warranty.

# Support

If you you would like us to run Lasius for you and are willing to pay for the service, you can contact us here: <https://tegonal.com>

If you need help, discover a bug or have a feature request, please open an issue in this repo.
25 changes: 25 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
logs
project/project
project/target
target
tmp
.history
dist
/.idea
/*.iml
/out
/.idea_modules
/.classpath
/.project
/RUNNING_PID
/.settings
/.cache
bin
/journal
activator-*.sbt
.cache-main
.cache-tests
.bsp
.bloop/
.metals/
metals.sbt
1 change: 1 addition & 0 deletions backend/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.scala.html
10 changes: 10 additions & 0 deletions backend/.scalafmt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version = "3.2.1"
style = defaultWithAlign
maxColumn = 80
rewrite.rules = [AvoidInfix, SortImports, PreferCurlyFors]
align.openParenCallSite = true
align.openParenDefnSite = true
project.git = true
danglingParentheses.preset = false
trailingCommas = preserve
runner.dialect = scala213
5 changes: 5 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM tegonal/jelastic-openjdk:17

ADD ./target/universal/*.zip artifact.zip

EXPOSE 9000
Loading

0 comments on commit 4fd5226

Please sign in to comment.