Skip to content

Commit

Permalink
WIP add docker compose
Browse files Browse the repository at this point in the history
  • Loading branch information
ColeDCrawford committed Sep 6, 2022
1 parent c0c714c commit 3a81a19
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 10 deletions.
15 changes: 12 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
FROM node:8-wheezy
# FROM node:8-wheezy # Can't get updates to install mysql
# FROM node:8-jessie, stretch
# ^ Fails: EEXIST: file already exists, symlink '../lib/node_modules/yarn/bin/yarn.js' -> '/usr/local/bin/yarn'
# FROM node:12 # this seems to work?
FROM node:16


ENV NODE_ENV = development

Expand All @@ -11,6 +16,10 @@ EXPOSE 3001

RUN rm -rf node_modules
RUN rm -rf client/node_modules
RUN npm i -g yarn && yarn install
# RUN npm i -g yarn && yarn install
RUN yarn install

# RUN babel -d ./build ./src
# RUN yarn run build

CMD ["yarn", "start-prod"]
CMD ["yarn", "start-dev"]
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# Sound Lab Website

[![pipeline status](http://gitlab.archimedes.digital/archimedes/soundlab-api/badges/develop/pipeline.svg)](http://gitlab.archimedes.digital/archimedes/soundlab-api/commits/develop)
[![coverage report](http://gitlab.archimedes.digital/archimedes/soundlab-api/badges/develop/coverage.svg)](http://gitlab.archimedes.digital/archimedes/soundlab-api/commits/develop)


Soundlab-API

The API for the soundlab application.
Expand Down Expand Up @@ -32,4 +28,4 @@ To configure the connection to the Wordpress backend, configure the `ADMIN_URL`

```
ADMIN_URL=http://soundlab.local:8888
```
```
58 changes: 58 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
services:
api:
# network_mode: ""
extra_hosts:
- "host.docker.internal:host-gateway"
# - "host.docker.internal:10.252.3.149"
build:
context: .
dockerfile: ./Dockerfile
image: soundlab-api
platform: linux/amd64
ports:
- 3001:3001
environment:
SESSION_SECRET: asdfgsfgdsadfgsdfgsadfsdfasdfsfdg
DB_NAME: slab
# DB_HOST: 127.0.0.1
# DB_HOST: localhost
# DB_HOST: docker.for.mac.host.internal
# DB_HOST: 172.19.0.1
DB_HOST: host.docker.internal
# DB_HOST: docker.for.mac.localhost
DB_PORT: 3306
DB_USER: slab
DB_PASS: slab
# CLIENT_SERVER: http://slab.loc
CLIENT_SERVER: http://localhost:3000
JWT_SECRET: '-D!s=oukAx@n/AKrisldTuZY?@x!Ok&lQTflnHk?38k4-j9`RBywDYpU<f5?BHMS'
DEFAULT_LANGUAGE: en

ADMIN_URL: http://slab.loc/admin
PRERENDER_TOKEN:
REACT_APP_SERVER: http://slab.loc

# WS_SERVER_PORT: 3002
# WS_SERVER_HOST: localhost
# WS_SERVER_URI: subscriptions

# EMAIL_SMTP_HOST=smtp.webfaction.com
# EMAIL_SMTP_PORT=465
# EMAIL_SMTP_SECURE=true
# EMAIL_SMTP_USER=???
# EMAIL_SMTP_PASSWORD=???
# EMAIL_FROM=noreply@orphe.us

AWS_ACCESS_KEY_ID: AKIAFAKEKEY123456789
AWS_SECRET_ACCESS_KEY: fakesecretaccesskey/realkeygoes+here
AWS_REGION: us-east-1
AWS_BUCKET: soundlab-uploads
REACT_APP_BUCKET_URL: soundlab-uploads

# for debugging
# entrypoint: ["sh", "-c", "sleep infinity"]





3 changes: 2 additions & 1 deletion src/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ const db = new Sequelize(
define: {
timestamps: false,
freezeTableName: true,
}
},
// operatorsAliases: false
}
);

Expand Down
7 changes: 6 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ db.authenticate()

listen();
})
.catch(() => {
.catch((e) => {
console.error(`Could not authenticate to database ${process.env.DB_NAME}`);
console.error(`${process.env.DB_HOST} ${process.env.DB_USER} ${process.env.DB_PASS}`);
console.error(e);
// Error: Client does not support authentication protocol requested by server; consider upgrading MySQL client
// See: https://github.com/sequelize/cli/issues/751
// Either upgrade Sequelize or downgrade MySQL or change the authentication method
});

0 comments on commit 3a81a19

Please sign in to comment.