add graalvm support
This commit is contained in:
parent
c6e67366d9
commit
145c1baf05
4 changed files with 27 additions and 48 deletions
|
@ -1,24 +1,33 @@
|
|||
# install graalvm
|
||||
|
||||
```
|
||||
curl -LO https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-21.0.0.2/graalvm-ce-java11-linux-amd64-21.0.0.2.tar.gz
|
||||
|
||||
# unpack
|
||||
tar -xzf graalvm-ce-java11-linux-amd64-21.0.0.2.tar.gz
|
||||
|
||||
# install native-image in graalvm-ce-java11-linux-amd64-21.0.0.2/bin
|
||||
```
|
||||
# ./gu is inside the /bin folder
|
||||
./gu install native-image
|
||||
sudo mv graalvm-ce-java11-21.0.0.2 /usr/lib/jvm/
|
||||
sudo ln -s /usr/lib/jvm/graalvm-ce-java11-21.0.0.2 /usr/lib/jvm/graalvm
|
||||
sudo ln -s /usr/lib/jvm/graalvm/bin/gu /usr/local/bin
|
||||
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/graalvm/bin/java 2
|
||||
sudo update-alternatives --config java
|
||||
|
||||
# install native-image in graalvm-ce-java11-linux-amd64-21.0.0.2/bin
|
||||
sudo gu install native-image
|
||||
sudo ln -s /usr/lib/jvm/graalvm/bin/native-image /usr/local/bin
|
||||
|
||||
# after you installed native-image, there should appere a ./native-image file
|
||||
```
|
||||
# deps
|
||||
sudo apt-get install build-essential libz-dev zlib1g-dev
|
||||
|
||||
# build
|
||||
mkdir -p target/graalvm
|
||||
lein uberjar
|
||||
lein native
|
||||
|
||||
# build image. e.g.
|
||||
./bin/native-image -jar ~/repo/dda/k8s-mastodon-bot/target/uberjar/k8s-mastodon-bot-0.1.3-SNAPSHOT.jar ~/repo/dda/k8s-mastodon-bot/target/bot
|
||||
native-image -jar ~/repo/dda/k8s-mastodon-bot/target/uberjar/k8s-mastodon-bot-0.1.3-SNAPSHOT.jar ~/repo/dda/k8s-mastodon-bot/target/bot
|
||||
|
||||
# execute
|
||||
```
|
||||
cd ~/repo/dda/k8s-mastodon-bot/target/bot
|
||||
./bot
|
||||
```
|
11
project.clj
11
project.clj
|
@ -21,6 +21,7 @@
|
|||
:profiles {:test {:test-paths ["src/test/cljc"]
|
||||
:resource-paths ["src/test/resources"]
|
||||
:dependencies [[dda/data-test "0.1.1"]]}
|
||||
:dev {:plugins [[lein-shell "0.5.0"]]}
|
||||
:uberjar {:aot :all
|
||||
:main dda.k8s-mastodon-bot.uberjar
|
||||
:uberjar-name "k8s-mastodon-bot-standalone.jar"
|
||||
|
@ -32,4 +33,12 @@
|
|||
["vcs" "commit"]
|
||||
["vcs" "tag"]
|
||||
["deploy"]
|
||||
["change" "version" "leiningen.release/bump-version"]])
|
||||
["change" "version" "leiningen.release/bump-version"]]
|
||||
:aliases {"native" ["shell"
|
||||
"native-image"
|
||||
"--report-unsupported-elements-at-runtime"
|
||||
"--initialize-at-build-time"
|
||||
"-jar" "target/uberjar/k8s-mastodon-bot-standalone.jar"
|
||||
"-H:IncludeResources=src/main/resources/.*"
|
||||
"-H:Log=registerResource"
|
||||
"-H:Name=target/graalvm/${:name}"]})
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
{:auth {;; add Twitter config to mirror Twitter accounts
|
||||
:twitter {:consumer_key "XXXX"
|
||||
:consumer_secret "XXXX"
|
||||
:access_token_key "XXXX"
|
||||
:access_token_secret "XXXX"}
|
||||
:mastodon {:access_token "XXXX"
|
||||
;; account number you see when you log in and go to your profile
|
||||
;; e.g: https://mastodon.social/web/accounts/294795
|
||||
:account-id "XXXX"
|
||||
:api_url "https://botsin.space/api/v1/"}
|
||||
:tumblr {:consumer_key "XXXX"
|
||||
:consumer_secret "XXXX"
|
||||
:token "XXXX"
|
||||
:token_secret "XXXX"}}}
|
|
@ -1,25 +0,0 @@
|
|||
{:transform [{:source {:source-type :twitter
|
||||
;; optional, defaults to false
|
||||
:include-replies? false
|
||||
;; optional, defaults to false
|
||||
:include-rts? false
|
||||
;; Replace Twitter links by Nitter
|
||||
:nitter-urls? false
|
||||
;; accounts you wish to mirror
|
||||
:accounts ["arstechnica" "WIRED"]}
|
||||
:target {:target-type :mastodon
|
||||
;; optional flag specifying wether the name of the account
|
||||
;; will be appended in the post, defaults to false
|
||||
:append-screen-name? false
|
||||
;; optional visibility flag: direct, private, unlisted, public
|
||||
;; defaults to public
|
||||
:visibility "unlisted"
|
||||
;; optional boolean to mark content as sensitive. Defaults to true.
|
||||
:sensitive? true
|
||||
;; optional boolean defaults to false
|
||||
;; only sources containing media will be posted when set to true
|
||||
:media-only? true
|
||||
;; optional limit for the post length. Defaults to 300.
|
||||
:max-post-length 300
|
||||
;; optional signature for posts. Defaults to "not present".
|
||||
:signature "#newsbot"}}]}
|
Loading…
Reference in a new issue