-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove unused dependencies + migrate to MUI v5 * add / modify various files for production
- Loading branch information
Jeff Ma
authored
Nov 28, 2022
1 parent
7b663cc
commit 440ddf2
Showing
32 changed files
with
721 additions
and
985 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
lib/ | ||
node_modules/ | ||
*.sqlite3 | ||
.git/ | ||
|
||
/src/api/file-upload/**/*.json | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
node_modules | ||
build | ||
|
||
lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,38 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
# Using node 16 | ||
FROM node:16-slim | ||
|
||
# Change timezone of container from UTC to EST | ||
RUN rm -rf /etc/localtime | ||
RUN ln -s /usr/share/zoneinfo/America/New_York /etc/localtime | ||
|
||
# WORKDIR /waterloop | ||
WORKDIR /waterloop | ||
ENV PATH /waterloop/node_modules/.bin:$PATH | ||
|
||
# Initialize dependencies | ||
ENV NODE_ENV=production | ||
ENV NODE_OPTIONS="--max-old-space-size=4096" | ||
|
||
# COPY src ./src/ | ||
# COPY migrations ./migrations/ | ||
# COPY seeds ./seeds/ | ||
COPY .babelrc package.json yarn.lock fix.js .npmrc .nvmrc ./ | ||
|
||
# Copy over remaining files | ||
# COPY .env .babelrc package.json package-lock.json knexfile.js ./ | ||
RUN npm install -g knex | ||
RUN yarn install --production | ||
|
||
# Initialize dependencies | ||
# ENV NODE_ENV=test | ||
# RUN npm install | ||
# RUN npm install -g knex | ||
# RUN npm run build | ||
EXPOSE 9000 | ||
# add missing dependencies | ||
RUN yarn add mssql http2 | ||
|
||
# copy files over here after installing deps, to skip reinstalling deps | ||
COPY src ./src | ||
COPY public ./public | ||
COPY .env.prod ./.env | ||
|
||
# build project | ||
RUN yarn build | ||
|
||
EXPOSE 9000-9002 | ||
EXPOSE 3000-3002 | ||
|
||
CMD ["bash"] | ||
# enable swap memory, then run yarn start: | ||
# https://community.fly.io/t/swap-memory/2749 | ||
CMD /bin/bash -c "fallocate -l $(($(stat -f -c "(%a*%s/10)*7" .))) _swapfile && mkswap _swapfile && swapon _swapfile;" && yarn start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// code from https://github.com/brianc/node-postgres/issues/838#issuecomment-670941092 | ||
// this fixes docker build issue of requiring pg-native, which isn't recommended unless you want to install python3 in the docker image somehow. | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const pgClientPath = path.resolve( | ||
__dirname, | ||
'node_modules', | ||
'pg', | ||
'lib', | ||
'native', | ||
'client.js', | ||
); | ||
|
||
fs.readFile(pgClientPath, 'utf8', function (err, data) { | ||
if (err) { | ||
return console.log(err); | ||
} | ||
|
||
const result = data.replace( | ||
"var Native = require('pg-native')", | ||
'var Native = null', | ||
); | ||
|
||
fs.writeFile(pgClientPath, result, 'utf8', function (err) { | ||
if (err) return console.log(err); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# fly.toml file generated for waterloop-cms on 2022-11-26T21:50:01-05:00 | ||
# NOTE: make sure that you set the secret for DATABASE_URL if it's not already there. | ||
# Run 'flyctl secrets set DATABASE_URL=<pg connection string>' | ||
|
||
app = "waterloop-cms" | ||
kill_signal = "SIGINT" | ||
kill_timeout = 5 | ||
processes = [] | ||
|
||
[build] | ||
[build.args] | ||
NODE_VERSION = "16" | ||
|
||
[env] | ||
|
||
[experimental] | ||
allowed_public_ports = [] | ||
auto_rollback = true | ||
|
||
[[services]] | ||
http_checks = [] | ||
internal_port = 9000 | ||
processes = ["app"] | ||
protocol = "tcp" | ||
script_checks = [] | ||
[services.concurrency] | ||
hard_limit = 25 | ||
soft_limit = 20 | ||
type = "connections" | ||
|
||
[[services.ports]] | ||
force_https = true | ||
handlers = ["http"] | ||
port = 80 | ||
|
||
[[services.ports]] | ||
handlers = ["tls", "http"] | ||
port = 443 | ||
|
||
[[services.tcp_checks]] | ||
grace_period = "30s" | ||
interval = "15s" | ||
restart_limit = 0 | ||
timeout = "2s" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.