- switched to supervisord based combined container
- heroku deployments
This commit is contained in:
parent
46760ae135
commit
5414f3b371
@ -11,8 +11,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
- switched to supervisord based combined container
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
- heroku deployments
|
||||||
|
|
||||||
### Security
|
### Security
|
||||||
|
|
||||||
## [0.9.9] - 2021-02-14
|
## [0.9.9] - 2021-02-14
|
||||||
|
68
Dockerfile
68
Dockerfile
@ -1,27 +1,14 @@
|
|||||||
## Build API
|
## Build UI
|
||||||
FROM node:14-alpine as api
|
FROM node:14-alpine as ui
|
||||||
|
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/ui
|
||||||
|
|
||||||
COPY ui/ .
|
|
||||||
|
|
||||||
RUN yarn install --frozen-lockfile
|
|
||||||
RUN yarn export
|
|
||||||
|
|
||||||
## Build APP
|
|
||||||
FROM node:14-alpine as app
|
|
||||||
LABEL maintainer="OhMyForm <admin@ohmyform.com>"
|
|
||||||
|
|
||||||
WORKDIR /usr/src/app
|
|
||||||
|
|
||||||
RUN apk update && apk add curl bash && rm -rf /var/cache/apk/*
|
RUN apk update && apk add curl bash && rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
# install node-prune (https://github.com/tj/node-prune)
|
# install node-prune (https://github.com/tj/node-prune)
|
||||||
RUN curl -sfL https://install.goreleaser.com/github.com/tj/node-prune.sh | bash -s -- -b /usr/local/bin
|
RUN curl -sfL https://install.goreleaser.com/github.com/tj/node-prune.sh | bash -s -- -b /usr/local/bin
|
||||||
|
|
||||||
|
COPY ui/ .
|
||||||
COPY api/ .
|
|
||||||
COPY --from=api /usr/src/app/out /usr/src/app/public
|
|
||||||
|
|
||||||
RUN yarn install --frozen-lockfile
|
RUN yarn install --frozen-lockfile
|
||||||
RUN yarn build
|
RUN yarn build
|
||||||
@ -32,22 +19,53 @@ RUN npm prune --production
|
|||||||
# run node prune
|
# run node prune
|
||||||
RUN /usr/local/bin/node-prune
|
RUN /usr/local/bin/node-prune
|
||||||
|
|
||||||
## Glue
|
## Build API
|
||||||
RUN touch /usr/src/app/src/schema.gql && chown 9999:9999 /usr/src/app/src/schema.gql
|
FROM node:14-alpine as api
|
||||||
|
LABEL maintainer="OhMyForm <admin@ohmyform.com>"
|
||||||
|
|
||||||
|
WORKDIR /usr/src/api
|
||||||
|
|
||||||
|
RUN apk --update add curl bash && rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
|
# install node-prune (https://github.com/tj/node-prune)
|
||||||
|
RUN curl -sfL https://install.goreleaser.com/github.com/tj/node-prune.sh | bash -s -- -b /usr/local/bin
|
||||||
|
|
||||||
|
COPY api/ .
|
||||||
|
|
||||||
|
RUN touch /usr/src/api/src/schema.gql && chown 9999:9999 /usr/src/api/src/schema.gql
|
||||||
|
|
||||||
|
RUN yarn install --frozen-lockfile
|
||||||
|
RUN yarn build
|
||||||
|
|
||||||
|
# remove development dependencies
|
||||||
|
RUN npm prune --production
|
||||||
|
|
||||||
|
# run node prune
|
||||||
|
RUN /usr/local/bin/node-prune
|
||||||
|
|
||||||
## Production Image.
|
## Production Image.
|
||||||
FROM node:14-alpine
|
FROM node:14-alpine
|
||||||
|
|
||||||
WORKDIR /usr/src/app
|
RUN apk --update add supervisor nginx && rm -rf /var/cache/apk/*
|
||||||
COPY --from=app /usr/src/app /usr/src/app
|
|
||||||
|
WORKDIR /usr/src
|
||||||
|
|
||||||
|
COPY --from=api /usr/src/api /usr/src/api
|
||||||
|
COPY --from=ui /usr/src/ui /usr/src/ui
|
||||||
|
|
||||||
RUN addgroup --gid 9999 ohmyform && adduser -D --uid 9999 -G ohmyform ohmyform
|
RUN addgroup --gid 9999 ohmyform && adduser -D --uid 9999 -G ohmyform ohmyform
|
||||||
ENV PORT=3000 \
|
ENV SECRET_KEY=ChangeMe \
|
||||||
SECRET_KEY=ChangeMe \
|
|
||||||
CREATE_ADMIN=FALSE \
|
CREATE_ADMIN=FALSE \
|
||||||
ADMIN_EMAIL=admin@ohmyform.com \
|
ADMIN_EMAIL=admin@ohmyform.com \
|
||||||
ADMIN_USERNAME=root \
|
ADMIN_USERNAME=root \
|
||||||
ADMIN_PASSWORD=root
|
ADMIN_PASSWORD=root
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
USER ohmyform
|
|
||||||
CMD [ "yarn", "start:prod" ]
|
RUN mkdir /run/nginx/
|
||||||
|
RUN touch /usr/src/supervisord.log && chmod 777 /usr/src/supervisord.log
|
||||||
|
COPY supervisord.conf /etc/supervisord.conf
|
||||||
|
COPY nginx.conf /etc/nginx/conf.d/ohmyform.conf
|
||||||
|
|
||||||
|
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
|
||||||
|
# CMD [ "yarn", "start:prod" ]
|
||||||
|
2
api
2
api
@ -1 +1 @@
|
|||||||
Subproject commit e1670223cfb84e221be15e820761640e6916e6f4
|
Subproject commit 9327514e8345b1ef1e656610246a981fe93ac33c
|
6
app.json
6
app.json
@ -34,7 +34,7 @@
|
|||||||
},
|
},
|
||||||
"LOGIN_NOTE": {
|
"LOGIN_NOTE": {
|
||||||
"description": "Note next to login form",
|
"description": "Note next to login form",
|
||||||
"value": "Either login with root:root or create your own account to test OhMyForm\n\nData will be deleted at arbitrary intervals!"
|
"value": "Welcome to your new OhMyForm instance, you can remove this login note in the dyno configuration!"
|
||||||
},
|
},
|
||||||
"ADMIN_PASSWORD": {
|
"ADMIN_PASSWORD": {
|
||||||
"description": "Password for your default admin account",
|
"description": "Password for your default admin account",
|
||||||
@ -55,6 +55,10 @@
|
|||||||
"DATABASE_DRIVER": {
|
"DATABASE_DRIVER": {
|
||||||
"description": "Database Driver to use",
|
"description": "Database Driver to use",
|
||||||
"value": "postgres"
|
"value": "postgres"
|
||||||
|
},
|
||||||
|
"DATABASE_SSL": {
|
||||||
|
"description": "Use SSL Connection for database",
|
||||||
|
"value": "true"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"addons": [
|
"addons": [
|
||||||
|
@ -7,37 +7,33 @@ version: "3"
|
|||||||
services:
|
services:
|
||||||
redis:
|
redis:
|
||||||
image: redis
|
image: redis
|
||||||
mongo:
|
|
||||||
image: mongo
|
|
||||||
volumes:
|
|
||||||
- "./data/mongo:/data/db"
|
|
||||||
ohmyform:
|
ohmyform:
|
||||||
build: .
|
build: .
|
||||||
environment:
|
environment:
|
||||||
CREATE_ADMIN: "TRUE"
|
CREATE_ADMIN: "TRUE"
|
||||||
MONGODB_URI: mongodb://mongo/ohmyform
|
|
||||||
MAILER_URI: smtp://mail:1025
|
MAILER_URI: smtp://mail:1025
|
||||||
PORT: 5000
|
DATABASE_DRIVER: postgres
|
||||||
|
DATABASE_URL: postgresql://root:root@db:5432/ohmyform
|
||||||
|
LOGIN_NOTE: "login with root:root!"
|
||||||
|
SECRET_KEY: 12345
|
||||||
links:
|
links:
|
||||||
- mongo
|
- db
|
||||||
- redis
|
- redis
|
||||||
- mail
|
- mail
|
||||||
ports:
|
ports:
|
||||||
- "5000:5000"
|
- "5200:3000"
|
||||||
depends_on:
|
depends_on:
|
||||||
- mongo
|
- db
|
||||||
- redis
|
- redis
|
||||||
mail:
|
mail:
|
||||||
image: mailhog/mailhog
|
image: mailhog/mailhog
|
||||||
ports:
|
ports:
|
||||||
- "5050:8025"
|
- "5051:8025"
|
||||||
mongoexpress:
|
db:
|
||||||
image: mongo-express
|
image: postgres:10-alpine
|
||||||
|
volumes:
|
||||||
|
- ./pg_data:/var/lib/postgresql/data
|
||||||
environment:
|
environment:
|
||||||
ME_CONFIG_MONGODB_SERVER: mongo
|
POSTGRES_USER: root
|
||||||
ports:
|
POSTGRES_PASSWORD: root
|
||||||
- "5051:8081"
|
POSTGRES_DB: ohmyform
|
||||||
links:
|
|
||||||
- mongo
|
|
||||||
depends_on:
|
|
||||||
- mongo
|
|
||||||
|
15
nginx.conf
Normal file
15
nginx.conf
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
server {
|
||||||
|
listen 3000;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://localhost:4000;
|
||||||
|
proxy_redirect off;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /graphql {
|
||||||
|
proxy_pass http://localhost:4100;
|
||||||
|
proxy_redirect off;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
}
|
||||||
|
}
|
25
supervisord.conf
Normal file
25
supervisord.conf
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
[supervisord]
|
||||||
|
nodaemon=true
|
||||||
|
|
||||||
|
[program:ui]
|
||||||
|
directory=/usr/src/ui
|
||||||
|
command=yarn next start -p 4000
|
||||||
|
stdout_logfile=/dev/fd/1
|
||||||
|
stdout_logfile_maxbytes=0
|
||||||
|
stderr_logfile=/dev/fd/1
|
||||||
|
stderr_logfile_maxbytes=0
|
||||||
|
|
||||||
|
[program:api]
|
||||||
|
directory=/usr/src/api
|
||||||
|
command=yarn start:prod
|
||||||
|
stdout_logfile=/dev/fd/1
|
||||||
|
stdout_logfile_maxbytes=0
|
||||||
|
stderr_logfile=/dev/fd/1
|
||||||
|
stderr_logfile_maxbytes=0
|
||||||
|
|
||||||
|
[program:nginx]
|
||||||
|
command=nginx -g "daemon off;"
|
||||||
|
stdout_logfile=/dev/fd/1
|
||||||
|
stdout_logfile_maxbytes=0
|
||||||
|
stderr_logfile=/dev/fd/1
|
||||||
|
stderr_logfile_maxbytes=0
|
2
ui
2
ui
@ -1 +1 @@
|
|||||||
Subproject commit 3d3614b88abf020f9435cf81e6b19420e95108c3
|
Subproject commit c6cf6783b41333073169fc7c9bbc36df45a0047d
|
Loading…
Reference in New Issue
Block a user