mirror of
https://framagit.org/les/gancio.git
synced 2025-01-31 16:42:22 +01:00
first test with docker
This commit is contained in:
parent
91579e56dd
commit
e10e081563
14 changed files with 106 additions and 95 deletions
1
.dockerignore
Normal file
1
.dockerignore
Normal file
|
@ -0,0 +1 @@
|
|||
**/node_modules
|
29
Dockerfile
Normal file
29
Dockerfile
Normal file
|
@ -0,0 +1,29 @@
|
|||
|
||||
FROM node:10
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
COPY package.json .
|
||||
|
||||
# install backend dependencies
|
||||
RUN yarn install
|
||||
|
||||
# copy source
|
||||
COPY . .
|
||||
|
||||
# install nodemon
|
||||
RUN yarn global add nodemon
|
||||
|
||||
WORKDIR /usr/src/app/client
|
||||
|
||||
# install frontend dependencies
|
||||
RUN yarn
|
||||
|
||||
# build frontend
|
||||
RUN yarn build
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
EXPOSE 12300
|
||||
|
||||
CMD [ "yarn", "run", "serve" ]
|
|
@ -1,3 +1,38 @@
|
|||
const env = process.env.NODE_ENV
|
||||
const conf = require('../config/config.' + env + '.json')
|
||||
module.exports = conf
|
||||
let db = {}
|
||||
if (process.env.NODE_ENV==='production') {
|
||||
db = {
|
||||
host: process.env.DB_HOST,
|
||||
username: process.env.DB_USER,
|
||||
password: process.env.DB_PASS,
|
||||
database: process.env.DB_NAME,
|
||||
dialect: 'postgres'
|
||||
}
|
||||
} else {
|
||||
db = {
|
||||
dialect: 'sqlite',
|
||||
storage: './db.sqlite'
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
locale: 'en',
|
||||
|
||||
title: process.env.TITLE || 'Put here your site name',
|
||||
description: process.env.DESCRIPTION || 'A calendar for radical communities',
|
||||
|
||||
baseurl: process.env.BASE_URL || 'http://localhost:8080',
|
||||
apiurl: process.env.API_URL || 'http://localhost:9000',
|
||||
db,
|
||||
admin: process.env.ADMIN_EMAIL,
|
||||
|
||||
smtp: {
|
||||
host: process.env.SMTP_HOST,
|
||||
secure: true,
|
||||
auth: {
|
||||
user: process.env.SMTP_USER,
|
||||
pass: process.env.SMTP_PASS
|
||||
}
|
||||
},
|
||||
|
||||
secret: process.env.SMTP_SECRET
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
const Sequelize = require('sequelize')
|
||||
const env = process.env.NODE_ENV || 'development'
|
||||
const conf = require('../config/config.' + env + '.json')
|
||||
const conf = require('./config.js')
|
||||
console.error(conf.db)
|
||||
const db = new Sequelize(conf.db)
|
||||
|
||||
// db.sync({ force: true })
|
||||
db.sync({ force: true })
|
||||
// db.sync()
|
||||
|
||||
module.exports = db
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
const env = process.env.NODE_ENV
|
||||
const beConf = require('../config/config.' + env + '.json')
|
||||
|
||||
const conf = {
|
||||
// environment
|
||||
title: beConf.title,
|
||||
description: beConf.description,
|
||||
|
||||
// base url
|
||||
baseurl: beConf.baseurl,
|
||||
apiurl: beConf.apiurl
|
||||
}
|
||||
|
||||
export default conf
|
7
client/dist/css/chunk-vendors.e4346a46.css
vendored
7
client/dist/css/chunk-vendors.e4346a46.css
vendored
File diff suppressed because one or more lines are too long
|
@ -1,8 +1,7 @@
|
|||
import axios from 'axios'
|
||||
import config from '../config'
|
||||
import store from './store'
|
||||
const api = axios.create({
|
||||
baseURL: config.apiurl,
|
||||
baseURL: '/api',
|
||||
withCredentials: false,
|
||||
responseType: 'json',
|
||||
headers: {
|
||||
|
|
|
@ -13,14 +13,13 @@
|
|||
import { mapState, mapActions } from 'vuex';
|
||||
import api from '@/api'
|
||||
import filters from '@/filters'
|
||||
import config from '../../config'
|
||||
|
||||
export default {
|
||||
props: ['event'],
|
||||
computed: {
|
||||
...mapState(['user']),
|
||||
imgPath () {
|
||||
return this.event.image_path && config.apiurl + '/../' + this.event.image_path
|
||||
return this.event.image_path && this.event.image_path
|
||||
},
|
||||
mine () {
|
||||
return this.event.userId === this.user.id
|
||||
|
|
|
@ -30,13 +30,12 @@
|
|||
import { mapState, mapActions } from 'vuex';
|
||||
import api from '@/api'
|
||||
import filters from '@/filters'
|
||||
import config from '../../config'
|
||||
|
||||
export default {
|
||||
computed: {
|
||||
...mapState(['user']),
|
||||
imgPath () {
|
||||
return this.event.image_path && config.apiurl + '/../' + this.event.image_path
|
||||
return this.event.image_path && this.event.image_path
|
||||
},
|
||||
mine () {
|
||||
return this.event.userId === this.user.id || this.user.is_admin
|
||||
|
|
|
@ -52,7 +52,6 @@
|
|||
</template>
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
import config from '../../config'
|
||||
import path from 'path'
|
||||
import filters from '../filters'
|
||||
import Calendar from '@/components/Calendar'
|
||||
|
@ -97,10 +96,10 @@ export default {
|
|||
}
|
||||
}
|
||||
|
||||
return `${config.apiurl}/export/${this.type}${query}`
|
||||
return `${process.env.BASE_URL}/api/export/${this.type}${query}`
|
||||
},
|
||||
imgPath (event) {
|
||||
return event.image_path && config.apiurl + '/../' + event.image_path
|
||||
return event.image_path && event.image_path
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
{
|
||||
"env": "development",
|
||||
"locale": "it",
|
||||
|
||||
"title": "Gancio",
|
||||
"description": "Un calendario dei movimenti piemontesi",
|
||||
|
||||
"baseurl": "http://localhost:8080",
|
||||
"apiurl": "http://localhost:9000/api",
|
||||
|
||||
"db": {
|
||||
"storage": "./db.sqlite",
|
||||
"dialect": "sqlite"
|
||||
},
|
||||
"admin": "lesion@autistici.org",
|
||||
|
||||
"smtp": {
|
||||
"host": "mail.example.org",
|
||||
"secure": true,
|
||||
"auth": {
|
||||
"user": "events@example.org",
|
||||
"pass": ""
|
||||
}
|
||||
},
|
||||
|
||||
"secret": "nonosecretsuper"
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
{
|
||||
"env": "production",
|
||||
"locale": "en",
|
||||
|
||||
"title": "Put here your site name",
|
||||
"description": "A calendar for radical communities",
|
||||
|
||||
"baseurl": "https://example.com",
|
||||
"apiurl": "https://example.com/api",
|
||||
|
||||
"db": {
|
||||
"dialect": "postgres",
|
||||
"host": "localhost",
|
||||
"database": "gancio",
|
||||
"user": "user",
|
||||
"password": "password"
|
||||
},
|
||||
"admin": "admin@example.com",
|
||||
|
||||
"smtp": {
|
||||
"host": "mail.example.com",
|
||||
"secure":"true",
|
||||
"auth": {
|
||||
"user": "admin@example.com",
|
||||
"pass": ""
|
||||
}
|
||||
},
|
||||
|
||||
"secret": "randomstringhere"
|
||||
}
|
27
docker-compose.yml
Normal file
27
docker-compose.yml
Normal file
|
@ -0,0 +1,27 @@
|
|||
|
||||
version: '3.5'
|
||||
|
||||
services:
|
||||
db:
|
||||
image: 'postgres:latest'
|
||||
environment:
|
||||
POSTGRES_PASSWORD: 12345
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_DB: gancio
|
||||
|
||||
app:
|
||||
build: .
|
||||
ports:
|
||||
- '12300:12300'
|
||||
|
||||
env_file: .env
|
||||
environment:
|
||||
PORT: 12300
|
||||
DB_HOST: db
|
||||
DB_PASS: 12345
|
||||
DB_USER: postgres
|
||||
DB_NAME: gancio
|
||||
|
||||
links:
|
||||
- db
|
||||
|
|
@ -2,8 +2,8 @@
|
|||
"name": "gancio",
|
||||
"main": "server.js",
|
||||
"scripts": {
|
||||
"serve": "NODE_ENV=production PORT=9000 nodemon server.js",
|
||||
"dev": "NODE_ENV=development PORT=9000 nodemon server.js"
|
||||
"serve": "NODE_ENV=production nodemon server.js",
|
||||
"dev": "NODE_ENV=development nodemon server.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"bcrypt": "^3.0.2",
|
||||
|
@ -18,6 +18,7 @@
|
|||
"morgan": "^1.7.0",
|
||||
"multer": "^1.4.1",
|
||||
"mysql2": "^1.6.4",
|
||||
"pg": "^7.8.1",
|
||||
"pug": "^2.0.3",
|
||||
"sequelize": "^4.41.0",
|
||||
"sqlite3": "^4.0.3"
|
||||
|
|
Loading…
Reference in a new issue