-
-
Notifications
You must be signed in to change notification settings - Fork 775
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to update via Docker? #139
Comments
BUT IF YOU WANT TO UPDATE AN EXISTING SETUPBack up your database! This update features some database structure changes, you'll either need to manually update the database or just start from scratch. How I updated my database (Linux)
And everything should be working. If you're getting stuck on loading anywhere, you can check database output messages with: docker logs planka_postgres_1 |
Thank you very much. Will try and if anything goes wrong I will post it here. |
Great ! Should you destroy the containers first and recreate them with the 1.0.0-beta version image and then follow the steps for manual migration or should the manual migration steps be done before switching to new image ? edit: to answer my own question: it seems you have to stop your running containers, change planka image tag, recreate containers and follow the steps. Unfortunately it doesn't seem to work. I completed the procedure three times from a back-up and I get the same results: black screen in the browser and no logs from either containers and a lot of javascript error in the browser console. |
Edit I revisited my old explanation and my server and I found the original answer out of place. I also found a mistake (that is now fixed). To check the database output, run this command:
If you still don't find any info, could you send some of the JavaScript error messages? |
@Syndamia : Here's the complete output:
I just noticed this line:
And here's the console output: TypeError: n is null
value User.js:290
value User.js:289
zn user.js:39
Redux 4
nE ProjectsContainer.js:10
Redux 5
React 2
j Redux
React 10
unstable_runWithPriority scheduler.production.min.js:18
React 4
Redux 4
a middleware.js:26
Redux 12
react-dom.production.min.js:216:199
TypeError: n is null
value User.js:290
value User.js:289
zn user.js:39
Redux 4
nE ProjectsContainer.js:10
Redux 5
React 2
j Redux
React 10
unstable_runWithPriority scheduler.production.min.js:18
React 4
Redux 4
a middleware.js:26
Redux 12
io-6de156f3.js:111:10
The above error occurred in task ji
created by Gj
created by Qj
Tasks cancelled due to error:
Gj
Xb
uj
lj
pj
mj
Oj
Ej
xj
Cj
Rj
kj
yj
Nj
Uj
wj
Mj
Bj
Fj
Vj io-6de156f3.js:112:10 I fixed(?) the postgresql error by replacing edit: and to be perfectly clear, I have backups of every volumes and I restore them and recreate 0.16 containers before each tr and I get a functioning planka populated with my data. |
I didn't have any problems with the database update and also had no errors there, but get the same js errors. |
As a rule of thumb What happens is that since you most likely have a local image of Planka tagged with |
Ok, I created a new database and let planka create the schemes. Then I copied each table from the old database one by one to the new database. When I copy board_membership it results in the js error and the site not loading. Leaving this table out and adding myself to every board on the website seems to work just fine. So it is working for me again. |
OK, I was also able to upgrade to If you know your user id here's the SQL query to run. Then login and reclaim ownership of each board: ALTER TABLE attachment RENAME COLUMN user_id TO creator_user_id;
CREATE TABLE "public"."board_membership" (
"id" bigint DEFAULT next_id() NOT NULL,
"board_id" bigint NOT NULL,
"user_id" bigint NOT NULL,
"created_at" timestamp,
"updated_at" timestamp,
CONSTRAINT "board_membership_board_id_user_id_unique" UNIQUE ("board_id", "user_id"),
CONSTRAINT "board_membership_pkey" PRIMARY KEY ("id")
) WITH (oids = false);
CREATE INDEX "board_membership_user_id_index" ON "public"."board_membership" USING btree ("user_id");
ALTER TABLE card ADD COLUMN "creator_user_id" bigint;
UPDATE card SET creator_user_id=410050284119655425;
ALTER TABLE card ALTER COLUMN creator_user_id SET NOT NULL;
ALTER TABLE project_membership RENAME TO project_manager;
DROP INDEX "project_membership_user_id_index";
CREATE INDEX "project_manager_user_id_index" ON "public"."project_manager" USING btree ("user_id");
ALTER TABLE project_manager RENAME CONSTRAINT project_membership_pkey TO project_manager_pkey;
ALTER TABLE project_manager RENAME CONSTRAINT project_membership_project_id_user_id_unique TO project_manager_project_id_user_id_unique; Those steps are for when only one user created projects and cards. It's possible to adapt but you most likely may have to manually update ownership of cards, boards and projects. Either through Planka's web UI (easy but can take some time) or through SQL (harder but can be processed in batches). On a running docker setup:
$ docker-compose stop planka ; docker-compose rm planka;
Add the following to the adminer:
image: adminer:4.8.1-standalone
ports:
- 3001:8080 and run
SELECT id, username, name, email FROM user_account;
-- SELECT id, username, name, email FROM user_account WHERE username=johnchristopher;
ALTER TABLE attachment RENAME COLUMN user_id TO creator_user_id;
CREATE TABLE "public"."board_membership" (
"id" bigint DEFAULT next_id() NOT NULL,
"board_id" bigint NOT NULL,
"user_id" bigint NOT NULL,
"created_at" timestamp,
"updated_at" timestamp,
CONSTRAINT "board_membership_board_id_user_id_unique" UNIQUE ("board_id", "user_id"),
CONSTRAINT "board_membership_pkey" PRIMARY KEY ("id")
) WITH (oids = false);
CREATE INDEX "board_membership_user_id_index" ON "public"."board_membership" USING btree ("user_id");
ALTER TABLE card ADD COLUMN "creator_user_id" bigint;
UPDATE card SET creator_user_id=410050284119655425;
ALTER TABLE card ALTER COLUMN creator_user_id SET NOT NULL;
ALTER TABLE project_membership RENAME TO project_manager;
DROP INDEX "project_membership_user_id_index";
CREATE INDEX "project_manager_user_id_index" ON "public"."project_manager" USING btree ("user_id");
ALTER TABLE project_manager RENAME CONSTRAINT project_membership_pkey TO project_manager_pkey;
ALTER TABLE project_manager RENAME CONSTRAINT project_membership_project_id_user_id_unique TO project_manager_project_id_user_id_unique;
planka:
image: meltyshev/planka:1.0.0-beta
$ docker-compose up -d planka
Qestion to the pgql guru and @meltyshev. Is it safe to do that: DROP INDEX "project_membership_user_id_index";
CREATE INDEX "project_manager_user_id_index" ON "public"."project_manager" USING btree ("user_id"); |
Is there a bash one-liner or something like that for backing up the whole Planka 0.1.6 DB? And maybe an easy restore one-liner? 😀 PG is not so easy to backup and restore, I had bad experience regarding it with complex DBs before, so I would like a bullet-proof method instead of a trial&error process with lots of downtime if things go sour with the DB upgrade. |
This fixed my issue. Saved me 1000s of hours. THANK YOU....... ALSO, I had to manually update the migration table to match the new migration table. I created a fresh DB and pointed PLANKA to it, once it got populated, copied the migrations table from the new database to the old database. What I noticed is even though both of the tables have the same number of records they are different to one. another. After updating the migration table to match with the new migration table I pointed the PLANKA back to the old DB. Thats it. If you find you don't have access to projects or boards, You will have to manually add records to the tables. XXX is your user id.
You might have to do the same for the project membership table. Also, make sure to run a scheduled backup of the DB. Add the following to the cron tab. |
Any ideas why I get this same error now every time the container is recreated? I no longer have to perform migrations of course just
Also tbh I dont really understand why that file is still not in the docker image and this error persists? |
After following the instructions in @johnchristopher 's post, I still had to deal with migrations being broken. After I updated my 0.1.6 DB to 1.0.0-beta following these instructions: #139 (comment) I ran this to update the migration table on 1.0.0-beta. Afterwards I was able to update to 1.1.0, then 1.1.3, 1.2.1, 1.3.1, 1.4.0. I stepped through it to verify the migrations run automatically. UPDATE migration SET name='20180721234154_create_project_manager_table.js' WHERE name='20180721234154_create_project_membership_table.js';
INSERT INTO migration (name, batch, migration_time) VALUES ('20180722001747_create_board_membership_table.js', 2, CURRENT_TIMESTAMP); I believe the reason people have to do |
I keep pulling the 'latest' image from Docker, but I cannot see the latest changes in the project and Docker keeps saying that I have the 'latest' image, even though the image it is pulling has the tag that it was created 2 months ago, instead of 5 days ago, like the latest image here: Docker Hub.
The text was updated successfully, but these errors were encountered: