-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from karmek-k/dev
Deployment preparation with docker-compose
- Loading branch information
Showing
14 changed files
with
153 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ APP_SECRET=80021d294317eab0437313a51a05d31b | |
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url | ||
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml | ||
# | ||
DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db" | ||
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db" | ||
# DATABASE_URL="mysql://db_user:[email protected]:3306/db_name?serverVersion=5.7" | ||
# DATABASE_URL="postgresql://db_user:[email protected]:5432/db_name?serverVersion=13&charset=utf8" | ||
DATABASE_URL="postgresql://db_user:[email protected]:5432/db_name?serverVersion=13&charset=utf8" | ||
###< doctrine/doctrine-bundle ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,3 +25,5 @@ | |
npm-debug.log | ||
yarn-error.log | ||
###< symfony/webpack-encore-bundle ### | ||
|
||
db.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
docker-compose exec app bash -c "php bin/console tr:user:create $1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
POSTGRES_USER=tinyreader | ||
POSTGRES_PASSWORD="12345" | ||
POSTGRES_DB=tinyreader | ||
DATABASE_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@database:5432/${POSTGRES_DB}?serverVersion=13&charset=utf8" | ||
APP_SECRET="keyboard cat" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
version: '3.8' | ||
|
||
services: | ||
database: | ||
image: postgres:13 | ||
volumes: | ||
- db_data:/var/lib/postgres/data | ||
env_file: | ||
- db.env | ||
ports: | ||
- '5432' | ||
restart: always | ||
|
||
app: | ||
build: . | ||
depends_on: | ||
- database | ||
env_file: | ||
- db.env | ||
ports: | ||
- 9000:9000 | ||
volumes: | ||
- tr_build:/app | ||
|
||
server: | ||
image: nginx:1.21 | ||
depends_on: | ||
- app | ||
volumes: | ||
- tr_build:/var/www/tinyreader | ||
- ./server:/etc/nginx/conf.d | ||
ports: | ||
- 8000:80 | ||
expose: | ||
- '8000' | ||
|
||
volumes: | ||
db_data: | ||
tr_build: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
docker-compose exec app bash -c "php bin/console doctrine:migrations:migrate -n" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace DoctrineMigrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
/** | ||
* Auto-generated Migration: Please modify to your needs! | ||
*/ | ||
final class Version20210621102752 extends AbstractMigration | ||
{ | ||
public function getDescription(): string | ||
{ | ||
return 'Move from SQLite to PostgreSQL'; | ||
} | ||
|
||
public function up(Schema $schema): void | ||
{ | ||
// this up() migration is auto-generated, please modify it to your needs | ||
$this->addSql('CREATE SEQUENCE article_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); | ||
$this->addSql('CREATE SEQUENCE feed_source_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); | ||
$this->addSql('CREATE SEQUENCE "user_id_seq" INCREMENT BY 1 MINVALUE 1 START 1'); | ||
$this->addSql('CREATE TABLE article (id INT NOT NULL, source_id INT NOT NULL, title VARCHAR(255) NOT NULL, url TEXT NOT NULL, excerpt TEXT NOT NULL, last_modified TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))'); | ||
$this->addSql('CREATE INDEX IDX_23A0E66953C1C61 ON article (source_id)'); | ||
$this->addSql('CREATE TABLE feed_source (id INT NOT NULL, name VARCHAR(255) NOT NULL, url TEXT NOT NULL, PRIMARY KEY(id))'); | ||
$this->addSql('CREATE TABLE "user" (id INT NOT NULL, username VARCHAR(180) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); | ||
$this->addSql('CREATE UNIQUE INDEX UNIQ_8D93D649F85E0677 ON "user" (username)'); | ||
$this->addSql('CREATE TABLE user_feed_source (user_id INT NOT NULL, feed_source_id INT NOT NULL, PRIMARY KEY(user_id, feed_source_id))'); | ||
$this->addSql('CREATE INDEX IDX_34B3C612A76ED395 ON user_feed_source (user_id)'); | ||
$this->addSql('CREATE INDEX IDX_34B3C612DDAEFFBD ON user_feed_source (feed_source_id)'); | ||
$this->addSql('ALTER TABLE article ADD CONSTRAINT FK_23A0E66953C1C61 FOREIGN KEY (source_id) REFERENCES feed_source (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); | ||
$this->addSql('ALTER TABLE user_feed_source ADD CONSTRAINT FK_34B3C612A76ED395 FOREIGN KEY (user_id) REFERENCES "user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); | ||
$this->addSql('ALTER TABLE user_feed_source ADD CONSTRAINT FK_34B3C612DDAEFFBD FOREIGN KEY (feed_source_id) REFERENCES feed_source (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
// this down() migration is auto-generated, please modify it to your needs | ||
$this->addSql('CREATE SCHEMA public'); | ||
$this->addSql('ALTER TABLE article DROP CONSTRAINT FK_23A0E66953C1C61'); | ||
$this->addSql('ALTER TABLE user_feed_source DROP CONSTRAINT FK_34B3C612DDAEFFBD'); | ||
$this->addSql('ALTER TABLE user_feed_source DROP CONSTRAINT FK_34B3C612A76ED395'); | ||
$this->addSql('DROP SEQUENCE article_id_seq CASCADE'); | ||
$this->addSql('DROP SEQUENCE feed_source_id_seq CASCADE'); | ||
$this->addSql('DROP SEQUENCE "user_id_seq" CASCADE'); | ||
$this->addSql('DROP TABLE article'); | ||
$this->addSql('DROP TABLE feed_source'); | ||
$this->addSql('DROP TABLE "user"'); | ||
$this->addSql('DROP TABLE user_feed_source'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters