Coder Social home page Coder Social logo

Comments (13)

nilslice avatar nilslice commented on April 28, 2024

How are you doing the deployment? Could you outline the exact steps you're taking from your development environment to deploy?

from ponzu.

Nemesisesq avatar Nemesisesq commented on April 28, 2024

I have my elastic beanstalk set to deploy a zip with the app, a Dockerfile and a Dockerrun.aws.json file as well.

Here's my docker file

 FROM golang:1.8
 COPY startup.sh /startup.sh
 RUN go get github.com/ponzu-cms/ponzu/...
 RUN mkdir /app
 ADD . /app/

 RUN cd /app
 WORKDIR /app
 EXPOSE 8080
 RUN chmod -R 700 /startup.sh

 ENTRYPOINT ["/bin/bash", "/startup.sh"] 

startup.sh is

 #!/usr/bin/env bash

 ponzu build && ponzu run

from ponzu.

nilslice avatar nilslice commented on April 28, 2024

Are you sure that the ADD . /app/ line is providing the files from the unzipped app to the container? It seems like the problem is that the content package files that you created are not being added. Maybe add a RUN ls /app/content line to see what is there at deploy time (assuming you can see the output of the docker build.)

from ponzu.

Nemesisesq avatar Nemesisesq commented on April 28, 2024
package content

import (
	"fmt"

	"github.com/ponzu-cms/ponzu/management/editor"
	"github.com/ponzu-cms/ponzu/system/item"
)

type Hello struct {
	item.Item

	World string `json:"world"`
}

// MarshalEditor writes a buffer of html to edit a Hello within the CMS
// and implements editor.Editable
func (h *Hello) MarshalEditor() ([]byte, error) {
	view, err := editor.Form(h,
		// Take note that the first argument to these Input-like functions
		// is the string version of each Hello field, and must follow
		// this pattern for auto-decoding and auto-encoding reasons:
		editor.Field{
			View: editor.Input("World", h, map[string]string{
				"label":       "World",
				"type":        "text",
				"placeholder": "Enter the World here",
			}),
		},
	)

	if err != nil {
		return nil, fmt.Errorf("Failed to render Hello editor view: %s", err.Error())
	}

	return view, nil
}

func init() {
	item.Types["Hello"] = func() interface{} { return new(Hello) }
}
 ---> 2e17051781b7
Removing intermediate container 64320a4ae687
Step 11/15 : RUN cat /app/content/tooltip.go
 ---> Running in 73e527f70e5a
package content

import (
	"fmt"

	"github.com/ponzu-cms/ponzu/management/editor"
	"github.com/ponzu-cms/ponzu/system/item"
)

type Tooltip struct {
	item.Item

	Name  string `json:"name"`
	Title string `json:"title"`
	Body  string `json:"body"`
}

// MarshalEditor writes a buffer of html to edit a Tooltip within the CMS
// and implements editor.Editable
func (t *Tooltip) MarshalEditor() ([]byte, error) {
	view, err := editor.Form(t,
		// Take note that the first argument to these Input-like functions
		// is the string version of each Tooltip field, and must follow
		// this pattern for auto-decoding and auto-encoding reasons:
		editor.Field{
			View: editor.Input("Name", t, map[string]string{
				"label":       "Name",
				"type":        "text",
				"placeholder": "Enter the Name here",
			}),
		},
		editor.Field{
			View: editor.Input("Title", t, map[string]string{
				"label":       "Title",
				"type":        "text",
				"placeholder": "Enter the Title here",
			}),
		},
		editor.Field{
			View: editor.Textarea("Body", t, map[string]string{
				"label":       "Body",
				"placeholder": "Enter the Body here",
			}),
		},
	)

	if err != nil {
		return nil, fmt.Errorf("Failed to render Tooltip editor view: %s", err.Error())
	}

	return view, nil
}

func init() {
	item.Types["Tooltip"] = func() interface{} { return new(Tooltip) }
}
 ---> a31788859947
Removing intermediate container 73e527f70e5a
Step 12/15 : RUN ls /app
 ---> Running in 1f39c0d12f71
Dockerfile
Dockerrun.aws.json
LICENSE
README.md
addons
analytics.db
bundle.zip
cmd
content
deployment
examples
ponzu-banner.png
startup.sh
system.db
uploads
 ---> 23b9f9ff7c8b
Removing intermediate container 1f39c0d12f71
Step 13/15 : RUN ponzu build
 ---> Running in 7b628e44a7db
 ---> da2ea12f0c53
Removing intermediate container 7b628e44a7db
Step 14/15 : RUN ls /app
 ---> Running in baa8a1921bad
Dockerfile
Dockerrun.aws.json
LICENSE
README.md
addons
analytics.db
bundle.zip
cmd
content
deployment
examples
ponzu-banner.png
ponzu-server
startup.sh
system.db
uploads
 ---> f65dc70016cd
Removing intermediate container baa8a1921bad
Step 15/15 : CMD ponzu run
 ---> Running in c1490deb8be5
 ---> 183d8e4c281b
Removing intermediate container c1490deb8be5
Successfully built 183d8e4c281b

from ponzu.

Nemesisesq avatar Nemesisesq commented on April 28, 2024

thats the output of the docker build locally

from ponzu.

nilslice avatar nilslice commented on April 28, 2024

@Nemesisesq -
Are you expecting to see both the content/hello.go and content/tooltip.go? You pasted hello.go in the comment and then ran RUN cat /app/content/tooltip.go in the docker output.

Are you seeing either of them in your admin UI?

from ponzu.

Nemesisesq avatar Nemesisesq commented on April 28, 2024

I am not seeing them in the admin UI when I build and run the docker container. when I run ponzu build && ponzu run from my computer it worlds and I can see the contents in the UI. When I run docker locally it is not. I am making sure the container is building properly.

from ponzu.

nilslice avatar nilslice commented on April 28, 2024

Is anything being restored from you local build? For example, do you need to re-initialize the CMS with your email / password./ CMS name / host etc? (indicating that system.db isn't loaded), or are the configuration setting all the same from local to docker?

from ponzu.

Nemesisesq avatar Nemesisesq commented on April 28, 2024

yeah I am not including system or analytics db. And I'm still not seeing hello or tooltip in the admin.

from ponzu.

nilslice avatar nilslice commented on April 28, 2024

So the steps you are taking are these:

  1. bundle your local zip and deploy
  2. docker build with the unzipped app, ignoring the *.db files
  3. run ponzu, visit $YOUR_IP:8080/admin
  4. you're redirected to $YOUR_IP:8080/admin/init
  5. you fill out the initialization, and are redirected to $YOUR_IP:8080/admin
  6. nothing is listed in the Content section of your UI

Correct?

Do you have a .dockerignore file? If so, can you paste it in this thread?

from ponzu.

Nemesisesq avatar Nemesisesq commented on April 28, 2024

So I got it working inside docker I'm not exactly sure how. I think it had to do with how I was adding the directories. Is it possible to save the data to mongo db or something? or a db with some more persistence?

from ponzu.

Nemesisesq avatar Nemesisesq commented on April 28, 2024

Thank you for your help I really appreciate it.

from ponzu.

nilslice avatar nilslice commented on April 28, 2024

Glad it is working for you! Happy to help.

You should try to create a volume (see docker docs) between your host and container so the db files persist between builds. We only support BoltDb as of now, but may consider adding optional db backends including mongo in the future.

from ponzu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.