parent
8a15a8c57e
commit
b6aa28f220
@ -0,0 +1,4 @@
|
|||||||
|
node_modules
|
||||||
|
packages/*/node_modules
|
||||||
|
packages/*/build
|
||||||
|
packages/server/.env
|
@ -0,0 +1,19 @@
|
|||||||
|
FROM node:15.3.0
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY package*.json lerna.json ./
|
||||||
|
COPY packages/server/package*.json ./packages/server/
|
||||||
|
COPY packages/client/package*.json ./packages/client/
|
||||||
|
|
||||||
|
RUN npm install
|
||||||
|
RUN npm run bootstrap:production
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
COPY .env packages/server/.env
|
||||||
|
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
CMD [ "node", "packages/server/build/index.js" ]
|
@ -0,0 +1,40 @@
|
|||||||
|
version: "3.8"
|
||||||
|
services:
|
||||||
|
museo:
|
||||||
|
restart: always
|
||||||
|
container_name: museo-red
|
||||||
|
build: .
|
||||||
|
ports:
|
||||||
|
- 9999:9999
|
||||||
|
environment:
|
||||||
|
PORT: 9999
|
||||||
|
|
||||||
|
mongo:
|
||||||
|
container_name: mongo
|
||||||
|
image: mongo:4.2.10
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
MONGO_INITDB_ROOT_USERNAME: ${MONGODB_USER}
|
||||||
|
MONGO_INITDB_ROOT_PASSWORD: ${MONGODB_PASSWORD}
|
||||||
|
volumes:
|
||||||
|
- ${DATA_HOME}:/data/db
|
||||||
|
|
||||||
|
mongo-express:
|
||||||
|
container_name: mongo-express
|
||||||
|
image: mongo-express
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- 8900:8081
|
||||||
|
environment:
|
||||||
|
ME_CONFIG_MONGODB_SERVER: "mongo"
|
||||||
|
ME_CONFIG_MONGODB_ADMINUSERNAME: ${MONGODB_USER}
|
||||||
|
ME_CONFIG_MONGODB_ADMINPASSWORD: ${MONGODB_PASSWORD}
|
||||||
|
|
||||||
|
redis:
|
||||||
|
container_name: redis
|
||||||
|
image: redis:6.0.8
|
||||||
|
restart: always
|
||||||
|
command: >
|
||||||
|
--requirepass ${REDIS_PASSWORD}
|
||||||
|
volumes:
|
||||||
|
- ${DATA_HOME}:/data
|
@ -0,0 +1,22 @@
|
|||||||
|
MONGODB_HOST=
|
||||||
|
MONGODB_PASSWORD=
|
||||||
|
MONGODB_USER=museum
|
||||||
|
|
||||||
|
REDIS_HOST=
|
||||||
|
REDIS_PASSWORD=
|
||||||
|
|
||||||
|
SESSION_SECRET=
|
||||||
|
|
||||||
|
HOST=
|
||||||
|
HOST_DEV=
|
||||||
|
|
||||||
|
FACEBOOK_CLIENT_ID=
|
||||||
|
FACEBOOK_CLIENT_SECRET=
|
||||||
|
|
||||||
|
TWITTER_CONSUMER_KEY=
|
||||||
|
TWITTER_CONSUMER_SECRET=
|
||||||
|
|
||||||
|
GOOGLE_CLIENT_ID=
|
||||||
|
GOOGLE_CLIENT_SECRET=
|
||||||
|
|
||||||
|
DATA_HOME=
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,48 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
check_available() {
|
||||||
|
# Function to check if a program is installed
|
||||||
|
which $1 &> /dev/null
|
||||||
|
|
||||||
|
if [ $? = 1 ]; then
|
||||||
|
echo "$1 is not available, please install it before running the script"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
gen_password() {
|
||||||
|
check_available openssl
|
||||||
|
openssl rand -base64 32
|
||||||
|
}
|
||||||
|
|
||||||
|
read -p "Redis password: (press enter to randomize): " redis_password
|
||||||
|
redis_password=${redis_password:-`gen_password`}
|
||||||
|
|
||||||
|
read -p "Session secret: (press enter to randomize): " session_secret
|
||||||
|
session_secret=${session_secret:-`gen_password`}
|
||||||
|
|
||||||
|
read -p "MongoDB password: (press enter to randomize): " mongo_password
|
||||||
|
mongo_password=${mongo_password:-`gen_password`}
|
||||||
|
|
||||||
|
|
||||||
|
if [ ! -f "./.env" ]; then
|
||||||
|
echo "Copying ./env.example to ./.env"
|
||||||
|
cp ./env.example ./.env
|
||||||
|
fi
|
||||||
|
|
||||||
|
sed -i -e "s#REDIS_PASSWORD=.*#REDIS_PASSWORD=${redis_password}#g" \
|
||||||
|
"$(dirname "$0")/.env"
|
||||||
|
|
||||||
|
sed -i -e "s#SESSION_SECRET=.*#SESSION_SECRET=${session_secret}#g" \
|
||||||
|
"$(dirname "$0")/.env"
|
||||||
|
|
||||||
|
sed -i -e "s#MONGODB_PASSWORD=.*#MONGODB_PASSWORD=${mongo_password}#g" \
|
||||||
|
"$(dirname "$0")/.env"
|
||||||
|
|
||||||
|
read -p "Start docker containers? (requires docker-compose) [Y/n] " start_docker
|
||||||
|
start_docker=${start_docker:-Y}
|
||||||
|
|
||||||
|
if [[ $start_docker =~ [yY] ]]; then
|
||||||
|
check_available docker-compose
|
||||||
|
sudo docker-compose up -d
|
||||||
|
fi
|
Loading…
Reference in new issue