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

9
.gitignore vendored
View File

@@ -2,12 +2,11 @@
node_modules
client/dist
# local env files
.env.local
.env.*.local
config.development.js
config.production.js
uploads
# local env files
.env.production
# Log files
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
cd gancio
# copy .env into .env.production and edit it
docker-compose up -d
```
@@ -31,5 +33,4 @@ cd client
yarn
# run front-end in development mode
yarn dev
```
```

View File

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

View File

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

View File

@@ -6,7 +6,6 @@ moment.locale('it')
const mail = {
send (addresses, template, locals) {
locals.locale = config.locale
const email = new Email({
views: { root: path.join(__dirname, 'emails') },
juice: true,
@@ -20,7 +19,10 @@ const mail = {
from: `${config.title} <${config.smtp.auth.user}>`
},
send: true,
i18n: {},
i18n: {
locales: ['en', 'es', 'it'],
defaultLocale: config.locale
},
transport: config.smtp
})
return email.send({
@@ -29,7 +31,12 @@ const mail = {
to: addresses,
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:
image: 'postgres:latest'
environment:
POSTGRES_PASSWORD: 12345
POSTGRES_USER: postgres
POSTGRES_PASSWORD: docker
POSTGRES_USER: docker
POSTGRES_DB: gancio
volumes:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
- ./postgres:/var/lib/postgresql/data
app:
env_file: .env
env_file: .env.production
build: .
ports:
- '12300:12300'
volumes:
- ./app/uploads:/usr/src/app/app/uploads
environment:
PORT: 12300
DB_HOST: db
DB_PASS: 12345
DB_USER: postgres
DB_NAME: gancio
links:
- 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.",
"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",
"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",
"confirm_email": "confirm_email"
"confirm_email": "confirm_email",
"recover_email": "recover_email",
"press here": "press here"
}