diff --git a/.env.sample b/.env.sample index d47d652..c4ea110 100644 --- a/.env.sample +++ b/.env.sample @@ -25,9 +25,9 @@ INFURA_PROJECT_ID=??? # default is https://test-image.timesafari.app #DOWNLOAD_IMAGE_SERVER=test-image.timesafari.app -# default is 3000 +# default is 3002 #PORT=3000 -# default is jdbc:sqlite:./sqlite-db.sqlite +# default is ./image.sqlite # file name also referenced in flyway.conf and in code -#SQLITE_FILE=./image-db.sqlite +#SQLITE_FILE=./image.sqlite diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..34f47f6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +# syntax=docker/dockerfile:1 + +FROM node:21-alpine +ARG IMAGE_API_VERSION +RUN npm install -g pnpm +RUN apk add git +RUN git clone https://gitea.anomalistdesign.com/log-trade/image-api.git + +WORKDIR image-api +RUN git checkout $IMAGE_API_VERSION +RUN pnpm install --prod + +CMD node server.js diff --git a/README.md b/README.md index 7c86f03..2392022 100644 --- a/README.md +++ b/README.md @@ -39,13 +39,16 @@ JWT=`node -e "$CODE"`; curl -X DELETE -H "Authorization: Bearer $JWT" http://loc ## deploy to prod first time -* Do the necessary steps from "setup" above. +* Do the necessary steps from "setup" above, or `docker build` it. -* In object storage, set up bucket and erase any test data. +* In object storage, set up bucket (and erase any test data). + +* Create a cert for the image delivery & image API servers. * In haproxy, set a permanent web forward to the correct storage location. + * eg. `http-request redirect code 301 location https://a2-west.americancloud.com/images6618:giftsimagetest%[capture.req.uri] if { hdr_dom(host) -i test-image.timesafari.app }` ## deploy to prod subsequent times -* Add CHANGELOG.md entry. Update version in server.js file. +* Update version in server.js file. Add CHANGELOG.md entry. diff --git a/package.json b/package.json index 78eb295..2584ea4 100644 --- a/package.json +++ b/package.json @@ -1,4 +1,5 @@ { + "name": "Images for Trade", "version": "0.0.1", "description": "", diff --git a/server.js b/server.js index 9cc6761..4c6f1a0 100644 --- a/server.js +++ b/server.js @@ -16,9 +16,9 @@ require('dotenv').config() const app = express(); app.use(cors()); -const port = process.env.PORT || 3001; +const port = process.env.PORT || 3002; // file name also referenced in flyway.conf and potentially in .env files or in environment variables -const dbFile = process.env.SQLITE_FILE || './image-db.sqlite'; +const dbFile = process.env.SQLITE_FILE || './image.sqlite'; const bucketName = process.env.S3_BUCKET_NAME || 'gifts-image-test'; const imageServer = process.env.DOWNLOAD_IMAGE_SERVER || 'test-image.timesafari.app';