Commit graph

51 commits

Author SHA1 Message Date
Kailash Nadh
79f94d3528 Update gorelease command and remove deprecated flags. 2024-10-27 18:14:32 +05:30
Kailash Nadh
32d5823dfe Refactor 'super' user type to a pre-defined super admin role. 2024-10-13 16:59:52 +05:30
Kailash Nadh
d4e4c5fa99 Add granular permissions and role management to backend and admin UI. 2024-10-13 16:59:51 +05:30
Kailash Nadh
f14df890a4 Update Go deps. 2024-01-27 20:55:50 +05:30
Kailash Nadh
a93031d5e0 Make Makefile accept custom build versions from env for dev builds. 2024-01-06 12:02:44 +05:30
Kailash Nadh
0c9dc07479 Add a ?v=hash cache breaker (that changes on restart) to static assets. 2023-12-31 22:20:37 +05:30
Kailash Nadh
af8b420d53 Refactor and upgrade the frontend vue code to work with vite instead of webpack.
- Upgrade eslint and fix a massive number (~2500!) of linting errors from new rules.
- Upgrade babel core frontend dev dependency.
- Upgrade UI lib and other frontend deps.
- Refactor the Vue admin app to use `vite` instead of `webpack`.
- This was an extremely tedious and painstaking, trial-and-error
  alchemy job. My disdain for the Javascript "ecosystem" grows.
- Re-add custom admin appearance endpoints to the refactored Vue page.
- Remove obsolete vue-cli config.
- Re-auto-format all .vue files again to work with new linters.
2023-12-25 19:26:08 +05:30
Kailash Nadh
5af6252b14 Fix make not picking up semver from git archive builds. Fixes #1380. 2023-09-19 11:42:07 +05:30
Karan Sharma
5664e5cc9f
fix: replace docker-compose with docker compose (#1490)
Fixes https://github.com/knadh/listmonk/issues/1431
2023-08-28 20:13:03 +05:30
Alexis Vanier
5a6b338766 Use --idempotent and --yes flags when bootstrapping the dev db 2022-01-19 09:29:47 -05:00
Kailash Nadh
920645f90e Fix typo in Makefile. 2021-12-18 13:14:14 +05:30
Karan Sharma
e977b901e1 feat: Add dev docker setup 2021-12-01 23:17:14 +05:30
Kailash Nadh
443ba184c3
Merge pull request #491 from citrus-it/makedep
pack-bin is missing dependency on build-frontend
2021-09-29 19:15:23 +05:30
Andy Fiddaman
ecc35164b3 pack-bin is missing dependency on build-frontend
When building on a system with enough cores, there is a race condition where
make runs pack-bin before build-frontend is complete.

Running: /usr/bin/gmake -j 60 dist
go install github.com/knadh/stuffbin/...
CGO_ENABLED=0 go build -o listmonk -ldflags="-s -w -X 'main.buildString=v2.0.0 (#05585b7 2021-09-29T08:59:00+0000)' -X 'main.versionString=v2.0.0'" cmd/*.go
cd frontend && /data/omnios-build/omniosorg/r151038/_extra/listmonk-2.0.0/listmonk-2.0.0/listmonk/_deps/node_modules/yarn/bin/yarn install
yarn install v1.22.11
[1/4] Resolving packages...
[2/4] Fetching packages...
/data/omnios-build/omniosorg/r151038/_extra/listmonk-2.0.0/listmonk-2.0.0/listmonk/_deps/bin/stuffbin -a stuff -in listmonk -out listmonk config.toml.sample schema.sql queries.sql static/public:/public static/email-templates frontend/dist:/admin i18n:/i18n
stuffing failed: stat frontend/dist: no such file or directory
gmake: *** [Makefile:76: pack-bin] Error 1
gmake: *** Waiting for unfinished jobs....
2021-09-29 09:17:21 +00:00
Andy Fiddaman
ac69f6c16e Use POSIX standard -c flag for "touch"
non-GNU systems like FreeBSD and illumos do not understand the long
"--no-create" flag to touch. POSIX defines that conforming implementations
must understand "-c" for this, so use the flag that is widely understood
(including by GNU touch).

    https://pubs.opengroup.org/onlinepubs/9699919799/utilities/touch.html
2021-09-29 08:51:09 +00:00
Kailash Nadh
a97d81a8dc Merge branch 'refactor-frontend-path' 2021-09-23 19:26:45 +05:30
Kailash Nadh
6904b1f3d0 Remove redundant clause from the Makefile. 2021-09-23 19:26:38 +05:30
Kailash Nadh
bb340b8785 Refactor frontend build and name space all admin URIs behind /admin/.
- Namespace all admin UI URLs behind `/admin/*`.
  This breaks the current admin UI URLs.
- Make Vue output build assets to `frontend/dist/*` instead of
  `frontend/dist/frontend`.
- Namespace Vue static assets to `/admin/static/*`.

This commit reduces the cofusing and convoluted Vue+WebPack build URI
and static path schemes. In addition, it removes ambiguity in URLs
where non-UI URLs like `/public`, `/api`, `/webhooks` etc. were in the
same name space as UI URLs like `/campaigns`, `/lists` etc. Now all UI
URLs are behind `/admin/`, also simplifying security rules for proxies.
2021-09-23 19:21:35 +05:30
Kailash Nadh
623030a0c5 Replace go get with go install stuffbin (Go 1.17 deprecation). 2021-09-19 15:02:29 +05:30
Kailash Nadh
d27e16e9ca Add a VERSION file for git-archive export
- Use git to get tag and commit hash or fall back to extracting
  the values from the VERSION file if it is (from git archive)
2021-08-14 13:41:19 +05:30
Kailash Nadh
af11a176f1 Refactor make run to always compile and use the correct frontend path 2021-07-25 15:47:37 +05:30
Kailash Nadh
82735bba69 Refactor behaviour of loading static files from disk vs. embedding.
Ref: https://github.com/knadh/listmonk/issues/409

- Introduce `main.appDir` and `main.fronendDir` Go compile-time flags
  to hardcode custom paths for loading frontend assets
  (frontend/dist/frontend in the repo after build) and app assets
  (queries.sql, schema.sql, config.toml.sample) in environments where
  embedding files in the binary is not feasible.
  These default to CWD unless explicitly set during compilation.

- Fix the Vue favicon path oddity by copying the icon into the built
  frontend dir in the `make-frontend` step.
2021-07-11 10:46:45 +05:30
Kailash Nadh
3be5227c22 Account for all *.go files in the repo in the Makefile build target 2021-06-29 22:23:52 +05:30
Konrad Mohrfeldt
89bfe74f50 use make’s dependency handling to speed-up rebuilds
make allows us to run build targets based on dependencies and will only
execute targets if the dependencies have changed. This drastically
speeds up rebuilds if some targets have already been executed and
are still up to date.
2021-06-26 21:10:08 +02:00
Konrad Mohrfeldt
07478a588c allow yarn bin to be overridden
Users might want to override the yarn command to add options
or use a different bin on systems like debian where yarn is
named yarnpkg.
2021-06-26 19:20:40 +02:00
Tamal Saha
a266027f6c Build static Go binary
Signed-off-by: Tamal Saha <tamal@appscode.com>
2021-04-11 15:07:19 +05:30
Kailash Nadh
570a81f966 WIP: Add tests 2021-04-10 12:26:33 +05:30
Kailash Nadh
afef994e6d Fix incorrect make command 2021-01-24 13:07:42 +05:30
Kailash Nadh
3498a727f5 WIP: Add i18n support 2021-01-17 20:59:01 +05:30
Kailash Nadh
e9bf47b006 Fix --version string and duplicate printing 2020-10-18 22:59:22 +05:30
Kailash Nadh
cfe66bb29d Fix and refactor Makefile and .goreleaser build commands.
The earlier goreleaser implementation was incorrect where every
build would trigger `make pack-release` with the list of all
cross-platform releases. Fix that to atomically run the packing
once per goreleaser build. In addition, add `make release-dry`
and `make release` for goreleaser.
2020-10-18 22:44:21 +05:30
Vivek R
584c3bd2aa fix: incorrect git tag being injected as version
Git tag version injected via Makefile is incorrect since `git describe`
doesn't consider annotated tags but all the recent releases are lightweight tags.
So instead use `git describe --tags` command which also considers recent lightweight tag.
2020-10-03 03:55:39 +05:30
Kailash Nadh
0f055eacb8 Fix build scripts (and static file embed) 2020-08-09 20:02:43 +05:30
Kailash Nadh
d8a60d1295 Add automatic update checks.
- A check for new versions on the GitHub releases pages happens
  once every 24 hours. When a new version is available, a notice
  is displayed on the admin UI.
2020-08-08 16:59:47 +05:30
Kailash Nadh
f3e80da339 Clean up root and move app to cmd directory 2020-08-08 13:54:25 +05:30
Kailash Nadh
942eb7c3d8 Add settings UI and "hot reload" support to the app.
This is a major breaking change that moves away from having the
entire app configuration in external TOML files to settings being
in the database with a UI to update them dynamically.

The app loads all config into memory (app settings, SMTP conf)
on boot. "Hot" replacing them is complex and it's a fair tradeoff
to instead just restart the application as it is practically
instant.

A new `settings` table stores arbitrary string keys with a JSONB
value field which happens to support arbitrary types. After every
settings update, the app gracefully releases all resources
(HTTP server, DB pool, SMTP pool etc.) and restarts itself,
occupying the same PID. If there are any running campaigns, the
auto-restart doesn't happen and the user is prompted to invoke
it manually with a one-click button once all running campaigns
have been paused.
2020-07-21 00:23:57 +05:30
Kailash Nadh
97583fe4b4 Rewrite frontend with Vue+Buevy and ditch React+Ant Design.
- antd+react was resulting in extremely clunky and unreadable
  spaghetti frontend code (primarily due to how antd is).
- Buefy is lighter by an order of magnitude, has excellent
  responsive views (especially tables) and usability.
- Vue's templating produces far more readable template code.
2020-07-04 00:12:14 +05:30
Kailash Nadh
ad9ee7528d Update build script to reflect new static paths 2020-03-08 16:10:34 +05:30
Kailash Nadh
2ee2e68230 Inject version during build into the frontend 2020-02-09 18:50:08 +05:30
Rohan Verma
d5a47deb39
fix: buildString having incorrect TZ data 2019-09-06 13:43:49 +05:30
Kailash Nadh
08aa05cd13 Fix incorrect version string in build 2019-09-06 13:32:07 +05:30
Kailash Nadh
e89a54b957 Refactor and add new build routines
- Fix version injection in build
- Refactor Makefile
- Add --new-config flag to generate sample config
- Add license
- Remove autogenerated frontend README
- Refactor make dist to do end-to-end build
- Refactor build and add goreleaser conf
2019-07-09 15:57:04 +05:30
Kailash Nadh
64043f0d62 Add run-frontend to Makefile 2019-07-02 13:23:44 +05:30
Kailash Nadh
1caa63b113 Rename 'build-dist' to 'dist' in Makefile 2019-06-26 17:50:53 +05:30
Kailash Nadh
95038d3f3c Refactor Makefile 2019-06-26 11:59:03 +05:30
Vivek R
11ca4beddb chore: fix frontend directory structure 2019-05-27 17:17:26 +05:30
Kailash Nadh
9729395648 Add dev README 2019-05-14 17:46:12 +05:30
Kailash Nadh
e43c9b88e9 Add target 'run' to Makefile 2019-03-27 13:35:51 +05:30
Joe Paul
4ef5a3a042 chore: Go modules and add readme 2019-02-01 11:13:37 +05:30
Kailash Nadh
7eeb813f19 Add embedding of static assets for standalone dist binary
This is a big commit that involves drastic changes to how static assets
(.sql and template files, the whole frontend bundle) are handled.
listmonk distribution should be a self-contained single binary
distribution, hence all static assets should be bundled. After
evaluating several solutions, srtkkou/zgok seemed like the best bet but
it lacked several fundamental features, namely the ability to fall back
to the local filesystem in the absence of embedded assets (for instance,
in the dev mode). Moreover, there was a lot of room for cleanup.

After a PR went unanswered, github.com/knadh/stuffbin was created. Just
like zgok, this enables arbitrary files and assets to be embedded into a
compiled Go binary that can be read during runtime. These changes
followed:

- Compress and embed all static files into the binary during
  the build (Makefile) to make it standalone and distributable
- Refactor static paths (/public/* for public facing assets,
  /frontend/* for the frontend app's assets)
- Add 'logo_url' to config
- Remove 'assets_path' from config
- Tweak yarn build to not produce symbol maps and override
  the default /static (%PUBLIC_URL%) path to /frontend
2019-01-03 16:48:47 +05:30