-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrockcraft.yaml
187 lines (169 loc) · 5.62 KB
/
rockcraft.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.
---
# https://github.com/apache/superset/blob/master/Dockerfile
name: charmed-superset-rock
base: [email protected]
version: 3.1.3-22.04-edge
summary: Charmed Superset ROCK OCI
description: |
Superset is a business intelligence tool that is fast, lightweight,
intuitive, and loaded with options that make it easy for users
to explore and visualize their data.
license: Apache-2.0
services:
superset-ui:
override: replace
summary: "superset-ui service"
startup: disabled
command: "/app/k8s/k8s-bootstrap.sh"
environment:
CHARM_FUNCTION: "app-gunicorn"
SUPERSET_SECRET_KEY: "supersetR0cks!"
ADMIN_PASSWORD: "admin"
SUPERSET_LOAD_EXAMPLES: "true"
statsd-exporter:
override: replace
summary: "statsd metrics exporter"
startup: disabled
command: "/usr/bin/statsd_exporter"
platforms:
amd64:
# Please refer to
# https://discourse.ubuntu.com/t/unifying-user-identity-across-snaps-and-rocks/36469
# for more information about shared user.
# The UID 584792 corresponds to _daemon_ user.
run_user: _daemon_
parts:
patches:
plugin: dump
source: ./patches
organize:
fix-filter-force-update.patch: patches/fix-filter-force-update.patch
stage:
- patches/fix-filter-force-update.patch
prime:
- "-*"
superset:
after: [dependencies]
plugin: python
source: https://downloads.apache.org/superset/3.1.3/apache-superset-3.1.3-source.tar.gz # yamllint disable-line
source-checksum: sha512/5c35ae761d25fdbd3e1c1dc17d0354b1dd23d98d9c863da7d61b013d59cdb4337cd9e93f8a5b105b657e5d33fa823e138281e8f475dcd20fa0d473e56a00ea7e # yamllint disable-line
source-type: tar
build-packages:
- build-essential
stage-packages:
- python3.10-venv
local-files:
plugin: dump
source: ./startup-scripts
organize:
run-server.sh: app/k8s/run-server.sh
k8s-init.sh: app/k8s/k8s-init.sh
k8s-bootstrap.sh: app/k8s/k8s-bootstrap.sh
rock-requirements.txt: requirements/rock.txt
stage:
- app/k8s/run-server.sh
- app/k8s/k8s-init.sh
- app/k8s/k8s-bootstrap.sh
- requirements/rock.txt
permissions:
- path: app/k8s
owner: 584792
group: 584792
mode: "755"
- path: requirements
owner: 584792
group: 584792
mode: "755"
frontend:
after: [patches]
plugin: nil
source: https://downloads.apache.org/superset/3.1.3/apache-superset-3.1.3-source.tar.gz # yamllint disable-line
source-checksum: sha512/5c35ae761d25fdbd3e1c1dc17d0354b1dd23d98d9c863da7d61b013d59cdb4337cd9e93f8a5b105b657e5d33fa823e138281e8f475dcd20fa0d473e56a00ea7e # yamllint disable-line
source-type: tar
build-packages:
- git
build-snaps:
- node/14/stable
override-build: |
git apply --ignore-whitespace ${CRAFT_STAGE}/patches/*.patch
# Prepare for asset creation
cd superset-frontend
npm i --save-dev @types/underscore \
@types/urijs \
@types/mapbox__geojson-extent
npm install @loaders.gl/core \
@loaders.gl/loader-utils \
@react-spring/web
npm install dom-to-image \
currencyformatter.js --save
# Install frontend dependencies and build assets
npm ci
npm run build -- --output-path=${CRAFT_PART_INSTALL}/assets
organize:
assets: lib/python3.10/site-packages/superset/static/assets
stage:
- lib/python3.10/site-packages/superset/static/assets
permissions:
- path: lib/python3.10/site-packages/superset/static/assets
owner: 584792
group: 584792
mode: "755"
dependencies:
after: [local-files]
plugin: python
source: https://downloads.apache.org/superset/3.1.3/apache-superset-3.1.3-source.tar.gz # yamllint disable-line
source-checksum: sha512/5c35ae761d25fdbd3e1c1dc17d0354b1dd23d98d9c863da7d61b013d59cdb4337cd9e93f8a5b105b657e5d33fa823e138281e8f475dcd20fa0d473e56a00ea7e # yamllint disable-line
source-type: tar
build-packages:
- build-essential
- pkg-config
- libmysqlclient-dev
stage-packages:
- python3.10-venv
override-build: |
# Install Superset requirements
pip install --upgrade setuptools pip \
-r requirements/base.txt \
--target=/${CRAFT_PART_INSTALL}/dist \
-r ${CRAFT_STAGE}/requirements/rock.txt \
--target=/${CRAFT_PART_INSTALL}/dist
# Copy current directory files to app
cp -r . ${CRAFT_PART_INSTALL}/app
# Copy webfront images to expected dir
cd ${CRAFT_PART_INSTALL}/dist/flask_appbuilder/static/appbuilder/
cp -r css/webfonts/ webfonts/
organize:
dist: usr/local/lib/python3.10/dist-packages
stage:
- app
- usr/local/lib/python3.10/dist-packages
permissions:
- path: usr/local/lib/python3.10/dist-packages
owner: 584792
group: 584792
mode: "755"
prometheus-statsd-exporter:
plugin: dump
source: https://github.com/prometheus/statsd_exporter/releases/download/v0.26.1/statsd_exporter-0.26.1.linux-amd64.tar.gz # yamllint disable-line
source-checksum: sha256/36b33a04531cf871cf8c9c5d667e3c0ca59c07b4ba496bd6cd066bec4f25cc0d # yamllint disable-line
source-type: tar
organize:
statsd_exporter: bin/statsd_exporter
stage:
- bin/statsd_exporter
permissions:
- path: bin/statsd_exporter
owner: 584792
group: 584792
mode: "755"
overlay-pkgs:
after: [superset]
plugin: nil
overlay-packages:
- ca-certificates
- vim
stage-packages:
- libecpg-dev
- libmysqlclient-dev