Skip to content

Commit 2413490

Browse files
authored
Merge pull request #17 from datacite/version-upgrades
Version upgrades
2 parents 30de05c + e14bfdb commit 2413490

4 files changed

Lines changed: 412 additions & 609 deletions

File tree

Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM phusion/passenger-nodejs:2.0.0
1+
FROM phusion/passenger-nodejs:2.1.0
22
LABEL maintainer="jrhoads@datacite.org"
33

44
# Set correct environment variables
@@ -14,7 +14,6 @@ RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selectio
1414
# Update installed APT packages, clean up when done
1515
RUN apt-get update && \
1616
apt-get upgrade -y -o Dpkg::Options::="--force-confold" && \
17-
apt-get install wget ntp python-dev -y && \
1817
apt-get clean && \
1918
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
2019

app.js

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,10 @@ const Sentry = require('@sentry/node');
77
const compression = require('compression');
88
const morgan = require('morgan');
99
const { ApolloServer } = require('apollo-server-express');
10-
const { ApolloGateway, RemoteGraphQLDataSource } = require("@apollo/gateway");
10+
const { ApolloGateway, IntrospectAndCompose, RemoteGraphQLDataSource } = require("@apollo/gateway");
11+
const { ApolloServerPluginLandingPageGraphQLPlayground } = require('apollo-server-core');
1112

1213
const CLIENT_API_URL = process.env.CLIENT_API_URL || 'https://api.stage.datacite.org/client-api/graphql';
13-
// const PROFILES_URL = process.env.PROFILES_URL || 'https://api.stage.datacite.org/profiles/graphql';
14-
// const API_URL = process.env.API_URL || 'https://api.stage.datacite.org/api/graphql';
15-
// const RE3DATA_URL = process.env.RE3DATA_URL || 'https://api.stage.datacite.org/re3data/graphql';
16-
// const STRAPI_URL = process.env.STRAPI_URL || 'https://strapi.stage.datacite.org/graphql';
1714

1815
class AuthenticationHeader extends RemoteGraphQLDataSource {
1916
willSendRequest({ request, context }) {
@@ -24,19 +21,17 @@ class AuthenticationHeader extends RemoteGraphQLDataSource {
2421
}
2522

2623
const gateway = new ApolloGateway({
27-
serviceList: [
28-
{ name: 'client-api', url: CLIENT_API_URL },
29-
// { name: 'profiles', url: PROFILES_URL },
30-
// { name: 'strapi', url: STRAPI_URL }
31-
// { name: 'api', url: API_URL },
32-
// { name: 're3data', url: RE3DATA_URL }
33-
// more services
34-
],
24+
supergraphSdl: new IntrospectAndCompose({
25+
subgraphs: [
26+
{ name: 'client-api', url: CLIENT_API_URL },
27+
],
28+
}),
3529
buildService({ name, url }) {
3630
return new AuthenticationHeader({ url });
3731
},
3832
});
3933

34+
(async () => {
4035
const server = new ApolloServer({
4136
gateway,
4237
cors: false,
@@ -47,11 +42,13 @@ const server = new ApolloServer({
4742
apiKey: process.env.APOLLO_API_KEY,
4843
graphVariant: process.env.NODE_ENV
4944
},
50-
playground: {
51-
settings: {
52-
'editor.theme': 'light',
53-
}
54-
},
45+
plugins: [
46+
ApolloServerPluginLandingPageGraphQLPlayground({
47+
settings: {
48+
'editor.theme': 'light',
49+
}
50+
}),
51+
],
5552
context: ({ req }) => {
5653
// Get the user token from the headers
5754
const token = req.headers.authorization || '';
@@ -76,6 +73,7 @@ app.use(compression());
7673
// logging
7774
app.use(morgan('combined'));
7875

76+
await server.start();
7977
server.applyMiddleware({ app, cors: false });
8078

8179
// disable headers
@@ -86,4 +84,5 @@ if (typeof(PhusionPassenger) !== 'undefined') {
8684
} else {
8785
app.listen(4000);
8886
}
89-
87+
})();
88+

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717
"dev": "node app.js"
1818
},
1919
"dependencies": {
20-
"@apollo/gateway": "^0.20.0",
21-
"@sentry/node": "^5.15.5",
22-
"apollo-server-express": "^2.17",
20+
"@apollo/gateway": "^0.46.0",
21+
"@sentry/node": "^6.17.3",
22+
"apollo-server-express": "^3.6.2",
2323
"compression": "^1.7.4",
24-
"express": "^4.17.1",
25-
"graphql": "^14.0.0",
24+
"express": "^4.17.2",
25+
"graphql": "15",
2626
"morgan": "^1.10.0"
2727
},
2828
"devDependencies": {},
2929
"engines": {
30-
"node": ">= 12.*"
30+
"node": ">= 16.*"
3131
}
3232
}

0 commit comments

Comments
 (0)