Compare commits
2 Commits
66eb266dd3
...
e1f7404c8d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1f7404c8d | ||
|
|
1dae591ad5 |
@@ -44,7 +44,8 @@ WORKDIR loader
|
|||||||
|
|
||||||
EXPOSE 3001
|
EXPOSE 3001
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
|
ENV MEMCACHE_ADDR="localhost:11211"
|
||||||
|
|
||||||
WORKDIR /srv/cprush-stats
|
WORKDIR /srv/cprush-stats
|
||||||
RUN npm install
|
RUN npm install
|
||||||
CMD ["node", "app.js"]
|
CMD ["sh", "-c", "node app.js -m $MEMCACHE_ADDR"]
|
||||||
@@ -13,9 +13,14 @@ var Memcached = require('memcached')
|
|||||||
|
|
||||||
const app = express()
|
const app = express()
|
||||||
const jsonParser = json()
|
const jsonParser = json()
|
||||||
const port = 3001
|
const port = process.argv[process.argv.indexOf('-p')]
|
||||||
|
? process.argv[process.argv.indexOf('-p') + 1]
|
||||||
|
: 3001
|
||||||
|
const memcache_addr = process.argv[process.argv.indexOf('-m')]
|
||||||
|
? process.argv[process.argv.indexOf('-m') + 1]
|
||||||
|
: 'localhost:11211'
|
||||||
// const memcache = new memcached('localhost:11211', {})
|
// const memcache = new memcached('localhost:11211', {})
|
||||||
const memcachep = new Memcache('localhost:11211')
|
const memcachep = new Memcache(memcache_addr)
|
||||||
|
|
||||||
addGameApis(app, jsonParser, memcachep)
|
addGameApis(app, jsonParser, memcachep)
|
||||||
addCharacterApis(app, jsonParser, memcachep)
|
addCharacterApis(app, jsonParser, memcachep)
|
||||||
@@ -29,5 +34,7 @@ app.use('/', (req, res) => {
|
|||||||
|
|
||||||
app.listen(port, async () => {
|
app.listen(port, async () => {
|
||||||
await database.authenticate()
|
await database.authenticate()
|
||||||
return console.log(`Express is listening at http://localhost:${port}`)
|
console.log(`Using memcache at ${memcache_addr}`)
|
||||||
|
console.log(`Express is listening at http://localhost:${port}`)
|
||||||
|
return
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,5 +1,21 @@
|
|||||||
|
version: "3"
|
||||||
|
|
||||||
|
networks:
|
||||||
|
cprush-net:
|
||||||
|
external: false
|
||||||
|
|
||||||
services:
|
services:
|
||||||
cprush:
|
cprush:
|
||||||
image: potato
|
image: potato
|
||||||
|
networks:
|
||||||
|
- cprush-net
|
||||||
|
environment:
|
||||||
|
- MEMCACHE_ADDR=memcache:11211
|
||||||
ports:
|
ports:
|
||||||
- 3001:3001
|
- 3001:3001
|
||||||
|
depends_on:
|
||||||
|
- memcache
|
||||||
|
memcache:
|
||||||
|
image: memcached
|
||||||
|
networks:
|
||||||
|
- cprush-net
|
||||||
Reference in New Issue
Block a user