Skip to content

Commit 929dffb

Browse files
michaeloffnerzspitzer
authored andcommitted
LDEV-5879 switch update provider to use maven
https://luceeserver.atlassian.net/browse/LDEV-5879
1 parent 13f2023 commit 929dffb

32 files changed

+2862
-1166
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
name: Java build
77
runs-on: ubuntu-latest
88
env:
9-
luceeVersion: 6.2.0.321
9+
luceeVersion: 6.2.2.91
1010
#luceeVersionQuery: 6.0.3/all/jar
1111
steps:
1212
- uses: actions/checkout@v4
@@ -59,6 +59,7 @@ jobs:
5959
testAdditional: ${{ github.workspace }}/tests
6060
testSevices: mysql
6161
LUCEE_ADMIN_ENABLED: false
62+
DEBUG: true
6263
- name: Run Lucee Test Suite (testLabels="data-provider-integration")
6364
uses: lucee/script-runner@main
6465
#continue-on-error: true
@@ -68,11 +69,18 @@ jobs:
6869
luceeVersion: ${{ env.luceeVersion }}
6970
#luceeVersionQuery: ${{ env.luceeVersionQuery }}
7071
extensionDir: ${{ github.workspace }}/
72+
luceeCFConfig: ${{ github.workspace }}/devops/.CFconfig-update.json5
7173
env:
7274
testLabels: data-provider-integration
7375
testAdditional: ${{ github.workspace }}/tests
7476
testSevices: mysql
7577
LUCEE_ADMIN_ENABLED: false
78+
DEBUG: true
79+
- name: debug failure
80+
if: ${{ failure() }}
81+
run: |
82+
pwd
83+
ls -lR ${{ github.workspace }}
7684
7785
build:
7886
name: Docker build & publish

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ update/WEB-INF
2727
update/log-maven-download.log
2828
update/missing-bundles.txt
2929
/tests/artifacts
30+
/apps/updateserver/services/legacy/artifacts

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,31 @@ This repo contains the application code for the following services used by Lucee
77
* https://extension.lucee.org
88

99
https://luceeserver.atlassian.net/issues/?jql=labels%20%3D%20%22updates%22
10+
11+
# Local Development
12+
13+
By default, the data provider is configured to work in production.
14+
15+
Create an `.env file` with the following settings to work locally.
16+
17+
```env
18+
ALLOW_RELOAD=true
19+
S3_CORE_ROOT=/var/local_s3/lucee_downloads/
20+
S3_EXTENSIONS_ROOT=/var/local_s3/lucee_ext/
21+
S3_BUNDLES_ROOT=/var/local_s3/lucee_bundles/
22+
UPDATE_PROVIDER=http://127.0.0.1:8889/rest/update/provider/
23+
UPDATE_PROVIDER_INT=http://update:8888/rest/update/provider/ # internal docker networking
24+
EXTENSION_PROVIDER=http://127.0.0.1:8889/rest/extension/provider/
25+
EXTENSION_PROVIDER_INT=http://update:8888/rest/extension/provider/ # internal docker networking
26+
DOWNLOADS_URL=http://download:8888/
27+
```
28+
29+
Create folders under `local_s3`
30+
31+
- in `lucee_downloads` place a few sample Lucee full jars
32+
- in `lucee_ext` place some sample extension lex files
33+
34+
The run `docker compose up`
35+
36+
Running locally, the downloads page is at http://127.0.0.1:8888/
37+
and the update provider is http://127.0.0.1:8889/rest/update/provider/list?extended=true

apps/download/Application.cfc

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,46 @@ component {
77
disallowDoctypeDecl: true
88
};
99

10-
//this.s3.accessKeyId = server.system.environment.S3_DOWNLOAD_ACCESS_KEY_ID;
11-
//this.s3.awsSecretKey = server.system.environment.S3_DOWNLOAD_SECRET_KEY;
12-
1310
request.s3Root="s3:///extension-downloads/";
1411
request.s3URL="https://s3-eu-west-1.amazonaws.com/extension-downloads/";
1512

1613
function onApplicationStart() {
17-
lock name="configure-sentry" type="exclusive" timeout=5{
18-
// workaround for LDEV-5371
19-
// if LUCEE_LOGGING_FORCE_APPENDER=console is set, sentry is bypassed
20-
var deploy = expandPath( '{lucee-server}/../deploy/' );
21-
var sentry_json = deploy & "/.CFconfig-sentry.json";
22-
if ( FileExists( sentry_json ) ){
23-
configImport( sentry_json, "server", "admin" );
24-
systemOutput("sentry.json loaded via configImport - LDEV-5371", true);
25-
fileDelete( sentry_json );
14+
application.extensionMeta = deserializeJson( fileRead( "extensionMeta.json" ) );
15+
application.sentryDsn = server.system.environment.SENTRY_DSN ?: "";
16+
17+
var sentryLogger = new services.SentryLogger(
18+
config = {
19+
dsn = application.sentryDsn,
20+
environment = server.system.environment.SENTRY_ENVIRONMENT ?: "production",
21+
release = server.system.environment.SENTRY_RELEASE ?: "",
22+
serverName = server.system.environment.SENTRY_SERVER_NAME ?: cgi.server_name
2623
}
27-
}
28-
application.extensionMeta = deserializeJson(fileRead("extensionMeta.json"));
24+
);
25+
26+
application.sentryLogger = sentryLogger;
2927
}
3028

31-
function onError(e){
32-
if (cgi.script_name contains "admin" or cgi.script_name contains "lucee"){
29+
function onError( e ){
30+
if ( cgi.script_name contains "admin" or cgi.script_name contains "lucee" ){
3331
header statuscode="418" statustext="nice try, you're a teapot";
3432
return;
3533
}
34+
35+
// Log to Sentry
36+
try {
37+
if ( structKeyExists( application, "sentryLogger" ) ) {
38+
application.sentryLogger.logException(
39+
exception = arguments.e,
40+
level = "error"
41+
);
42+
}
43+
} catch ( any err ) {
44+
// Don't let Sentry failures break error handling
45+
systemOutput( "Failed to log error to Sentry: #err.message#", true );
46+
}
47+
3648
header statuscode="500" statustext="Server error";
37-
echo("Sorry, Server error");
49+
echo( "Sorry, Server error" );
3850
}
3951

4052
function onRequest( string requestedPath ) output=true {

apps/download/download.cfc

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
component {
22

3-
variables.EXTENSION_PROVIDER="https://extension.lucee.org/rest/extension/provider/info?withLogo=true&type=all";
4-
//variables.EXTENSION_PROVIDER="http://127.0.0.1:8889/rest/extension/provider/info?withLogo=true&type=all";
5-
6-
variables.EXTENSION_DOWNLOAD="https://extension.lucee.org/rest/extension/provider/{type}/{id}";
7-
8-
variables.UPDATE_PROVIDER = "https://update.lucee.org/rest/update/provider";
9-
10-
//variables.UPDATE_PROVIDER = "http://127.0.0.1:8889/rest/update/provider";
3+
// provider urls are to communicate between the docker instances, so they need different urls
114

5+
// set EXTENSION_PROVIDER_INT=http://update:8888/rest/extension/provider in .env for local testing
6+
variables.EXTENSION_PROVIDER = server.system.environment.EXTENSION_PROVIDER_INT ?: "https://extension.lucee.org/rest/extension/provider";
7+
8+
// set DOWNLOAD_UPDATE_PROVIDER_INT=http://update:8888/rest/update/provider in .env for local testing
9+
variables.UPDATE_PROVIDER = server.system.environment.UPDATE_PROVIDER_INT ?: "https://update.lucee.org/rest/update/provider";
1210

1311
function getExtensions(flush=false) localmode=true {
12+
var extUrl = EXTENSION_PROVIDER &"/info?withLogo=true&type=all";
1413
if ( arguments.flush || isNull( application.extInfo ) ) {
15-
http url=EXTENSION_PROVIDER&"&flush="&arguments.flush result="http";
14+
http url=extUrl result="http";
1615

1716
if ( isNull( http.status_code ) || http.status_code != 200 )
18-
throw "could not connect to extension provider (#EXTENSION_PROVIDER#)";
17+
throw "could not connect to extension provider (#extUrl#)";
1918

2019
var data = deSerializeJson( http.fileContent, false );
21-
if (!structKeyExists( data, "meta" ) ) {
20+
if ( !structKeyExists( data, "meta" ) ) {
2221
systemOutput( "error fetching extensions, falling back on cache", true);
23-
http url=EXTENSION_PROVIDER result="http";
22+
http url=extUrl result="http";
2423

2524
if ( isNull( http.status_code ) || http.status_code != 200 )
26-
throw "could not connect to extension provider (#EXTENSION_PROVIDER#)";
25+
throw "could not connect to extension provider (#extUrl#)";
2726

2827
data = deSerializeJson( http.fileContent, false );
2928
application.extInfo = data.extensions;
@@ -240,8 +239,12 @@ component {
240239
application[ "changelogLastUpdated" ] = lastUpdated;
241240
// application.mavenInfo = {}; // not currently used
242241
// maven dates are static, only purge if unknown
243-
loop collection="#application.mavenDates#" key="local.version" value="local.date" {
244-
if ( len(date) eq 0 ) structDelete( application.mavenDates, version );
242+
if ( structKeyExists( application, "mavenDates" ) ){
243+
loop collection="#application.mavenDates#" key="local.version" value="local.date" {
244+
if ( len(date) eq 0 ) structDelete( application.mavenDates, version );
245+
}
246+
} else {
247+
application.mavenDates = {};
245248
}
246249

247250
}

0 commit comments

Comments
 (0)