Experienced with other cloud hosting providers I tried Digital Ocean the first time to set up a Wagtail app (should be a staging/production environment with pipeline in the future). Following this tutorial (but just deploying a SQLite database not a solid one), everything works fine. The app will be understand as a Python app when cloning it from GitHub and the default build process (by Python Buildpack) followed by running with Gunicorn server will be executed like expacted – there is no Dockerfile provided. Afterwards the frontend works as expected when first opening it. The admin panel allows to enter but when navigating to page editing it destroys the session and I´m faced with the login panel – probably auto logout, since expired session. The django-admin reacts the same way.
The tutorial uses get_random_secret_key. Maybe this is not accepted by Digital Ocean? Another maybe important information is that the set-cookie header first contains a expiry date in one year (like it is set). But after the session was destroyed it´s set to 1970 (probably something like a null value). Actually this is just the indicator for the forced ended session I guess.
Since it´s not so easy to find out, if it´s something which has to do with the code or safety measurements I didn´t share code. But I can do that of course, if it´s needed. It´s probably a issue not just for me and a hiint which is the cause could help other developers struggeling with this, too.
Related
I'm tasked with creating a web app (I think?) for my job that will tracker something in our system. It'll be an internal tool that staff uses to keep track of the status of one of the things we do. It should look like trello, with cards that drag from step to step. That frontend exists, but my job is to make the system update when the cards are dragged. This requires using an API in Python and isn't that complicated to grab from/update. I have no idea how to put all of this together. My job is almost completely nontechnical and there's no one internally who knows what I'm doing except for me. I'm in so over my head here and have no idea where to begin. Is this something I should deploy on Elastic Beanstalk? EC2? How do I tie this together and put it somewhere?
Are you trying to pull in live data from Trello or from your companies own internal project management tool?
An EC2 might be useful, but honestly, it may be completely unnecessary if your company has its own servers. An EC2 is basically just a collection of rental computers to help with scaling. I have never used beanstalk so my input would be useless there.
From what I can assume from the question, you could have a python script running to pull from the API and make the changes without an EC2.
First thing you should do is gather as much information about what the end product should look like. From your question, I have the feeling that you have only a vague idea of what the stakeholders want. Don't be afraid to ask more clarification about an unclear task. It's better to spend 30 minutes discussing and taking note than to show the end-product after a month and realizing that's not what your boss/team wanted.
Question I would Ask
Who is going to be using this app? (technical or non-technical person)
For what purpose is this being developed?
Does it need to be on the web or can it be used locally?
How many users need to have access to this application?
Are we handling sensitive information with this application?
Will this need to be augmented with other functionality at some point?
This is just a sample of what I would ask, during the conversation with the stakeholder a lot more will pop up for sure.
What I think you have to do
You need to make a monitoring system for the tasks that need to be done by your development team (like a Kanban)
What I think you already have
A frontend with the card that are draggable to each bin. I also assume that you can create a new card and delete one in the frontend. The frontend is most likely written in React, Angular or Vue.js. You might also have no frontend framework (a mix of jQuery and vanilla js), but usually frontend developper end up picking a framework of sort to help the development.
A backend API in Python (in Flask or with Django-rest-framework most likely) that is communicating with a SQL database like postgresql or a Document database like MongoDB.
I'm making a lot of assumption here, but your aim should be to understand the technology you will be working with in order to check which hosting would work best. For instance, if the database that is setup is a MySQL database you might have some trouble with some hosting provider.
What I think you are missing
Currently the frontend and the backend don't communicate to each other. When you drag a card it won't persist if you refresh the page. Also, all of this is sitting in your computer and cannot be used by any one from your staff. You need to first connect the frontend with the backend so that the application has persistance. Then you need to deploy this application somewhere so that it is reachable by your staff.
What I would do is first work locally to make sure that the layer of persistance is working. This imply having the API server, the frontend server and the database server running simultaneously on your computer to develop. You should then fetch data from the API to know which cards are there in the database and then create them visually in your frontend at the right spot.
When you drop a card to a new spot after having dragging it should trigger a POST request to your API server in order to update the status of this particular card (look at the documentation of your API to check what you need to send).
The server should be sending back an updated version of the cards status if the POST request was sucessful, so your application should then just redraw the card at the right spot (it won't make a difference for you since they are already at the right spot and your frontend framework will most likely won't act on this change since the state hasn't changed). That's all I would do for that part.
I would then move to the deployment phase to make sure that whatever you did locally can still work online. I would use Heroku to start instead of jumping directly to AWS. Heroku is a service built on top of AWS which manage a lot of the complexity of AWS for you. This is great for prototyping and it means that when your stuff is ready you can migrate to AWS easily and be confident that a setup exist to make your app work. You might also be tied up to your company servers, which is another thing I would ask to the stakeholder (i.e. where can I put this application and where I can't put it).
The flow for a frontend + api + database application on Heroku is usually as follow. You create a github repo for your frontend (make it private) and you create an app on Heroku that will watch this repository for changes. It will re-deploy the application for you when it sees a change at a specific subdomain of Heroku hosting. You will need to configure some procfiles that will tell Heroku what to do with a given application type. This is where you need to double check what frontend you are using since that might change the procfiles used. It's most likely a node.js based frontend (React, Angular or Vue) so head over here for the documentation of how to put that online.
You will need to make a repo for the backend also that is separate from the frontend, these two entities are distinct and they only communicate through HTTP request (frontend->backend) and JSON (backend->frontend). You will need to follow the same idea as with the frontend to deploy, head over here.
Once you have these two online, you need to create a database on Heroku. This is done by adding a datastore to your api, head over here. There are some framework specific configuration you need to do to make the API talk to an online database, but then you will need to find that configuration on the framework documentation. The database could also be already up and living on your server, if this is the case you just need to configure your online backend to talk to that particular database at a particular address.
Once all of the above is done, re-test your application to check if you get the same behavior as before. This is a usable MVP, however there are no layer of security. Anyone with the right URL could just fetch your frontend and start messing around with your data.
There is more engineering that need to be done to make this a viable end product. This leads us to my final remark: why you are not using a product like Trello, Jira, or even Github Project? If it is to save some money on not paying for a subscription I think you should factor in the cost of development, security and maintenance of this application.
Hope it helps!
One simple option is Heroku for deploy your API and your frontend application.
I’m running a Django app on Heroku and have installed this piece of code: https://github.com/st4lk/django-solid-i18n-urls
It works just as expected on the Django built-in server, but when deployed to Heroku, I’m starting to see some really nasty problems.
I have Gunicorn running with multiple workers and if I use this code, the language preference starts to work randomly (I guess it depends which instance the request goes against).
For example if I have EN as the default (non-prefixed url) and DE as the second language, everything is working fine if I just browse the / urls. Now, if I switch to /de/ (manually enter URL or switch from the Django language switcher), the main / url starts to work intermittently – if I keep refreshing the page, I get either a 404 or the page in DE. But there’s no way to switch it back to using EN completely again. Same happens with all the other URLs as well, I get either a 404 or the corresponding page in DE. And there’s no way to force it back to EN, even from the Django’s set_language view.
If I never touch the /de/ urls, it works all very well without the prefixed URLs.
Does anyone have any ideas how to get this working also on Heroku and Gunicorn?
It turns out Gunicorn and the middleware override works fine, problem was with another piece of custom middleware.
I'm using the New Relic addon on a Django/Python Heroku app and I would like to log deployments, but I can't figure out how to do it.
Heroku offers an HTTP POST deploy hook, but it seems to be too restrictive to match the requirements for the New Relic REST API: it requires a x-api-key header and the parameter names don't match (see here for details).
I haven't been able to find any information about this anywhere. Am I missing something? Is there another way to do this?
Thanks.
This should happen automatically, but NewRelic deployment tracking integration with Heroku has been broken since approx Nov 1st.
I have a support ticket open on this issue and it should be fixed sometime in the next week or so.
EDIT (11/23/2013):
Heroku acknowledged this is a bug caused by an overhaul of the NewRelic addon. Here's what they said as root cause on my support ticket:
I've got an update on this, but no resolution yet. To give you some context (given you've asked how this has happened 3 times) New
Relic were the very first add-on in the Marketplace and as a result
there has been a lot of gnarly code very specific to their
implementation. On their side they've also had to . And as you've
gathered unfortunately much of it was not well tested. We've been
working with New Relic all year to finally fix that, and we've moved
them across to the standard API that all other add-ons and most PaaS
providers now adhere to. Any new customers since May have been on that
new integration so we've been testing it out for 6 months. The final
part of that process was to remove customers on the legacy integration
and that occurred as part of the migration onto the new pricing we
announced at the start of this month.
It's only after this migration we realized there was no support for deploy notifications.
New customers since may had never been exposed to the feature so
didn't notice it was missing, and it appears none of the legacy
customers we tested with in October noticed it was missing either. To
rectify the situation we've had to try and build this feature out in
the Add-ons API. That's been documented and deployed, and we're now
working with New Relic to help their engineers implement it as soon as
they possibly can.
I don't think you can view my support ticket, but you're welcome to reference it with Heroku if you file your own ticket:
https://help.heroku.com/tickets/102722
EDIT (01/06/2014):
NewRelic/Heroku appear to have fixed their integration so that deploys are now being tracked successfully. This appears to have gone into effect sometime on/before 1/2/2014.
I love django, and I like flex. Django for it's cool debugging system (those yellow pages helps a lot to find bugs in my code), and flex for it possibilities.
Recently I come across a problem. If I create a form in flex and then communicate with the django server, I can't see any debugging info (when the exception happens in django).
Not sure, if there is a way to get the debugging info, because it is not accessible in command line (no error output), or in firebug....
Also I tried to create a quick html form, and post same data as I send from flex form, but it's a bit of pain to be honest.
Will be happy to listen how do you solve the problem
I've used firebug to debug the flex side of things. But I've been using json or XML for communication between the two. Since flash uses the browser to do the network stuff, the request should be visible in the net tab of firebug.
To debug the django side of things, you have a few options.
If you're using the django dev server, you can add print statements to find out what's going on.
You can write a unit test to see if the django side of things is doing what you expect it to, given known data.
You can use the pyDev debugger to run the django dev server and step through your code.
I use a combination of these to debug my code.
I've tried to do it like they describe in the AppEngine docs but I can't get it to accept my upload. (I haven't tried to download.) I want to get it working in the development environment before I tried on the live site.
It's kind of confusing, because I don't know if I should be trying appcfg.py or bulkloader.py. (I mostly tried appcfg.py.) I think it's an authentication problem, as it keeps asking me for the email/password. (Even after I removed 'login: admin' from app.yaml.)
I did --dry_run and it seemed to work, so I think my stuff is well formed.
Before asking for specific debugging help, I thought I would ask if anyone knows of working sample code that I can download. I run OS X 10.6, if anyone cares. I'm not new to Python, and have a lot of web.py experience, so it's probably not unfamiliarity with the language that's tripping me up.
The docs have a section on uploading and downloading data, with examples. You should be using appcfg.py unless you need one of the features of bulkloader.py that are not yet integrated, such as --dump/--restore functionality.
It sounds like the authentication problems you're having are related to Google Apps: If you have an App Engine app that allows any Google account to authenticate, and you have a Google Apps account as administrator, you won't be able to authenticate against your app as an administrator with it, even if you have created a Google account for that email address. You need to create a gmail account, and add that account as an administrator, so you can use that address when you need to authenticate against your app.