fix dockerization

This commit is contained in:
lesion
2019-03-22 00:16:12 +01:00
parent 58f0d8c9fe
commit 3a8576a280
11 changed files with 645 additions and 534 deletions

18
.env
View File

@@ -1,13 +1,21 @@
NODE_ENV=production NODE_ENV=production
# complete url (use https here!)
BASE_URL=http://localhost:12300 BASE_URL=http://localhost:12300
# node server will listen here
PORT=12300
# your instance's name and description
TITLE=Gancio TITLE=Gancio
DESCRIPTION=diocane
ADMIN_EMAIL=admin@example.com DESCRIPTION="description"
SMTP_HOST=mail.example.com # where emails comes from
SMTP_USER=admin@example.com ADMIN_EMAIL=admin@example.org
SMTP_PASS=secret SMTP_HOST=mail.example.org
SMTP_USER=admin@example.org
SMTP_PASS=password
# please put a random string here
SECRET=secret SECRET=secret

9
.gitignore vendored
View File

@@ -2,12 +2,11 @@
node_modules node_modules
client/dist client/dist
# local env files
.env.local
.env.*.local
config.development.js uploads
config.production.js
# local env files
.env.production
# Log files # Log files
npm-debug.log* npm-debug.log*

View File

@@ -9,6 +9,8 @@ We provide a docker way to run **gancio**.
``` ```
git clone https://git.lattuga.net/lesion/gancio.git git clone https://git.lattuga.net/lesion/gancio.git
cd gancio cd gancio
# copy .env into .env.production and edit it
docker-compose up -d docker-compose up -d
``` ```
@@ -31,5 +33,4 @@ cd client
yarn yarn
# run front-end in development mode # run front-end in development mode
yarn dev yarn dev
``` ```

View File

@@ -4,18 +4,11 @@
"dialect": "sqlite", "dialect": "sqlite",
"logging": false "logging": false
}, },
"test": {
"username": "root",
"password": null,
"database": "database_test",
"host": "127.0.0.1",
"dialect": "mysql"
},
"production": { "production": {
"username": "root", "username": "docker",
"password": null, "password": "docker",
"database": "database_production", "database": "gancio",
"host": "127.0.0.1", "host": "db",
"dialect": "mysql" "dialect": "postgres"
} }
} }

View File

@@ -1,6 +1,6 @@
p= t('registration_email') p= t('registration_email')
--- hr
small #{config.title} small #{config.title} / #{config.description}
br br
small #{config.baseurl} small #{config.baseurl}

View File

@@ -6,7 +6,6 @@ moment.locale('it')
const mail = { const mail = {
send (addresses, template, locals) { send (addresses, template, locals) {
locals.locale = config.locale
const email = new Email({ const email = new Email({
views: { root: path.join(__dirname, 'emails') }, views: { root: path.join(__dirname, 'emails') },
juice: true, juice: true,
@@ -20,7 +19,10 @@ const mail = {
from: `${config.title} <${config.smtp.auth.user}>` from: `${config.title} <${config.smtp.auth.user}>`
}, },
send: true, send: true,
i18n: {}, i18n: {
locales: ['en', 'es', 'it'],
defaultLocale: config.locale
},
transport: config.smtp transport: config.smtp
}) })
return email.send({ return email.send({
@@ -29,7 +31,12 @@ const mail = {
to: addresses, to: addresses,
bcc: config.admin bcc: config.admin
}, },
locals: { ...locals, config, datetime: datetime => moment(datetime).format('ddd, D MMMM HH:mm') } locals: {
...locals,
locale: config.locale,
config,
datetime: datetime => moment(datetime).format('ddd, D MMMM HH:mm')
}
}) })
} }
} }

View File

@@ -5,28 +5,21 @@ services:
db: db:
image: 'postgres:latest' image: 'postgres:latest'
environment: environment:
POSTGRES_PASSWORD: 12345 POSTGRES_PASSWORD: docker
POSTGRES_USER: postgres POSTGRES_USER: docker
POSTGRES_DB: gancio POSTGRES_DB: gancio
volumes: volumes:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql - ./init.sql:/docker-entrypoint-initdb.d/init.sql
- ./postgres:/var/lib/postgresql/data - ./postgres:/var/lib/postgresql/data
app: app:
env_file: .env env_file: .env.production
build: . build: .
ports: ports:
- '12300:12300' - '12300:12300'
volumes: volumes:
- ./app/uploads:/usr/src/app/app/uploads - ./app/uploads:/usr/src/app/app/uploads
environment:
PORT: 12300
DB_HOST: db
DB_PASS: 12345
DB_USER: postgres
DB_NAME: gancio
links: links:
- db - db

1088
init.sql

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,6 @@
{ {
"registration_email": "Ciao, la tua registrazione sarà confermata nei prossimi giorni. Riceverai una conferma non temere.", "registration_email": "Ciao, la tua registrazione sarà confermata nei prossimi giorni. Riceverai una conferma non temere.",
"confirm_email": "confirm_email" "confirm_email": "confirm_email",
"recover_email": "recover_email",
"press here": "press here"
} }

View File

@@ -1,4 +1,6 @@
{ {
"registration_email": "registration_email", "registration_email": "registration_email",
"confirm_email": "confirm_email" "confirm_email": "confirm_email",
"recover_email": "recover_email",
"press here": "press here"
} }

View File

@@ -1,4 +1,6 @@
{ {
"registration_email": "registration_email", "registration_email": "registration_email",
"confirm_email": "confirm_email" "confirm_email": "confirm_email",
"recover_email": "recover_email",
"press here": "press here"
} }