add production setup
This commit is contained in:
parent
4c28187741
commit
59651d3cb9
|
@ -17,6 +17,12 @@ RUN cd scripts && pip install -e .
|
|||
ADD views /opt/obs/api/views/
|
||||
ADD src /opt/obs/api/src/
|
||||
|
||||
#ADD .migrations.js .
|
||||
#ADD migrations .
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
ENV PORT=3000
|
||||
CMD ["npm", "start"]
|
||||
ENV DATA_DIR=/data
|
||||
|
||||
CMD ["npm", "run", "start"]
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"cookieSecret": "CHANGEME!!!!!!!!!!!!!!!!!!!!!11",
|
||||
"jwtSecret": "CHANGEME???????????????????////",
|
||||
"baseUrl": "https://openbikesensor.example.com/",
|
||||
"mainFrontendUrl": "https://openbikesensor.example.com/api/",
|
||||
"cookieSecret": "!!!<<<CHANGEME>>>!!!",
|
||||
"jwtSecret": "!!!<<<CHANGEME>>>!!!",
|
||||
"baseUrl": "https://api.example.com/",
|
||||
"mainFrontendUrl": "https://portal.example.com/",
|
||||
"mail": {
|
||||
"from": "Sender Name <sender@example.com>",
|
||||
"smtp" : {
|
||||
|
@ -10,24 +10,24 @@
|
|||
"port": 465,
|
||||
"starttls": false,
|
||||
"username": "sender@example.com",
|
||||
"password": "hunter2"
|
||||
"password": "!!!<<<CHANGEME>>>!!!"
|
||||
}
|
||||
},
|
||||
"mongodb": {
|
||||
"url": "mongodb://user:pass@host/obs",
|
||||
"url": "mongodb://mongo/obs",
|
||||
"debug": false
|
||||
},
|
||||
"redisUrl": "redis://localhost",
|
||||
"redisUrl": "redis://redis",
|
||||
"oAuth2Clients": [
|
||||
{
|
||||
"clientId": "CHANGEME",
|
||||
"validRedirectUris": ["https://site.example.com/redirect"],
|
||||
"clientId": "!!!<<<CHANGEME>>>!!!",
|
||||
"validRedirectUris": ["https://portal.example.com/redirect"],
|
||||
"refreshTokenExpirySeconds": 604800,
|
||||
"maxScope": "*",
|
||||
"title": "OBS Portal"
|
||||
},
|
||||
{
|
||||
"clientId": "CHANGEME",
|
||||
"clientId": "!!!<<<CHANGEME>>>!!!",
|
||||
"validRedirectUris": ["__LOCAL__"],
|
||||
"maxScope": "track.upload",
|
||||
"refreshTokenExpirySeconds": 86400000,
|
||||
|
|
34
frontend/Dockerfile-prod
Normal file
34
frontend/Dockerfile-prod
Normal file
|
@ -0,0 +1,34 @@
|
|||
#############################################
|
||||
# Build the frontend AS builder
|
||||
#############################################
|
||||
|
||||
FROM node:14 as builder
|
||||
|
||||
WORKDIR /opt/obs/frontend
|
||||
ADD package.json package-lock.json /opt/obs/frontend/
|
||||
RUN echo update-notifier=false >> ~/.npmrc
|
||||
RUN npm ci
|
||||
|
||||
ADD tsconfig.json craco.config.js /opt/obs/frontend/
|
||||
ADD public/ /opt/obs/frontend/public/
|
||||
ADD src/ /opt/obs/frontend/src/
|
||||
|
||||
# [Optional] Add the URL prefix. It must also be set in the docker-compose.yml
|
||||
# ENV PUBLIC_URL=/prefix
|
||||
|
||||
RUN npm run build
|
||||
|
||||
#############################################
|
||||
# Serve the frontend
|
||||
#############################################
|
||||
|
||||
# Use apache
|
||||
FROM httpd:2.4
|
||||
# Enable rewrite_module
|
||||
RUN sed -i '/LoadModule rewrite_module/s/^#//g' /usr/local/apache2/conf/httpd.conf
|
||||
# Allow .htaccess within /usr/local/apache2/htdocs
|
||||
RUN sed -i '/<Directory "\/usr\/local\/apache2\/htdocs">/,/<\/Directory>/ s/AllowOverride None/AllowOverride all/' /usr/local/apache2/conf/httpd.conf
|
||||
|
||||
COPY --from=builder /opt/obs/frontend/build /usr/local/apache2/htdocs
|
||||
COPY apache/.htaccess /usr/local/apache2/htdocs/
|
||||
RUN chmod -R a+rX /usr/local/apache2/htdocs
|
6
frontend/apache/.htaccess
Normal file
6
frontend/apache/.htaccess
Normal file
|
@ -0,0 +1,6 @@
|
|||
# @see: https://create-react-app.dev/docs/deployment/#serving-apps-with-client-side-routing
|
||||
|
||||
Options -MultiViews
|
||||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^ index.html [QSA,L]
|
11
frontend/public/config.json
Executable file → Normal file
11
frontend/public/config.json
Executable file → Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"apiUrl": "https://api.example.com",
|
||||
"auth": {
|
||||
"server": "https://api.example.com",
|
||||
"clientId": "!!!<<<CHANGEME>>>!!!",
|
||||
"scope": "*",
|
||||
"redirectUri": "https://portal.example.com/redirect"
|
||||
},
|
||||
"imprintUrl": "https://portal.example.com/imprint",
|
||||
"privacyPolicyUrl": "https://portal.example.com/privacy"
|
||||
}
|
Loading…
Reference in a new issue