Compare commits

..

2 Commits

Author SHA1 Message Date
iamBadgers
e1f7404c8d update compose to link memcached correctly 2025-06-01 22:31:51 -07:00
iamBadgers
1dae591ad5 add in port and memcache cl vars 2025-06-01 22:16:05 -07:00
3 changed files with 28 additions and 4 deletions

View File

@@ -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"]

View File

@@ -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
}) })

View File

@@ -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